Unified rotate actions in key-handler; use lossless operation based on file type
This commit is contained in:
parent
056624548a
commit
3a680172c8
|
@ -11,27 +11,22 @@
|
||||||
# where C/M/S indicate Ctrl/Meta(Alt)/Shift modifier states and KEY is the X
|
# 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.
|
# keysym as listed in /usr/include/X11/keysymdef.h without the "XK_" prefix.
|
||||||
|
|
||||||
|
rotate() {
|
||||||
|
case "$(file -b -i "$2")" in
|
||||||
|
image/jpeg*) jpegtran -rotate "$1" -copy all -outfile "$2" "$2" ;;
|
||||||
|
*) mogrify -rotate "$1" "$2" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
key="$1"
|
key="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
case "$key" in
|
case "$key" in
|
||||||
"C-c")
|
"C-c") echo -n "$@" | xsel -i ;;
|
||||||
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-e")
|
"C-g") gimp "$@" & ;;
|
||||||
for file in "$@"; do urxvt -bg "#444" -fg "#eee" -sl 0 -title "$file" -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;;
|
"C-comma") for file in "$@"; do rotate 270 "$file"; done ;;
|
||||||
"C-g")
|
"C-period") for file in "$@"; do rotate 90 "$file"; done ;;
|
||||||
gimp "$@" & ;;
|
"C-slash") for file in "$@"; do rotate 180 "$file"; done ;;
|
||||||
"C-comma")
|
|
||||||
for file in "$@"; do jpegtran -rotate 270 -copy all -outfile "$file" "$file"; done ;;
|
|
||||||
"C-period")
|
|
||||||
for file in "$@"; do jpegtran -rotate 90 -copy all -outfile "$file" "$file"; done ;;
|
|
||||||
"C-slash")
|
|
||||||
for file in "$@"; do jpegtran -rotate 180 -copy all -outfile "$file" "$file"; done ;;
|
|
||||||
"C-less")
|
|
||||||
exec mogrify -rotate -90 "$@" ;;
|
|
||||||
"C-greater")
|
|
||||||
exec mogrify -rotate +90 "$@" ;;
|
|
||||||
"C-question")
|
|
||||||
exec mogrify -rotate 180 "$@" ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue