We have all been there, tired and of switching over to the mouse for just a small click. I feel that pain, that is why I made KeyCursor - for those who hate mouse!
Control your mouse with your keyboard. Built for Linux (Wayland + X11) using evdev and ydotool.
- Python 3.10+
ydotooldrunning (sudo systemctl start ydotool)- User in
inputgroup or run withsudo gtk-layer-shellinstalled (pkg-config --exists gtk-layer-shell-0 && echo yes)
python3 -m venv venv --system-site-packages
source venv/bin/activate
pip install evdev pygobject
--system-site-packagesis required so the venv can accessgi(GTK bindings) which are system-level packages.
venv/bin/python3 python/main.py| Key | Action |
|---|---|
CapsLock |
Toggle mouse mode on/off |
Ctrl + CapsLock |
Toggle passthrough mode (script disabled) |
WASD |
Move cursor |
Enter |
Left click (hold to drag) |
Backspace |
Right click |
\ |
Middle click |
PageUp / PageDown |
Scroll up / down (hold for continuous) |
Q |
Toggle precision mode (speed 2 with acceleration) |
TAB |
Toggle acceleration |
1–9, 0 |
Set speed (2–50) |
A thin bar at the top of the screen shows the current mode:
| Color | Mode |
|---|---|
| ⬜ White | Mouse mode ON, acceleration ON |
| 🔵 Blue | Mouse mode ON, acceleration OFF |
| 🟢 Green | Precision mode |
| 🔴 Red blink | Passthrough mode reminder (CapsLock pressed while disabled) |
| (no bar) | Mouse mode OFF / passthrough mode |
Press Ctrl + CapsLock to fully disable the script — all keys pass through untouched as if the script wasn't running. Press Ctrl + CapsLock again to re-enable.
While in passthrough mode, pressing CapsLock alone will blink the red bar 6 times as a reminder that the script is disabled. CapsLock itself is blocked (won't toggle caps).
Settings are auto-saved to assets/settings.json and restored on next launch:
base_speed— last used speedacceleration_enabled— acceleration on/offpassthrough_mode— whether passthrough was active when the script exited
- Any non-mouse key exits mouse mode automatically
- All modifier combos exit (Ctrl+C, Alt+Tab, etc.)
- Exception: Ctrl / Shift / Alt + Click or RightClick (modifier clicks are passed through)
The script automatically handles:
- Hot-plugging keyboards (USB connect/disconnect)
- Keyboard wake from sleep
- Multiple keyboards simultaneously
- CapsLock LED blinking as mode indicator (kernel grab/ungrab limitations make this tricky)
- No installation / uninstallation script (coming soon)
- No startup script / service (coming soon)
If you Liked this repo please consider giving it a star!
MIT