summaryrefslogtreecommitdiff
path: root/.config/sxiv
diff options
context:
space:
mode:
authorJackson Taylor <jackson@jacksontaylor.xyz>2022-02-03 22:22:11 -0500
committerJackson Taylor <jackson@jacksontaylor.xyz>2022-02-03 22:28:08 -0500
commit7888574b1c18c77b75e5c6c5930cd0709f16898a (patch)
treeed4214ac5696c5641a1d8e3d335d68f7ca72f6d2 /.config/sxiv
parent7434b9127257627a48b7520effd46fb389f1fddd (diff)
Catching upHEADmaster
Diffstat (limited to '.config/sxiv')
-rwxr-xr-x.config/sxiv/exec/key-handler33
1 files changed, 33 insertions, 0 deletions
diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler
new file mode 100755
index 0000000..b5ce4c0
--- /dev/null
+++ b/.config/sxiv/exec/key-handler
@@ -0,0 +1,33 @@
+#!/bin/sh
+while read file
+do
+ case "$1" in
+ "w") set_wallpaper "$file" & ;;
+ "c")
+ [ -z "$destdir" ] && destdir="$(sed "s/\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
+ cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
+ ;;
+ "m")
+ [ -z "$destdir" ] && destdir="$(sed "s/\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
+ mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
+ ;;
+ "r")
+ convert -rotate 90 "$file" "$file" ;;
+ "R")
+ convert -rotate -90 "$file" "$file" ;;
+ "f")
+ convert -flop "$file" "$file" ;;
+ "y")
+ echo -n "$file" | tr -d '\n' | xclip -selection clipboard &&
+ notify-send "$file copied to clipboard" & ;;
+ "Y")
+ readlink -f "$file" | tr -d '\n' | xclip -selection clipboard &&
+ notify-send "$(readlink -f "$file") copied to clipboard" & ;;
+ "d")
+ [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
+ "g") ifinstalled gimp && setsid -f gimp "$file" ;;
+ "i") notify-send "File information" "$(mediainfo "$file")" ;;
+ esac
+done