Remove tagging from key-handler

This commit is contained in:
Bert Münnich 2018-12-31 15:16:25 +01:00
parent 6a662ae5e0
commit 2fb8a8d5fe
1 changed files with 1 additions and 24 deletions

View File

@ -12,10 +12,6 @@
# 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";
readonly TAGFILE="$HOME/.config/sxiv/tags"
readonly TMPFILE="/tmp/sxiv.$$"
rotate() {
degree="$1"
tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
@ -26,24 +22,7 @@ rotate() {
done
}
tag_add() {
>>"$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
case "$1" in
"y") tr '\n' ' ' | xclip -i ;;
"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 ;;
@ -51,7 +30,5 @@ case "$KEY" in
"C-comma") rotate 270 ;;
"C-period") rotate 90 ;;
"C-slash") rotate 180 ;;
"C-t") tag_add ;;
"M-T") tag_del ;;
esac