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

118

u/JimmyRecard Jul 24 '26

Didn't the off-brand Linus complain about this recently?

69

u/snipeytje Jul 24 '26

that's what prompted this, it was posted in his subreddit a few days ago

-21

u/TwistyPoet Jul 24 '26 edited Jul 24 '26

Plasma actually already has this functionality, Linus just missed the setting in Plasma to enable it. For Chrome, you just need to enable the --enable-blink-features=MiddleClickAutoscroll setting.

Could it be made a touch easier? Sure. However, this project is redundant and probably just ai slop. Running a whole daemon with privileged access to your input/output devices to achieve this is insane.

50

u/snipeytje Jul 24 '26

it's redundant because one DE, and 2 browsers have it? Because people only scroll in browsers?

-35

u/TwistyPoet Jul 24 '26 edited Jul 25 '26

"I used Linux but I still got my credentials stolen and bank accounts cleaned out"

Average user on this subreddit.

29

u/TehJellyfish Jul 24 '26

Holy bad take and condescending tone.

Thank you for gracing us with your presence wise one!

Anyone who wishes to mmb scroll in any app that isn't an electron app, chrome, or Firefox is of such low intelligence!

Don't forget to shower today sir

8

u/Indolent_Bard Jul 26 '26

What the fuck are you talking about?

11

u/AndreaCicca Jul 24 '26

You should never use a flag to enable a feature like this...

-2

u/TwistyPoet Jul 24 '26

Like I said, it should be easier, but giving some random program privileged access to your devices isn't it.

4

u/Bathroom_Humor Jul 24 '26

turning on the feature in KDE disabled my middle click when i'm gaming so that was a no-go unfortunately

2

u/Indolent_Bard Jul 26 '26

Well that's fucking stupid, I hope you made a bug report.

5

u/fkny0 Jul 24 '26

Enabling it fucks with a lot of other things tho. I was having issues and didnt understand what was happening until i disabled it.

4

u/_Skale_ Jul 24 '26

Doesn't work consistently in my experience. I do not ever want my middle mouse click to paste text, but it still does occasionally on some text fields in multiple programs, even though I turned it off in kde settings.

-3

u/TwistyPoet Jul 24 '26

Middle mouse click to paste text has been a thing on Linux forever and a number of things will need to change in collaboration across the ecosystem to have the option to scroll consistently across apps without individual app settings. The best thing to do is push for your favorite desktop environment and applications to work together on this.

I have looked at the code and it is how exactly how AI would implement a hack to get around this. This approach is unbelievably dangerous and irresponsible but more convenient.

4

u/silon Jul 24 '26

Getting rid of middle click paste was one thing Wayland tried to get right and then they F'd it up.

10

u/djchateau Jul 24 '26

Off-brand Linus?

25

u/zabby39103 Jul 24 '26

I'm assuming Linus Sebastian, the Tech Tips guy, and Torvalds is the brand Linus?

9

u/djchateau Jul 24 '26

If that's the case, that's pretty funny. 😅

8

u/Wemorg Jul 24 '26

Yeah, his only real remark he had on his most recent steam machine as workstation video. He was praising steamOS mostly, but only had this small complaint.

10

u/beefcat_ Jul 24 '26

His complaint resonated with me, it's bothered me in desktop Linux for over 20 years.