Last active
March 29, 2016 23:24
-
-
Save drobune/68fe60c5da2b3766b4f0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 -xe | |
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` | |
# Avoid chikachika-terminal | |
#app_name=`xprop -id ${id} | grep M_CLASS | cut -f3 -d ' ' | tr '[:upper:]' '[:lower:]' | tr -d ',','"',' ',"\'"` | |
#if [ "$app_name" == "terminator" ]; then | |
# exit 0 | |
#fi | |
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
Depends on https://gist.github.com/drobune/03fa1cb070409bc47928c62c5bb2b61b