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

29 lines
450 B
Plaintext
Raw Normal View History

2024-06-23 07:10:17 -04:00
#!/bin/sh
2024-07-16 04:40:15 -04:00
copy() {
file="$1"
file_ext="${file##*.}"
case "$file_ext" in
"png")
copy_path="$file"
;;
*)
file_name="${file##*/}"
file_base="${file_base%%.*}"
copy_path="/tmp/copy_$file_base.png"
;;
esac
xclip -sel clip -t image/png "$file"
notify-send "nsxiv" "Copied <b>$copy_path</b> to the clipboard."
}
2024-07-03 20:01:13 -04:00
while read -r file; do
2024-07-16 04:40:15 -04:00
case "$1" in
2024-07-03 20:01:13 -04:00
w) wallpaper "$file" ;;
2024-07-16 04:40:15 -04:00
e) gimp "$file" ;;
y) copy "$file" ;;
2024-06-23 07:10:17 -04:00
esac
done