| 1 | #!/bin/sh |
| 2 | |
| 3 | # Example for $XDG_CONFIG_HOME/sxiv/exec/key-handler |
| 4 | # Called by sxiv(1) after the external prefix key (C-x by default) is pressed. |
| 5 | # The next key combo is passed as its first argument, followed by the paths of |
| 6 | # all marked images or the path of the current image, if no image is marked. |
| 7 | # sxiv(1) blocks until this script terminates. It then checks which images |
| 8 | # have been modified and reloads them. |
| 9 | |
| 10 | # The key combo argument has the following form: "[C-][M-][S-]KEY", |
| 11 | # where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X |
| 12 | # keysym as listed in /usr/include/X11/keysymdef.h without the "XK_" prefix. |
| 13 | |
| 14 | key="$1" |
| 15 | shift |
| 16 | |
| 17 | case "$key" in |
| 18 | "C-c") |
| 19 | echo -n "$@" | xsel -i ;; |
| 20 | "C-e") |
| 21 | for file in "$@"; do urxvt -bg "#444" -fg "#eee" -sl 0 -title "$file" -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;; |
| 22 | "C-g") |
| 23 | gimp "$@" & ;; |
| 24 | "C-comma") |
| 25 | for file in "$@"; do jpegtran -rotate 270 -copy all -outfile "$file" "$file"; done ;; |
| 26 | "C-period") |
| 27 | for file in "$@"; do jpegtran -rotate 90 -copy all -outfile "$file" "$file"; done ;; |
| 28 | "C-slash") |
| 29 | for file in "$@"; do jpegtran -rotate 180 -copy all -outfile "$file" "$file"; done ;; |
| 30 | "C-less") |
| 31 | exec mogrify -rotate -90 "$@" ;; |
| 32 | "C-greater") |
| 33 | exec mogrify -rotate +90 "$@" ;; |
| 34 | "C-question") |
| 35 | exec mogrify -rotate 180 "$@" ;; |
| 36 | esac |
| 37 | |