Skip to content

Instantly share code, notes, and snippets.

@insanity54
Last active October 14, 2016 22:12
Show Gist options
  • Save insanity54/de6a6e895dcd90ccbd7a9ac45a7350e8 to your computer and use it in GitHub Desktop.
Save insanity54/de6a6e895dcd90ccbd7a9ac45a7350e8 to your computer and use it in GitHub Desktop.
Jiggle/shake/move the mouse cursor to inhibit screensaver
#!/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
#!/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