Skip to content

htr2b/linux-middle-click-autoscroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Linux Middle Click Autoscroll

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.

Features

  • 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

Requirements

  • Python 3.10+ recommended
  • X11 session
  • pynput Python package
  • xdotool command

On Ubuntu / Debian-based systems:

sudo apt install xdotool python3-pip
pip install pynput

Usage

Run the script directly:

python3 middle_scroll.py

Once 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.

Autostart

To start automatically when the user logs in:

python3 middle_scroll.py --install-autostart

To remove the autostart entry:

python3 middle_scroll.py --remove-autostart

Configuration

All settings are controlled by constants in middle_scroll.py:

  • ENABLE_HORIZONTAL: Enables horizontal scrolling
  • INVERT_VERTICAL: Reverses vertical direction
  • INVERT_HORIZONTAL: Reverses horizontal direction
  • DEADZONE_RADIUS: Dead zone around the center
  • MAX_VERTICAL_SPEED: Maximum vertical speed
  • MAX_HORIZONTAL_SPEED: Maximum horizontal speed

Notes

  • This tool does not work on Wayland.
  • The autostart entry assumes the script is available at ~/.local/bin/middle_scroll.py.
  • The .desktop file is created at ~/.config/autostart/middle_scroll.desktop.

File

Main application: middle_scroll.py

About

This project is a small Python utility for Linux that adds middle-click autoscroll on X11. When you hold the middle mouse button and move the pointer away from the anchor point, it generates scroll-wheel events with speed based on distance, with smoothing to make the motion feel natural.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages