#!/bin/zsh # The key combo argument has the following form: "[C-][M-][S-]KEY", # 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