key-handler (1258B)
1 #!/usr/bin/env sh 2 while read file 3 do 4 case "$1" in 5 "w") setbg "$file" & ;; 6 "c") 7 [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" 8 [ -z "$destdir" ] && exit 9 cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & 10 ;; 11 "m") 12 [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" 13 [ -z "$destdir" ] && exit 14 mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & 15 ;; 16 "r") 17 convert -rotate 90 "$file" "$file" ;; 18 "R") 19 convert -rotate -90 "$file" "$file" ;; 20 "f") 21 convert -flop "$file" "$file" ;; 22 "y") 23 echo -n "$file" | xclip -selection clipboard && 24 notify-send "$file copied to clipboard" & ;; 25 "Y") 26 readlink -f "$file" | xclip -selection clipboard && 27 notify-send "$(readlink -f "$file") copied to clipboard" & ;; 28 "d") 29 [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;; 30 "g") ifinstalled gimp && gimp "$file" & ;; 31 esac 32 done