Selaa lähdekoodia

Refactored rotation in key-handler

master
Bert Münnich 10 vuotta sitten
vanhempi
commit
75a665670a
1 muutettua tiedostoa jossa 12 lisäystä ja 11 poistoa
  1. +12
    -11
      exec/key-handler

+ 12
- 11
exec/key-handler Näytä tiedosto

@@ -11,13 +11,17 @@
# where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X
# keysym as listed in /usr/include/X11/keysymdef.h without the "XK_" prefix.

readonly KEY="$1"; shift
readonly TAGFILE="$HOME/.config/sxiv/tags"

rotate() {
case "$(file -b -i "$2")" in
image/jpeg*) jpegtran -rotate "$1" -copy all -outfile "$2" "$2" ;;
*) mogrify -rotate "$1" "$2" ;;
esac
degree="$1"; shift
for file in "$@"; do
case "$(file -b -i "$file")" in
image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;;
*) mogrify -rotate "$degree" "$file" ;;
esac
done
}

tag_add() {
@@ -35,16 +39,13 @@ tag_del() {
iptckwed -r "$tags" "$@"
}

key="$1"
shift

case "$key" in
case "$KEY" in
"C-c") echo -n "$@" | xsel -i ;;
"C-e") for file in "$@"; do urxvt -bg "#444" -fg "#eee" -sl 0 -title "$file" -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;;
"C-g") gimp "$@" & ;;
"C-comma") for file in "$@"; do rotate 270 "$file"; done ;;
"C-period") for file in "$@"; do rotate 90 "$file"; done ;;
"C-slash") for file in "$@"; do rotate 180 "$file"; done ;;
"C-comma") rotate 270 "$@" ;;
"C-period") rotate 90 "$@" ;;
"C-slash") rotate 180 "$@" ;;
"C-t") tag_add "$@" ;;
"M-T") tag_del "$@" ;;
esac


Loading…
Peruuta
Tallenna