Skip to content

Instantly share code, notes, and snippets.

@dandanwei
Last active July 19, 2018 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dandanwei/35eb855cf16058734453dbef411667cf to your computer and use it in GitHub Desktop.
Save dandanwei/35eb855cf16058734453dbef411667cf to your computer and use it in GitHub Desktop.
Jump mouse cursor between 2 screens and remember the last location
> git clone https://github.com/BlueM/cliclick.git
> cd cliclick
> make
> echo '800,10' > ~/.screen_jump
copy cliclick to /usr/local/bin/
copy screen_jump.sh to /usr/local/bin
prepare automator or applescript or BetterTouchTool to run the terminal script /usr/local/bin
DONE!
#!/bin/bash
CURRENT_COORD=$(/usr/local/bin/cliclick "p")
TARGET_COORD=`cat ~/.screen_jump`
ABSOLUTE_TARGET_COORD="${TARGET_COORD//-/=-}"
/usr/local/bin/cliclick "m:${ABSOLUTE_TARGET_COORD}"
if [ $CURRENT_COORD != $TARGET_COORD ]; then
echo $CURRENT_COORD > ~/.screen_jump
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment