Skip to content

Instantly share code, notes, and snippets.

@dmadisetti
Forked from bavardage/gist:939140
Last active November 29, 2023 04:31
Show Gist options
  • Save dmadisetti/d21d292f69fbec6a9499 to your computer and use it in GitHub Desktop.
Save dmadisetti/d21d292f69fbec6a9499 to your computer and use it in GitHub Desktop.
Google Docs Hack
#!/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;
@RavenChill-Dev
Copy link

Ty, but the war is over. LOL

@INEEDHACKSS
Copy link

is this supposed to be a bookmarklet?

@dmadisetti
Copy link
Author

It's a bash script to emulate keypresses and run a google docs plugin on a certain key strokes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment