Version 0.3.2
Runs a fixed cycle to keep other apps from timing out: rest quietly for a configurable amount of time (default 30 minutes), then run an active burst - for 10 seconds, every 5 seconds it glides the mouse along a short curved path to a random point within a fixed circular area (default 15px radius, centered on wherever the cursor was when the burst started) and clicks (press, brief hold, release), mimicking a real human movement instead of teleporting the cursor. The circle stays fixed for the whole burst, so it can't drift into some other window or button. Then it goes back to resting. This repeats on a fixed schedule and does not pause, cancel, or reset based on your own mouse/keyboard activity.
Only one dependency (pynput), so a venv is optional if you'd rather keep it
simple:
pip3 install --user pynputOr with a venv, if you prefer to keep it isolated:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtOn macOS, grant Accessibility permission to your terminal (or Python) under System Settings > Privacy & Security > Accessibility, so it can control the mouse.
python3 mouse_keepalive.pyOptions:
python3 mouse_keepalive.py --idle-minutes 30 --active-seconds 10 --interval 5 --radius 15 --button left--idle-minutes: minutes to rest between active bursts (default 30)--active-seconds: length of each active burst (default 10)--interval: seconds between move+click actions during a burst (default 5)--radius: radius in pixels of the fixed circular area clicks stay within during a burst (default 15)--button: mouse button to click (default left)
Press F1 at any time to immediately trigger a 10-second debug burst without waiting for the idle timer - handy for testing your setup.
Stop with Ctrl+C.
Double-click start.bat (or run it from a terminal). It creates a .venv,
installs dependencies on first run, then starts the script. Extra arguments
are passed through, e.g. start.bat --idle-minutes 15.
On startup the script does a quick self-test (nudges the cursor 1px and checks it actually moved) and prints a warning if it didn't. If moves/clicks don't seem to work:
- Run as Administrator. If the app you're keeping alive is running elevated (as Administrator), Windows silently blocks synthetic mouse input from a non-elevated process (UIPI) - no error, it just does nothing. Run this script elevated too, matching the target app.
- Check antivirus/EDR software. Some security tools block simulated
input (
SendInput/SetCursorPos) without any visible error. - Give it a minute, or press F1. The default 30-minute rest period before the first burst can look like "nothing is happening" - press F1 to skip the rest and trigger a burst immediately instead of waiting.