key-handler (1552B)
1 #!/bin/sh 2 set -e 3 while read -r file; do 4 fullpath="$(pwd)/$file" 5 case "$1" in 6 "c") 7 [ -z "$destdir" ] && \ 8 destdir="$(dmenu -l 20 -i -p "Copy file(s) to where?" | \ 9 sed "s|~|$HOME|g")" 10 [ -z "$destdir" ] && exit 11 cp "$file" "$destdir" 12 notify-send -i "$fullpath" "$file copied to $destdir.";; 13 "i") 14 notify-send "$(exiftool "$file")";; 15 "m") 16 [ -z "$destdir" ] && \ 17 destdir="$(dmenu -l 20 -i -p "Move file(s) to where?" | \ 18 sed "s|~|$HOME|g")" 19 [ -z "$destdir" ] && exit 20 cp "$file" "$destdir" 21 notify-send -i "$fullpath" "$file moved to $destdir." & 22 ;; 23 "o") 24 opener="$(echo | dmenu -p "Open with:")" 25 nohup $opener "$file" >/dev/null 2>/dev/null &;; 26 "r") 27 convert -rotate 90 "$file" "$file";; 28 "R") 29 convert -rotate -90 "$file" "$file";; 30 "f") 31 convert -flop "$file" "$file";; 32 "y") 33 printf "%s" "$file" | xclip -selection clipboard 34 notify-send "$file copied to clipboard" & ;; 35 "Y") 36 printf "%s" "$fullpath" | xclip -selection clipboard 37 notify-send "$fullpath copied to clipboard" & ;; 38 "d") 39 [ "$(printf "No\\nYes" | \ 40 dmenu -i -p "Really delete $file?")" = "Yes" ] && \ 41 rm "$file" && notify-send "$file deleted." ;; 42 "g") 43 gimp "$file" & ;; 44 esac 45 done