-
-
Save dmadisetti/d21d292f69fbec6a9499 to your computer and use it in GitHub Desktop.
Google Docs Hack
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/sh | |
# Short script to auto format on save | |
MATCHING=false; | |
press(){ | |
xte "$1"; | |
if [ "x" = "$2x" ]; then | |
sleep 0.05; | |
else | |
sleep 0.2; | |
fi | |
} | |
run(){ | |
MATCHING=false; | |
# Select all | |
press "keydown Control_R" x; | |
press "key a"; | |
press "keyup Control_R"; | |
# Tools->Addons->Code->Selection->Enter | |
press "keydown Alt_R" x; | |
press "key b"; | |
press "keyup Alt_R"; | |
press "key Right"; | |
press "key Down"; | |
press "key Right"; | |
press "key Return"; | |
} | |
prime(){ | |
MATCHING=true; | |
} | |
match(){ | |
while read line; do | |
if [ "$MATCHING" = true ] ; then | |
echo $line | grep "press 39" && run; # S press | |
else | |
MATCHING=false; | |
echo $line | grep "press 37" && prime; # Ctrl press | |
fi | |
done | |
} | |
xinput test $1 | match; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's a bash script to emulate keypresses and run a google docs plugin on a certain key strokes