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

34 lines
1.5 KiB
Text
Raw Permalink Normal View History

2020-11-18 22:05:13 +00:00
#!/bin/sh
2022-04-10 19:01:22 +00:00
while read -r file
2019-01-03 19:03:09 +00:00
do
case "$1" in
2019-01-13 02:56:36 +00:00
"w") setbg "$file" & ;;
2019-01-03 19:03:09 +00:00
"c")
2022-06-10 11:54:49 +00:00
[ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ ! -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")
2022-06-10 11:54:49 +00:00
[ -z "$destdir" ] && destdir="$(sed "s/#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ ! -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")
2022-04-10 19:01:22 +00:00
printf "%s" "$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" ;;
2023-01-28 00:16:27 +00:00
"i") notify-send "File information" "$(mediainfo "$file" | sed "s/[ ]\+:/:/g;s/: /: <b>/;s/$/<\/b>/" | grep "<b>")" ;;
2019-01-03 19:03:09 +00:00
esac
done