diff options
author | shmibs <shmibs@gmail.com> | 2015-02-14 23:40:26 -0700 |
---|---|---|
committer | shmibs <shmibs@gmail.com> | 2015-02-14 23:40:26 -0700 |
commit | 65e6c2d1b7865d1bb0a451653acfc3f19e8f3b22 (patch) | |
tree | 4f3daabbc472734144912025545e02168f3eea90 /.config/sxiv | |
parent | 6adeebbb9aeaba1eeb87fbe9fdec257b9cf5fb3f (diff) | |
download | dotfiles-65e6c2d1b7865d1bb0a451653acfc3f19e8f3b22.tar.gz |
handle multi-file selections
Diffstat (limited to '.config/sxiv')
-rwxr-xr-x | .config/sxiv/exec/key-handler | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler index cf286c9..9eed7d3 100755 --- a/.config/sxiv/exec/key-handler +++ b/.config/sxiv/exec/key-handler @@ -4,35 +4,36 @@ # 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. -case "$1" in -"y") - echo -n "$2" | xclip -selection clipboard ;; -"C-d") - rm "$2" ;; -"g") - gimp "$2" & ;; -"s") - - scp "$2" shmibbles.me:/srv/http/tmp/ - if [ $? -ne 0 ]; then - notify-send "uploading $(basename $2) to /tmp/ failed" - else - name=$(echo "http://shmibbles.me/tmp/$(basename $2)" | sed 's/ /%20/g') - echo "$name" | tr -d '\n' | xclip -i -selection clipboard - echo "$name" | tr -d '\n' | xclip -i -selection primary - notify-send "uploaded $(basename $2) to /tmp/" - fi - ;; -"i") - scp "$2" shmibbles.me:/srv/http/img/ - if [ $? -ne 0 ]; then - notify-send "uploading $(basename $2) to /img/ failed" - else - name=$(echo "http://shmibbles.me/img/$(basename $2)" | sed 's/ /%20/g') - echo "$name" | tr -d '\n' | xclip -i -selection clipboard - echo "$name" | tr -d '\n' | xclip -i -selection primary - notify-send "uploaded $(basename $2) to /img/" - fi - ;; - -esac +while read file +do + case "$1" in + "y") + echo -n "$file" | xclip -selection clipboard ;; + "C-d") + rm "$file" ;; + "g") + gimp "$file" & ;; + "s") + scp "$file" shmibbles.me:/srv/http/tmp/ + if [ $? -ne 0 ]; then + notify-send "uploading $(basename $file) to /tmp/ failed" + else + name=$(echo "http://shmibbles.me/tmp/$(basename $file)" | sed 's/ /%20/g') + echo "$name" | tr -d '\n' | xclip -i -selection clipboard + echo "$name" | tr -d '\n' | xclip -i -selection primary + notify-send "uploaded $(basename $file) to /tmp/" + fi + ;; + "i") + scp "$file" shmibbles.me:/srv/http/img/ + if [ $? -ne 0 ]; then + notify-send "uploading $(basename $file) to /img/ failed" + else + name=$(echo "http://shmibbles.me/img/$(basename $file)" | sed 's/ /%20/g') + echo "$name" | tr -d '\n' | xclip -i -selection clipboard + echo "$name" | tr -d '\n' | xclip -i -selection primary + notify-send "uploaded $(basename $file) to /img/" + fi + ;; + esac +done |