aboutsummaryrefslogtreecommitdiff
path: root/config/sxiv/exec/key-handler
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2021-06-01 21:44:12 +0530
committerAkshay Nair <phenax5@gmail.com>2021-06-01 21:44:12 +0530
commitdae97302c821e709654ce25204fd0a7485ce05aa (patch)
tree5206e580e4c843f6b61080f8e8745a2897b302b9 /config/sxiv/exec/key-handler
parent8d29a49ec6afcff5802488ac062d54ba276bee0f (diff)
downloadnixos-config-dae97302c821e709654ce25204fd0a7485ce05aa.tar.gz
nixos-config-dae97302c821e709654ce25204fd0a7485ce05aa.zip
Adds sxiv config
Diffstat (limited to 'config/sxiv/exec/key-handler')
-rwxr-xr-xconfig/sxiv/exec/key-handler27
1 files changed, 27 insertions, 0 deletions
diff --git a/config/sxiv/exec/key-handler b/config/sxiv/exec/key-handler
new file mode 100755
index 0000000..590af3c
--- /dev/null
+++ b/config/sxiv/exec/key-handler
@@ -0,0 +1,27 @@
+#!/usr/bin/env sh
+
+# Mod key = Ctrl + x
+
+rotate() {
+ degree="$1"
+ tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
+ case "$(file -b -i "$file")" in
+ image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;;
+ *) mogrify -rotate "$degree" "$file" ;;
+ esac
+ done
+}
+
+# >, < Rotate
+# <Return> Thumbnail view
+# C-x w Set as wallpaper
+# C-x C-c Copy to clipboard
+
+case "$1" in
+# Copy image to clipboard
+"C-c") while read file; do xclip -selection clipboard -target image/png "$file"; done ;;
+
+# Set as wallpaper
+"w") while read file; do feh --bg-scale "$file"; done ;;
+esac
+