diff options
author | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2020-12-14 00:37:20 +0300 |
---|---|---|
committer | Yaroslav de la Peña Smirnov <yps@yaroslavps.com> | 2020-12-14 00:37:20 +0300 |
commit | 9b6a8eb73df962faf29572af22278c3af7cba159 (patch) | |
tree | 6aad62a139240fe6c6e709db4dfb7e2670a9b75e /dotfiles/.config/sxiv | |
parent | 1cbded5b3b37fd8321354f696f36fad108691f2a (diff) | |
download | swayrice-9b6a8eb73df962faf29572af22278c3af7cba159.tar.gz swayrice-9b6a8eb73df962faf29572af22278c3af7cba159.zip |
sxiv: shorcut to rotate images
Taken and modified from the example script included with sxiv.
Diffstat (limited to 'dotfiles/.config/sxiv')
-rwxr-xr-x | dotfiles/.config/sxiv/exec/key-handler | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dotfiles/.config/sxiv/exec/key-handler b/dotfiles/.config/sxiv/exec/key-handler index 8fa1bdb..d9bad9f 100755 --- a/dotfiles/.config/sxiv/exec/key-handler +++ b/dotfiles/.config/sxiv/exec/key-handler @@ -1,5 +1,14 @@ #!/bin/sh +rotate() { + degree="$1" + file="$2" + case "$(file -b -i "$file")" in + image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;; + *) mogrify -rotate "$degree" "$file" ;; + esac +} + while read file; do case "$1" in "C-a" | "C-1") @@ -31,5 +40,8 @@ while read file; do mv $(dirname "$dir")/"$base".NEF ~/etc/temp/trash/ fi exit ;; + "C-comma") rotate 270 $file ;; + "C-period") rotate 90 $file ;; + "C-slash") rotate 180 $file ;; esac done |