1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat: add scrot-dmenu script

This commit is contained in:
Kierán Meinhardt
2020-05-24 10:08:13 +02:00
parent 9a33c1a106
commit fd36d5279c
3 changed files with 45 additions and 5 deletions

32
packages/scripts/scrot-dmenu.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
# ref https://gitlab.com/dwt1/dotfiles/-/blob/master/.dmenu/dmenu-scrot.sh
APP_NAME="📸 Scrot"
IMG_PATH="$HOME/Downloads/Screenshots"
TIME=3000 #Miliseconds notification should remain visible
cmd=$(printf "fullscreen\nsection\nupload_fullscreen\nupload_section\n" | dmenu -p 'Screenshot')
cd "$IMG_PATH" || exit
case ${cmd%% *} in
fullscreen)
scrot -d 1 \
&& notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (full screen) saved.'
;;
section)
scrot -s \
&& notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (section) saved.'
;;
upload_fullscreen)
scrot -d 1 -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \
&& notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (full screen) uploaded: $(xclip -selection clipboard -out)"
;;
upload_section)
scrot -s -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \
&& notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (section) uploaded: $(xclip -selection clipboard -out)"
;;
esac