Krolyxon
Commit e82397d

Branches

Refs →

nsxivexeckey-handler

34 lines · 1.0 KB · Bourne Again Shell (bash)

1#!/bin/sh
2
3# Example for ~/.sxiv/exec/key-handler
4# Called by sxiv(1) whenever an unbound key combo is used,
5# with the key combo as its first argument and the path of the current image
6# as its second argument.
7# sxiv(1) blocks until this script terminates. It then checks if the image
8# has been modified and reloads it.
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
14case "$1" in
15"C-c")
16 echo -n "$2" | xsel -i ;;
17"C-e")
18 urxvt -bg "#444" -fg "#eee" -sl 0 -title "$2" -e sh -c "exiv2 pr -q -pa '$2' | less" & ;;
19"C-g")
20 gimp "$2" & ;;
21"C-comma")
22 exec jpegtran -rotate 270 -copy all -outfile "$2" "$2" ;;
23"C-period")
24 exec jpegtran -rotate 90 -copy all -outfile "$2" "$2" ;;
25"C-slash")
26 exec jpegtran -rotate 180 -copy all -outfile "$2" "$2" ;;
27"C-less")
28 exec mogrify -rotate -90 "$2" ;;
29"C-greater")
30 exec mogrify -rotate +90 "$2" ;;
31"C-question")
32 exec mogrify -rotate 180 "$2" ;;
33esac
34