Install Keep Presence via Snap
masterFor systems supporting Snap, you can install the package using the following command:
sudo snap install keep-presenceAfter installation, run it using:
keep-presencerepository·master·Indexed 43 days ago
https://github.com/carrot69/keep-presenceA utility that prevents a computer from entering idle mode by simulating mouse movement, keyboard presses, or scrolling when user inactivity is detected. It supports X11 environments and provides a CLI with configurable modes including keyboard, mouse, both, and scroll, as well as random interval execution.
For systems supporting Snap, you can install the package using the following command:
sudo snap install keep-presenceAfter installation, run it using:
keep-presenceOnce installed via PyPI, you can start the program using either the direct CLI command or by running it as a Python module.
keep-presence
# or
python3 -m keep_presencekeep-presenceKeep Presence is a CLI tool that prevents your computer from going idle by simulating mouse movement, keyboard presses, or mouse wheel scrolling. It only executes these actions when it detects that the mouse has not moved (i.e., the user is away).
To use the tool, run the script via Python and provide arguments to customize the behavior.
python src/keep-presence.py --mode mouse --seconds 60You can install keep-presence using pip. This is the recommended method for Python environments.
python3 -m pip install keep_presenceIf you prefer to install from the source code, clone the repository and install the pynput dependency manually.
git clone https://github.com/carrot69/keep-presence.git
cd keep-presence
python3 -m pip install pynput
python3 src/keep-presence.pyTo ensure keep-presence runs automatically when you log in, you can add it to your desktop environment's startup applications.
keep-presence --circular --seconds 180 --pixels 1You can also use Systemd to manage keep-presence as a startup service. Refer to official Systemd documentation for setup details.
On Linux, you can use the timeout command to automatically stop keep-presence after a specified duration.
timeout 30s keep-presencekeep-presence does not support Wayland due to limitations in the pynput library. It is designed for X11 environments. Check the project's GitHub issues for updates on Wayland support.The --mode (or -m) flag determines which hardware simulation is performed when the user is detected as idle:
keyboard: Presses the Shift key.mouse: Moves the mouse by the specified number of pixels.both: Performs both the keyboard (Shift) and mouse movement actions.scroll: Performs a mouse wheel scroll action.Available options: keyboard, mouse, both (mouse & keyboard) and scrollUse these flags to customize how keep-presence behaves when it detects user inactivity.
| Flag | Long Flag | Description |
|---|---|---|
-h | --help | Show this help message and exit |
-s | --seconds SECONDS | Seconds to wait after user is idle. Default: 300 |
-p | --pixels PIXELS | Number of pixels to move the mouse. Default: 1 |
-c | --circular | Move mouse in a circle. Default: diagonal move |
-m | --mode MODE | Action to execute: keyboard, mouse, both, or scroll. Default: mouse |
-r | --random START STOP | Execute actions based on a random interval between start and stop seconds. Overwrites --seconds |
Note on --mode:
keyboard: Presses the shift key.mouse: Moves the mouse.both: Performs both actions.scroll: Performs scrolling action.# Example: Move mouse in a circle every 180 seconds by 1 pixel
keep-presence --circular --seconds 180 --pixels 1
# Example: Use a random interval between 3 and 10 seconds
keep-presence -r 3 10The following command-line arguments are available to control how Keep Presence simulates activity:
| Flag | Long Form | Description |
|---|---|---|
-s | --seconds | Time in seconds to wait after user is considered idle. Default is 300. |
-p | --pixels | Number of pixels the mouse should move. Default is 1. |
-c | --circular | If set, the mouse moves in a circle. Otherwise, it moves diagonally. |
-m | --mode | The action to execute. Options: keyboard, mouse, both (mouse & keyboard), or scroll. Default is mouse. |
-r | --random | Takes two integers (e.g., -r 3 10) to execute actions at a random interval between the start and stop seconds. Note: This overwrites the --seconds argument. |
# Example: Move mouse 10 pixels in a circle every 5 to 15 seconds
python src/keep-presence.py --mode mouse --pixels 10 --circular --random 5 15
# Example: Press the shift key every 120 seconds
python src/keep-presence.py --mode keyboard --seconds 120
# Example: Scroll the mouse wheel every 300 seconds
python src/keep-presence.py --mode scroll