voidrice/.config/sxiv/exec/key-handler

35 lines
1.4 KiB
Text
Raw Normal View History

2019-11-23 20:35:16 +00:00
#!/usr/bin/env sh
2019-01-03 19:03:09 +00:00
while read file
do
case "$1" in
2019-01-13 02:56:36 +00:00
"w") setbg "$file" & ;;
2019-01-03 19:03:09 +00:00
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/directories | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
2019-01-03 19:03:09 +00:00
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
2019-01-06 19:18:49 +00:00
cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
2019-01-03 19:03:09 +00:00
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.config/directories | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
2019-01-03 19:03:09 +00:00
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
2019-01-06 19:18:49 +00:00
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
2019-01-03 19:03:09 +00:00
;;
"r")
convert -rotate 90 "$file" "$file" ;;
"R")
convert -rotate -90 "$file" "$file" ;;
"f")
convert -flop "$file" "$file" ;;
"y")
echo -n "$file" | xclip -selection clipboard &&
notify-send "$file copied to clipboard" & ;;
"Y")
2019-11-23 20:35:16 +00:00
readlink -f "$file" | xclip -selection clipboard &&
2019-01-06 19:18:49 +00:00
notify-send "$(readlink -f "$file") copied to clipboard" & ;;
2019-01-03 19:03:09 +00:00
"d")
[ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
2019-01-13 02:56:36 +00:00
"g") ifinstalled gimp && gimp "$file" & ;;
2019-01-03 19:03:09 +00:00
esac
done