summaryrefslogtreecommitdiff
path: root/home/xyz/.config/nsxiv
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2022-10-11 01:58:43 -0700
committerxyz <gky44px1999@gmail.com>2022-10-11 01:58:43 -0700
commit063b303194c89fd1a8ad0dede9183486e9e13bfe (patch)
tree3df3aeaed6348cf7c7747fa7818ae63089c6c04d /home/xyz/.config/nsxiv
parent237a5d5b86f870c03724248ee76b81fbb54bd82c (diff)
better nsxiv key-handler
Diffstat (limited to 'home/xyz/.config/nsxiv')
-rwxr-xr-xhome/xyz/.config/nsxiv/exec/key-handler25
1 files changed, 19 insertions, 6 deletions
diff --git a/home/xyz/.config/nsxiv/exec/key-handler b/home/xyz/.config/nsxiv/exec/key-handler
index a24b89b0..7da51dd8 100755
--- a/home/xyz/.config/nsxiv/exec/key-handler
+++ b/home/xyz/.config/nsxiv/exec/key-handler
@@ -21,8 +21,8 @@
rotate() {
tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read -r file; do
case "$(file -b -i "$file")" in
- image/jpeg*) jpegtran -rotate 90 -copy all -outfile "$file" "$file" ;;
- *) mogrify -rotate 90 "$file" ;;
+ image/jpeg*) jpegtran -rotate "$1" -copy all -outfile "$file" "$file" ;;
+ *) mogrify -rotate "$1" "$file" ;;
esac
done
}
@@ -30,8 +30,18 @@ rotate() {
flip() {
tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read -r file; do
case "$(file -b -i "$file")" in
- image/jpeg*) jpegtran -flip vertical -copy all -outfile "$file" "$file" ;;
- *) mogrify -flip "$file" ;;
+ image/jpeg*)
+ jpegtran -flip "$1" -copy all -outfile "$file" "$file"
+ ;;
+ *)
+ if [ "$1" = vertical ]; then
+ mogrify -flip "$file"
+ elif [ "$1" = horizontal ]; then
+ mogrify -flop "$file"
+ else
+ exit 1
+ fi
+ ;;
esac
done
}
@@ -53,13 +63,16 @@ linkwall() {
case "$1" in
"d") [ "$(printf 'No\nYes' | dmenu -i -p 'delete?')" = "Yes" ] && tr '\n' '\0' | xargs -0 rm ;;
"e") while read -r file; do alacritty -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;;
- "f") flip ;;
+ "f") flip vertical ;;
+ "F") flip horizontal ;;
"g") tr '\n' '\0' | xargs -0 setsid -f gimp ;;
"l") linkwall ;;
"p") tr '\n' '\0' | xargs -0 sh -c 'convert "$@" $(time.uuid).pdf' shell ;;
- "r") rotate ;;
"w") tr '\n' '\0' | xargs -0 shufwall ;;
# alternative using `xclip -in -selection clipboard`
"y") tr '\n' '\0' | xargs -0 realpath | tr '\n' '\0' | xargs -0 printf '%q ' | xsel -ib ;;
+ "comma") rotate 270 ;;
+ "period") rotate 90 ;;
+ "slash") rotate 180 ;;
esac