.dotfiles/.local/bin/screenshot

29 lines
562 B
Plaintext
Raw Normal View History

2021-03-30 20:59:59 +00:00
#!/usr/bin/env sh
s3_bucket=public.serguzim.me/screenshots
s3_host=https://sos-de-fra-1.exo.io
path=/tmp/screenshot.png
2021-04-23 17:38:05 +00:00
process_image()
{
2021-03-30 20:59:59 +00:00
file=$(date "+%F_%H-%M-%S").png
2021-04-23 17:38:05 +00:00
xclip -t image/png $1 -selection clipboard
2021-03-30 20:59:59 +00:00
2021-04-23 17:38:05 +00:00
s3cmd put -P $1 s3://$s3_bucket/$file
echo -n "$s3_host/$s3_bucket/$file" | xclip -selection primary
notify-send -a "Screenshot" "Uploaded screenshot to s3"
2021-04-23 17:38:05 +00:00
}
2021-03-30 20:59:59 +00:00
2021-04-23 17:38:05 +00:00
if [ -n "$1" ] && [ -e "$1" ]
then
convert $1 $path
process_image $path
else
if flameshot gui -r > $path
then
process_image $path
fi
fi