summaryrefslogtreecommitdiff
path: root/sxiv
diff options
context:
space:
mode:
author--global <ik.boikov.public@protonmail.com>2021-12-19 12:03:01 +0100
committer--global <ik.boikov.public@protonmail.com>2021-12-19 12:03:01 +0100
commit25b613f755424edad38ab7616365bb618237b9fe (patch)
tree46a18fb58fe6ae487be7568da93c813d7268e30e /sxiv
parent6c02d1695a7d31e4a660f25df848f938f5f08da4 (diff)
migration to dwm; home cleanup
Diffstat (limited to 'sxiv')
-rw-r--r--sxiv/.config/sxiv/exec/key-handler33
1 files changed, 33 insertions, 0 deletions
diff --git a/sxiv/.config/sxiv/exec/key-handler b/sxiv/.config/sxiv/exec/key-handler
new file mode 100644
index 0000000..3d9565f
--- /dev/null
+++ b/sxiv/.config/sxiv/exec/key-handler
@@ -0,0 +1,33 @@
+#!/bin/sh
+while read file
+do
+ case "$1" in
+ "w") setbg "$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