A small Python tool that enables scrolling by holding the middle mouse button and moving the pointer. It runs on X11 sessions and uses xdotool to generate mouse wheel events.
- Auto-scrolling while the middle button is held
- Faster scrolling as the pointer moves farther from the center
- Smooth speed transitions for vertical scrolling
- Optional horizontal scrolling support
- Autostart install and removal support
- Python 3.10+ recommended
- X11 session
pynputPython packagexdotoolcommand
On Ubuntu / Debian-based systems:
sudo apt install xdotool python3-pip
pip install pynputRun the script directly:
python3 middle_scroll.pyOnce the program is running, hold the middle mouse button. Scroll speed increases as you move the pointer farther from the center. Releasing the button stops scrolling.
To start automatically when the user logs in:
python3 middle_scroll.py --install-autostartTo remove the autostart entry:
python3 middle_scroll.py --remove-autostartAll settings are controlled by constants in middle_scroll.py:
ENABLE_HORIZONTAL: Enables horizontal scrollingINVERT_VERTICAL: Reverses vertical directionINVERT_HORIZONTAL: Reverses horizontal directionDEADZONE_RADIUS: Dead zone around the centerMAX_VERTICAL_SPEED: Maximum vertical speedMAX_HORIZONTAL_SPEED: Maximum horizontal speed
- This tool does not work on Wayland.
- The autostart entry assumes the script is available at
~/.local/bin/middle_scroll.py. - The
.desktopfile is created at~/.config/autostart/middle_scroll.desktop.
Main application: middle_scroll.py