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

36 lines
1.5 KiB
Text
Raw Normal View History

2020-11-18 22:05:13 +00:00
#!/bin/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")
2020-04-08 23:10:00 +00:00
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.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")
2020-04-08 23:10:00 +00:00
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.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")
2020-11-18 22:05:13 +00:00
echo -n "$file" | tr -d '\n' | xclip -selection clipboard &&
2019-01-03 19:03:09 +00:00
notify-send "$file copied to clipboard" & ;;
"Y")
2020-11-18 22:05:13 +00:00
readlink -f "$file" | tr -d '\n' | 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." ;;
2020-11-18 22:05:13 +00:00
"g") ifinstalled gimp && setsid -f gimp "$file" ;;
"i") notify-send "File information" "$(mediainfo "$file")" ;;
2019-01-03 19:03:09 +00:00
esac
done