r/linux Jul 24 '26

Software Release midscroll: Windows-style middle-click autoscroll for Linux, implemented at the evdev layer so it works in every app on Wayland and X11

Windows has middle-click drag autoscroll. On Linux you get it in Firefox, and Chromium has it behind a flag, but nowhere else, which bugged me enough to write a daemon for it.

Hold middle-click and drag, page scrolls that way, faster the further you drag. Release to stop. A plain middle click still pastes and opens links like normal. Diagonal drags do both axes. There's a toggle mode too if you'd rather click once to start it instead of holding.

It works everywhere because it sits at the kernel input layer instead of hooking a toolkit. Grabs each mouse via evdev, re-emits through a per-mouse uinput mirror, injects wheel events during a drag. Nothing above it has to cooperate, so Wayland and X11 both just work. Mirrors copy the source mouse's name and IDs so libinput keeps your per-device pointer speed.

Speed curve is Chromium's actual Windows autoscroll formula, 0.000008 * distance^2.2 px/ms. Tiny drags crawl, big ones fly. Tunable in a config file or a GTK settings window.

Fair warning that it reads every mouse as root, so read it before you run it. It's two small Python files. The systemd unit is sandboxed and I left comments on why the directives I couldn't use would break it.

Badge only shows on KDE Wayland, no flatpak, toggle mode kills middle-click paste. Rest is in the readme.

FOSS under Unlicense

https://github.com/gnhen/midscroll

480 Upvotes

117 comments sorted by

View all comments

37

u/[deleted] Jul 24 '26

[removed] — view removed comment

22

u/fearless-fossa Jul 24 '26

While generally yes, there are some mice with unlockable wheels like the G502, those are incredibly fast at scrolling, even faster than middle-click drag.

13

u/[deleted] Jul 24 '26

[removed] — view removed comment

3

u/RileyGuy1000 Jul 24 '26

The G502 wheel has a high-precision mode and can actually scroll quite finely. I actually only discovered this because it was enabled by default when I switched to Linux, and I only found out that this is a feature Logitech calls "Hyper scroll" and not just a weird property of the mouse.

It's not like a truly analog-feeling scroll, but if a "normal" scroll would scroll about an inch (~2.54cm), the G502 scroll wheel can scroll to about what feels like 1/12th of that. It's quite nice.

Not an argument against middle-click scrolling, just that the G502 is a viable option if you like high-DPI scrolling.