sxiv: Update key-handler and add 'C-d' to trash files

master
Pierre Neidhardt 2017-02-06 15:56:54 +01:00
parent f9977136e2
commit 415fa8621c
1 changed files with 12 additions and 11 deletions

View File

@ -1,16 +1,16 @@
#!/bin/sh
readonly KEY="$1"; shift
readonly KEY="$1"
orient() {
for file in "$@"; do
while read file; do
mogrify -auto-orient "$file"
done
}
rotate() {
degree="$1"; shift
for file in "$@"; do
degree="$1"
while read file; do
case "$(file -b -i "$file")" in
image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;;
*) mogrify -rotate "$degree" "$file" ;;
@ -19,11 +19,12 @@ rotate() {
}
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-o") orient "$@" ;;
"C-comma") rotate 270 "$@" ;;
"C-period") rotate 90 "$@" ;;
"C-slash") rotate 180 "$@" ;;
"C-c") tr '\n' ' ' | xsel -i ;;
"C-e") while read file; do urxvt -bg "#444" -fg "#eee" -sl 0 -title "$file" -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;;
"C-g") tr '\n' '\0' | xargs -0 gimp & ;;
"C-o") orient ;;
"C-comma") rotate 270 ;;
"C-period") rotate 90 ;;
"C-slash") rotate 180 ;;
"C-d") while read file; do trash "$file"; done ;;
esac