config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 0c07912792451748b15f2bd04ca0c729c02310f6
parent d3df727d6d85944e9edb11071f924a73964f28a5
Author: Jacob R. Edwards <n/a>
Date:   Mon,  5 Dec 2022 17:55:45 -0600

Utilize xinput to ask before image removal in sxiv

Now that xinput can be run with a prompt but without logging history
it's reasonable to use it in this way.

Diffstat:
Mlocal/sxiv/config/sxiv/exec/key-handler | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/local/sxiv/config/sxiv/exec/key-handler b/local/sxiv/config/sxiv/exec/key-handler @@ -9,7 +9,9 @@ die() { print "$@" exit 1 } -ask() test "$(printf 'n\ny\n' | dmenu -p "$1?")" = 'y' +ask() { + xinput -l 0 'remove?' | awk '/^[Yy]/ { exit 0 } 1 { exit 1 }' +} read() xinput "sxiv $1" info() exiftool -f -d '%F' "$@" print() herbe "${*:-$(cat)}" @@ -25,12 +27,14 @@ IFS=' ' images="$(cat)" +# NOTE: Commands which could alter images shouldn't be run in the +# background if you want sxiv to reload them. (i.e. C-c and C-x.) case "$1" in (C-c) read command | sh -s $images ;; (C-C) read command | sh -s $images | print ;; (C-t) info -p '$DateTimeOriginal ($FileName)' $images | print & ;; (C-i) info -d '%F %R %z' -p "$infofmt" $images | print & ;; -(C-x) (ask remove && rm $images) & ;; +(C-x) ask remove && rm $images ;; (C-w) setbg $(last) & ;; (C-s) sxiv -t $images & ;; (C-r) darktable $images & ;;