Last active
December 17, 2017 06:16
-
-
Save Cheeseness/2efe12c47409dbe40781dc405d7c8426 to your computer and use it in GitHub Desktop.
Quick and dirty mousewarp script to keep mouse cursor within Everspace's window
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 | |
| # Quick and dirty mousewarp script to keep mouse cursor within Everspace's 1440x900 window on my second monitor | |
| while true | |
| do | |
| IFS="," | |
| arr=($(xdotool getmouselocation | awk '{ print substr($2,3,length($2)) "," substr($1,3,length($1)) }')) | |
| warp=0 | |
| if [ ${arr[1]} -lt 2160 ] | |
| then | |
| warp=1 | |
| elif [ ${arr[1]} -gt 3600 ] | |
| then | |
| warp=1 | |
| fi | |
| if [ ${arr[0]} -lt 90 ] | |
| then | |
| warp=1 | |
| elif [ ${arr[0]} -gt 990 ] | |
| then | |
| warp=1 | |
| fi | |
| if [ ${warp} -eq 1 ] | |
| then | |
| xdotool mousemove 2880 540 | |
| fi | |
| sleep 0.001 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment