Created
February 10, 2016 07:33
-
-
Save drobune/4b30926ab253de22d604 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
base=`basename $0 | sed -e 's/\.sh$//g'` | |
cmd=`echo $base | awk -F '_' '{print $1}'` | |
keystroke=`echo $base | sed -e 's/^[^_]\+_//g'` | |
id=`xdotool getwindowfocus` | |
case $cmd in | |
key) | |
xdotool key --window $id "$keystroke" > /dev/null 2>&1 | |
;; | |
type) | |
echo -n "$keystroke" | xclip -i -selection clipboard | |
xdotool key --window $id "ctrl+v" > /dev/null 2>&1 | |
;; | |
*) | |
echo "usage: ln -s $0 {key|type}_<keystroke>.sh" | |
exit 1;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment