Remove tagging from key-handler
This commit is contained in:
parent
6a662ae5e0
commit
2fb8a8d5fe
|
@ -12,10 +12,6 @@
|
||||||
# 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.
|
||||||
|
|
||||||
readonly KEY="$1";
|
|
||||||
readonly TAGFILE="$HOME/.config/sxiv/tags"
|
|
||||||
readonly TMPFILE="/tmp/sxiv.$$"
|
|
||||||
|
|
||||||
rotate() {
|
rotate() {
|
||||||
degree="$1"
|
degree="$1"
|
||||||
tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
|
tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
|
||||||
|
@ -26,24 +22,7 @@ rotate() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
tag_add() {
|
case "$1" in
|
||||||
>>"$TAGFILE"
|
|
||||||
tags=$(dmenu <"$TAGFILE" | tr '\n' ',')
|
|
||||||
[ -z "$tags" ] && return
|
|
||||||
iptckwed -i -a "$tags"
|
|
||||||
echo -n "$tags" | tr ',' '\n' | sort - "$TAGFILE" | uniq >"$TAGFILE.new"
|
|
||||||
mv -f "$TAGFILE"{.new,}
|
|
||||||
}
|
|
||||||
|
|
||||||
tag_del() {
|
|
||||||
cat >"$TMPFILE"
|
|
||||||
tags=$(iptckwed -iql <"$TMPFILE" | cut -f 2 | tr ',' '\n' | sort | uniq | dmenu | tr '\n' ',')
|
|
||||||
[ -z "$tags" ] && return
|
|
||||||
iptckwed -i -r "$tags" <"$TMPFILE"
|
|
||||||
rm -f "$TMPFILE"
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$KEY" in
|
|
||||||
"y") tr '\n' ' ' | xclip -i ;;
|
"y") tr '\n' ' ' | xclip -i ;;
|
||||||
"C-c") while read file; do xclip -selection clipboard -target image/png "$file"; done ;;
|
"C-c") while read file; do xclip -selection clipboard -target image/png "$file"; done ;;
|
||||||
"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-e") while read file; do urxvt -bg "#444" -fg "#eee" -sl 0 -title "$file" -e sh -c "exiv2 pr -q -pa '$file' | less" & done ;;
|
||||||
|
@ -51,7 +30,5 @@ case "$KEY" in
|
||||||
"C-comma") rotate 270 ;;
|
"C-comma") rotate 270 ;;
|
||||||
"C-period") rotate 90 ;;
|
"C-period") rotate 90 ;;
|
||||||
"C-slash") rotate 180 ;;
|
"C-slash") rotate 180 ;;
|
||||||
"C-t") tag_add ;;
|
|
||||||
"M-T") tag_del ;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue