dotfiles/bin/screenshot_public.sh

19 lines
478 B
Bash
Raw Normal View History

2021-05-23 17:22:46 +02:00
#!/usr/bin/env bash
set -e
2016-01-31 18:17:44 +01:00
# Setup filename for the screenshot
2022-06-04 14:33:18 +02:00
myfile="$(openssl rand -base64 9)_$(date +%y%m%d%H%M%S).webp"
2016-01-31 18:17:44 +01:00
2021-05-23 17:22:46 +02:00
webpath="https://pub.yori.cc/s/"
fileurl="$webpath$myfile"
2016-01-31 18:17:44 +01:00
# copy-paste
2021-05-23 17:22:46 +02:00
wl-copy <<< "$fileurl"
2022-06-04 14:33:18 +02:00
grimshot save window "$HOME/screenshot-tmp.ppm"
cwebp -preset picture -q 100 "$HOME/screenshot-tmp.ppm" -o "$HOME/public/s/$myfile"
rm "$HOME/screenshot-tmp.ppm"
2016-01-31 18:17:44 +01:00
cd ~
rsync -LavP --cvs-exclude public pub.yori.cc:
2022-06-04 14:33:18 +02:00
notify-send -t 3000 "saved $fileurl"