dotfiles/.bin/sshot
2023-06-26 13:28:54 +02:00

31 lines
669 B
Bash
Executable File

#!/bin/sh -e
. ${HOME}/.bin/_config
trap cleanup 1 2 3 6
cleanup() {
rm -f "${_file_tmp}";
notify-send "sshot: Aborted..."
}
_filename="$(date "+%Y-%m-%d_%H-%M-%S")-sshot.png"
_file_tmp="/tmp/${_filename}"
_file_out="${HOME}/.screenshots/${_filename}"
mkdir -p "${HOME}/.screenshots"
flameshot gui -p "${_file_tmp}"
test -f "${_file_tmp}" || exit 1
pngcrush -reduce "${_file_tmp}"
cp "${_file_tmp}" "${_file_out}"
mv "${_file_tmp}" "~/Downloads/"
scp "${_file_out}" "sdk@codevoid.de:/home/www/htdocs/gopher/p/${_filename}"
printf '%s' "https://codevoid.de/I/p/${_filename}" | xclip
echo "$_file_out"
notify-send "https://codevoid.de/I/p/${_filename}"