-
Create
mouse.sh
in/home/raspberrypi/mouse.sh
-
Edit crontab
crontab -e
- Add
* * * * * bash /home/raspberrypi/mouse.sh
Install
xdotool
:sudo apt-get install xdotool
Last active
September 11, 2024 03:32
-
-
Save atwalsh/9ee946983e35cec246b3897ece1c9192 to your computer and use it in GitHub Desktop.
Move mouse on Raspberry Pi
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 | |
# Credit: https://fitzcarraldoblog.wordpress.com/2018/08/06/how-to-move-a-mouse-pointer-automatically-in-linux-to-simulate-user-activity/ | |
# Script to keep mouse pointer moving so that, for example, Suspend to RAM timeout does not occur. | |
# | |
# The mouse pointer will move around its current position on the screen, i.e. around any position | |
# on the screen where you place the pointer. However, if you prefer it to move around the centre | |
# of the screen then change mousemove_relative to mousemove in the xdotool command below. | |
# | |
# Set LENGTH to 0 if you do not want the mouse pointer to actually move. | |
# Set LENGTH to 1 if you want the mouse pointer to move just a tiny fraction. | |
# Set LENGTH to e.g. 100 if you want to see more easily the mouse pointer move. | |
export DISPLAY=:0 | |
LENGTH=5 | |
# | |
# Set DELAY to the desired number of seconds between each move of the mouse pointer. | |
DELAY=5 | |
# | |
for ANGLE in 0 90 180 270 | |
do | |
xdotool mousemove_relative --polar $ANGLE $LENGTH | |
sleep $DELAY | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment