dotfiles/.bin/sshot

52 lines
879 B
Bash
Executable File

#!/bin/sh -e
. ${HOME}/.bin/_config
#
# SIGNAL HANDLER
#
trap cleanup 1 2 3 6
cleanup() {
rm -f "${_file_tmp}";
notify-send "sshot: Aborted..."
}
#
# CONFIGURATION
#
_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:make-web/src/paste/
#
# BUILD WEBSITE
#
ssh home.codevoid.de "cd make-web && make install"
#
# 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}"