Evita inactividad moviendo el cursor cuando el usuario está ausente
Project description
kps
Keep moving the cursor if you are away to avoid inactivity.
Features
- Supports Windows, Linux and macOS.
- On Linux, supports both X11 and Wayland!
- Auto install dependencies via platform scripts and virtualenv.
- Supports Python 3+.
The program works in the background and waits only for inactivity to move the mouse.
Latest changes
Release v2.0.5 — PyPI kps-idle:
- Paquete PyPI renombrado a
kps-idle(pip install kps-idle; comandokps) release.sh: artefactos y URL PyPI segúnpyproject.toml; fallo explícito si twine error
Release v2.0.4 — Windows y CI:
- CI
test-windowsestable (linux_uinput_modules, rutas bundled conPath.resolve()) - Windows 10/11 validado manualmente (
kps.exe, idle, movimiento)
Release v2.0.2 — calidad de código:
- Docstrings en tests,
idle.pyygenerate_icons.py lint.sh: autopep8 + reparación de comentarios pylint; pylint 10/10- Tests uinput compatibles con CI Windows (
importlib)
Release v2.0.1 — parche AppImage:
- AppStream en AppImage (metadatos validados por
appimagetool) run-appimage: pregunta por instalarlibfuse2; fallback sin FUSE- CI: job
build-appimageen GitHub Actions (artefactokps-x86_64.AppImage)
Release v2.0.0 — dependencias mínimas, empaquetado e iconos:
- Linux: 6 paquetes apt (sin PyGObject ni
python-uinput); D-Bus víagdbus/busctl; uinput vía ctypes - Empaquetado:
dist/kps.exe(Win),dist/kps.app(macOS),dist/kps-*.AppImage(Linux);./run-appimage - Iconos: suite en
assets/icons/desdeimage_base.png/image_base.icns; bandeja--tray - Desinstalar:
./run --uninstallo./scripts/install.sh --uninstall - Movimiento in-process — sin subprocess; corrige fallos de import en Linux
- 211 tests (1 skipped), cobertura ~98%
Migración desde v1.7.x (Linux): ./run --uninstall -y (opcional) y luego ./run. Borra .venv antiguo si usaba --system-site-packages. Ver CHANGES.md.
Release v1.7.2 — parche CI y mypy; Wayland + GNOME validado (Ubuntu 26.04).
Release v1.7.0 — tray, systemd, teclado opcional, hotkey Unix, PyInstaller Windows.
See CHANGES.md for full release notes.
Compatibilidad
Versiones y entornos probados o esperados según el backend de inactividad y movimiento del ratón.
Python
| Versión | Estado |
|---|---|
| 3.10 – 3.12 | Compatible (objetivo principal; Ubuntu 24.04) |
| 3.8 – 3.9 | Probable; no verificado en CI |
| menor que 3.8 | No soportado |
Linux
Distros con script de instalación: Debian/Ubuntu (scripts/install.sh). Otras distros: instalar manualmente python3, libglib2.0-bin, libx11-6, libxss1, permisos uinput y pip install pynput.
Importante: kps no usa GTK ni PyGObject. En Linux, idle vía D-Bus (gdbus/busctl) y, en X11, XScreenSaver (libXss). Movimiento del ratón vía /dev/uinput (ctypes, sin python-uinput).
| Escritorio / entorno | Sesión típica | Detección idle | Movimiento ratón |
|---|---|---|---|
| GNOME (Ubuntu, Fedora…) | Wayland | D-Bus org.gnome.Mutter.IdleMonitor (o freedesktop) — probado Ubuntu 26.04 |
uinput |
| GNOME | X11 | D-Bus → fallback XScreenSaver | uinput |
| Ubuntu MATE, Xfce, LXQt, Cinnamon | X11 | XScreenSaver (libXss) |
uinput |
| KDE Plasma | X11 | D-Bus freedesktop o XScreenSaver | uinput |
| KDE Plasma | Wayland | D-Bus freedesktop (si el compositor lo expone) | uinput |
| i3, Openbox, WM mínimos | X11 | XScreenSaver | uinput |
Wayland sin D-Bus idle (p. ej. MATE experimental en Wayland, algunos compositores): el monitor puede quedar no disponible; usar sesión X11 o un DE que exponga idle por D-Bus.
Comprobar en tu máquina:
echo "$XDG_SESSION_TYPE" # x11 o wayland
./run -v # logs del backend idle elegido
Windows
| Versión | Detección idle | Movimiento |
|---|---|---|
| Windows 10 | GetLastInputInfo (WinAPI) |
pyautogui |
| Windows 11 | Idem | pyautogui |
Requisito: Python 3 en PATH (python).
macOS
| Versión | Detección idle | Movimiento |
|---|---|---|
| macOS 12+ (Monterey y posteriores) | Quartz CGEventSourceSecondsSinceLastEventType |
pyautogui |
Requisito: python3; permisos de Accesibilidad pueden ser necesarios para pyautogui (Ajustes → Privacidad).
Resumen por plataforma
| Plataforma | Probado / objetivo | Limitaciones conocidas |
|---|---|---|
| Ubuntu 22.04 / 24.04 / 26.04 + GNOME (Wayland) | Sí — idle Mutter D-Bus + uinput | Re-login tras install (grupo uinput) |
| Ubuntu MATE (GTK3, X11) | Sí — XScreenSaver + uinput (v1.4.1) | Wayland MATE no verificado |
| Windows 10/11 | Sí — idle WinAPI + pyautogui + kps.exe |
Hotkey F1–F12 solo en Windows |
| macOS 12+ | Implementado | Accesibilidad; prueba manual pendiente |
Quick start
Clone the repository:
git clone https://github.com/alanjmrt94/kps
cd kps
Linux (Debian/Ubuntu)
Instalar y ejecutar en un paso:
./run
Solo instalar:
./scripts/install.sh
Luego manualmente:
source .venv/bin/activate
python kps.py
Windows
Doble clic o en CMD/PowerShell:
run.bat
Solo instalar:
scripts\install.bat
macOS
./run-macos
Solo instalar:
./scripts/install-macos.sh
Manual usage
After installation:
python3 kps.py
Use -h to see available options. Examples:
python3 kps.py -t 10
python3 kps.py -p 3 -v
python3 kps.py -q
python3 kps.py -n -t 5 # dry-run: probar idle sin mover ratón
python3 kps.py -d --pid-file /tmp/kps.pid # segundo plano (Linux)
Config file
Copia config.example.toml a ~/.config/kps/config.toml (Linux) o %APPDATA%\kps\config.toml (Windows).
La CLI tiene prioridad sobre el archivo.
mkdir -p ~/.config/kps
cp config.example.toml ~/.config/kps/config.toml
Detener daemon en Linux:
kill -USR1 $(cat /tmp/kps.pid)
# o
kill -TERM $(cat /tmp/kps.pid)
Installation details
| Plataforma | Script install | Requirements pip | Lanzador |
|---|---|---|---|
| Linux | scripts/install.sh |
scripts/requirements.txt |
run |
| Windows | scripts/install.bat |
scripts/requirements-windows.txt |
run.bat |
| macOS | scripts/install-macos.sh |
scripts/requirements-macos.txt |
run-macos |
Linux system packages (mínimo)
install.sh instala solo si faltan (6 paquetes apt):
python3,python3-pip,python3-venvlibglib2.0-bin— cliente D-Bus (gdbus) para idle en Wayland/GNOMElibx11-6,libxss1— fallback XScreenSaver en sesión X11
Además configura /dev/uinput vía udev (scripts/udev-rules/40-uinput.rules). No se instalan PyGObject, build-essential ni paquetes -dev.
Empaquetado (usuario final, sin instalar Python)
| Plataforma | Build | Salida | Icono requerido |
|---|---|---|---|
| Windows | scripts\build_windows.bat |
dist\kps.exe |
assets/icons/kps.ico |
| macOS | bash scripts/build_macos.sh |
dist/kps.app |
assets/icons/kps.icns |
| Linux | ./scripts/build_appimage.sh |
dist/kps-*.AppImage |
assets/icons/linux/kps.png + hicolor/ |
Suite de iconos: coloca assets/image_base.png (y opcionalmente assets/image_base.icns) y ejecuta ./scripts/generate_icons.sh. Verificar con ./scripts/verify_icons.sh.
Desarrollo (con venv): ./run · AppImage (sin Python): ./run-appimage (ofrece instalar libfuse2 si falta)
Si ejecutas dist/kps-*.AppImage a mano y aparece libfuse.so.2, usa ./run-appimage o sudo apt install libfuse2.
Tras install.bat / install-macos.sh / install.sh, ejecuta el script de build de tu plataforma. En macOS puede hacer falta Accesibilidad para pyautogui. En Linux el AppImage aún requiere gdbus y permisos uinput en el host (ver abajo).
Python dependencies (pip)
Linux (scripts/requirements.txt):
pynput(+wheel,setuptools)- Idle D-Bus y uinput son módulos internos (
utils/dbus_idle.py,utils/uinput_device.py)
Windows (scripts/requirements-windows.txt):
pyautogui,pynput
macOS (scripts/requirements-macos.txt):
pyautogui,pynput,pyobjc-framework-Quartz
All Python packages are installed from PyPI into .venv at the project root (pip install kps-idle también disponible como paquete publicado; el comando sigue siendo kps).
Linux: permisos uinput (sin sudo)
kps mueve el cursor vía /dev/uinput. No se usa sudo en runtime.
-
Ejecuta
./scripts/install.sh(o./run). El script:- carga el módulo
uinputdel kernel - instala la regla udev en
/etc/udev/rules.d/40-uinput.rules - añade tu usuario al grupo
uinput
- carga el módulo
-
Cierra sesión y vuelve a entrar (o reinicia) para que el grupo surta efecto.
-
Verifica acceso:
ls -l /dev/uinput groupsDeberías ver el grupo
uinputy permisoscrw-rw----con grupouinput. -
Al arrancar,
kps.pycomprueba imports y abre uinput sin sudo. Si falla, muestra un mensaje con el paso siguiente.
Regla udev (scripts/udev-rules/40-uinput.rules):
SUBSYSTEM=="misc", KERNEL=="uinput", MODE="0660", GROUP="uinput"
Development
Instalar en modo editable con dependencias de desarrollo:
pip install -e ".[dev]"
Ejecutar tests y lint:
pytest # 214 tests; cobertura ≥ 95% en CI Linux
pylint kps.py utils/*.py tests/*.py
CI en GitHub corre los mismos checks en cada push/PR a main/master: lint, mypy, test-linux (3.10–3.12), test-windows y build-appimage (artefacto descargable).
Instalar como comando global (tras pip install .):
kps -h
Project layout (install/run)
kps/
├── run # Linux: install + run
├── run-appimage # Linux: ejecutar AppImage en dist/
├── run.bat # Windows: install + run
├── run-macos # macOS: install + run
├── kps.py # Main program
├── assets/
│ ├── image_base.png # Fuente iconos (PNG)
│ ├── image_base.icns # Fuente iconos (macOS, opcional)
│ └── icons/ # Suite generada (ICO, ICNS, hicolor, tray)
├── scripts/
│ ├── install.sh # Linux install / --uninstall
│ ├── install.bat # Windows install
│ ├── install-macos.sh # macOS install
│ ├── build_appimage.sh # Linux AppImage
│ ├── build_macos.sh # macOS .app
│ ├── build_windows.bat # Windows .exe
│ ├── kps.spec # PyInstaller Windows
│ ├── kps-macos.spec # PyInstaller macOS
│ ├── kps-linux.spec # PyInstaller Linux (AppImage)
│ ├── generate_icons.sh # Generar suite de iconos
│ ├── verify_icons.sh # Verificar iconos
│ ├── requirements*.txt
│ └── udev-rules/
│ └── 40-uinput.rules
└── utils/ # Core modules
Development plan
See .cursor/plans/kps_pending.plan.md for the current roadmap.
v2.0.5 — PyPI como kps-idle. v2.0.4 — Windows validado, CI test-windows OK. v2.0.2 — docstrings y lint. v2.0.1 — AppImage. Pendiente: prueba manual macOS.
Older releases
Release v1.1.6:
- Auto install dependencies depending on OS platform and py version
- Add version utilities
- Fix strings and typos
- Show kps version
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kps_idle-2.0.5.tar.gz.
File metadata
- Download URL: kps_idle-2.0.5.tar.gz
- Upload date:
- Size: 84.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9b2312229d19ec48e19b1a2ede4f1d9b6ae222fe56c453f55c683353c965ce
|
|
| MD5 |
0a437e7fb8d1b2c6bc65b565467d90d6
|
|
| BLAKE2b-256 |
4ddb3233daca43361686913f6e054b8b0a6a746ef926ded2239a9deace6a6db3
|
File details
Details for the file kps_idle-2.0.5-py3-none-any.whl.
File metadata
- Download URL: kps_idle-2.0.5-py3-none-any.whl
- Upload date:
- Size: 57.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16325d130e3f188107ed8ff0efe336add701438f80715d64f4728ee6382ef640
|
|
| MD5 |
6460bfbda2c1813f56adb6701d007699
|
|
| BLAKE2b-256 |
5a1e52536d25888d554420b300db95299c9b3599320a0c7d9708e12f2aca8809
|