Skip to content

Instantly share code, notes, and snippets.

@erkiesken
Created March 9, 2023 14:08
Show Gist options
  • Save erkiesken/1c00ad9d2501198ff4179fb56f4f2ff4 to your computer and use it in GitHub Desktop.
Save erkiesken/1c00ad9d2501198ff4179fb56f4f2ff4 to your computer and use it in GitHub Desktop.
google docs zoom scripting
#!/usr/bin/env bash
unset x y w h id
eval $(xwininfo -id $(xdotool getactivewindow) |
sed -n -e "s/^ \+Absolute upper-left X: \+\([0-9]\+\).*/x=\1/p" \
-e "s/^ \+Absolute upper-left Y: \+\([0-9]\+\).*/y=\1/p" \
-e "s/^ \+Width: \+\([0-9]\+\).*/w=\1/p" \
-e "s/^ \+Height: \+\([0-9]\+\).*/h=\1/p" \
-e "s/^xwininfo: Window id: [^\"]*\(.*\)/id=\1/p"
)
if [[ "$id" == *"Google Docs"* ]]; then
xdotool mousemove $(($x + 200)) $(($y + 184))
xdotool click 1
xdotool mousemove $(($x + 200)) $(($y + 435))
xdotool click 1
fi
if [[ "$id" == *"Google Sheets"* ]]; then
xdotool mousemove $(($x + 200)) $(($y + 184))
xdotool click 1
xdotool mousemove $(($x + 200)) $(($y + 396))
xdotool click 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment