Last active
October 14, 2016 22:12
-
-
Save insanity54/de6a6e895dcd90ccbd7a9ac45a7350e8 to your computer and use it in GitHub Desktop.
Jiggle/shake/move the mouse cursor to inhibit screensaver
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 | |
# GUI version. Could be really useful for Partedmagic. Work-in-progress. | |
export MAIN_DIALOG=' | |
<window title="Mouse Jiggler"> | |
<vbox> | |
<text> | |
<label>Jiggle the mouse to prevent the display from sleeping</label> | |
</text> | |
<checkbox> | |
<label>Jiggle the mouse</label> | |
<variable>shake</variable> | |
<action>if true shakethemouse</action> | |
</checkbox> | |
</vbox> | |
</window> | |
' | |
# I don't know how to finish this script | |
# shakethemouse is blocking | |
# and I need the action above to not block | |
function shakethemouse { | |
while [ true ]; do | |
xdotool mousemove_relative --sync 1 1 | |
xdotool mousemove_relative --sync -- -1 -1 | |
sleep 0.2 | |
done | |
} | |
export -f shakethemouse | |
gtkdialog --program=MAIN_DIALOG |
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 | |
# jiggle the mouse until Ctrl+C is pressed. | |
while [ true ]; do | |
xdotool mousemove_relative --sync 1 1 | |
xdotool mousemove_relative --sync -- -1 -1 | |
sleep 0.2 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment