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

37 lines
1.3 KiB
Text
Raw Normal View History

2019-01-03 19:03:09 +00:00
#!/bin/sh
while read file
do
case "$1" in
"w")
cp "$file" ~/.config/wall.png &&
setbg
2019-01-03 19:03:09 +00:00
notify-send -i "$HOME/.config/wall.png" "Wallpaper changed." ;;
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ~/.bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && 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" ~/.bmdirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && 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-01-06 19:18:49 +00:00
echo -n "$(readlink -f "$file")" | xclip -selection clipboard &&
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." ;;
"G")
gimp "$file" & ;;
esac
done