dotfiles/.bin/sshot

52 lines
880 B
Plaintext
Raw Normal View History

2023-02-22 08:31:38 +01:00
#!/bin/sh -e
. ${HOME}/.bin/_config
#
# SIGNAL HANDLER
#
2023-02-22 08:31:38 +01:00
trap cleanup 1 2 3 6
cleanup() {
rm -f "${_file_tmp}";
notify-send "sshot: Aborted..."
}
#
# CONFIGURATION
#
2023-04-14 16:46:09 +02:00
_filename="$(date "+%Y-%m-%d_%H-%M-%S")-sshot.png"
_file_dir="${HOME}/Downloads/Screenshots"
mkdir -p "$_file_dir"
#
# TAKE SCREENSHOT
#
flameshot gui -p "${_file_dir}/${_filename}"
test -f "${_file_dir}/${_filename}" || exit 1
pngcrush -reduce "${_file_dir}/${_filename}"
#
# UPLOAD
#
scp "${_file_dir}/${_filename}" sdk@home.codevoid.de:web/static/paste/
#
# BUILD WEBSITE
#
ssh home.codevoid.de "cd web && make update && make"
#
# COPY TO CLIPBOARD
#
printf '%s' "https://home.codevoid.de/paste/${_filename}" | xclip
#
# PRINT TO STDOUT
#
echo "https://home.codevoid.de/paste/${_filename}"
echo "${_file_dir}/${_filename}"
#
# NOTIFY
#
notify-send "https://home.codevoid.de/paste/${_filename}"