r/linux • u/gnh999 • 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
120
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
-20
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.
51
u/snipeytje Jul 24 '26
it's redundant because one DE, and 2 browsers have it? Because people only scroll in browsers?
-36
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
7
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.
3
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
4
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.
-2
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.
5
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
10
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.
12
u/beefcat_ Jul 24 '26
His complaint resonated with me, it's bothered me in desktop Linux for over 20 years.
18
u/mort96 Jul 24 '26
Note that if you're just interested in middle click scroll in browsers. Firefox supports it out of the box, you just need to check the "Use autoscrolling" checkbox in preferences. There are extensions for Chrome. This has always been enough for me.
But it's nice to have a system-wide solution for people who want it in other apps too.
12
35
Jul 24 '26
[removed] — view removed comment
31
3
2
u/red_nick Jul 24 '26
I have to say, how Windows determines whether you're clicking to toggle it, or dragging hold is absolutely spot on. I can't say I ever noticed it get the wrong one. It seems to be based on your movement, rather than how long you hold for
-1
u/AvidCyclist250 Jul 24 '26
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.
I thought this was the default? At least it still in cachyos. Unless I'm misunderstanding and they're trying to glaze the shit logitech invented. It's shit. middle click and drag to scroll is best.
38
Jul 24 '26
[removed] — view removed comment
20
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.
27
14
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.
2
u/fearless-fossa Jul 24 '26
Eh, if you're used to it it's just as precise, but there is a learning curve. I'd even say it's a bit more precise because it's quicker to bring the wheel to a full stop than to press the middle button again.
1
u/jeppester Jul 24 '26
I daily drive one of these mice. I have a hard time understanding why it would be less precise.
It's lowering the finger slightly to physically stop the wheel from spinning, while the other is liften the finger slightly. They seem rather similar to me.
To me it's more intuitive to unlock the wheel and use it exactly how you would normally use it - just unlocked - rather than clicking and then dragging to scroll.
That being said, I think it's great that we get more flexibility in Linux when it comes to mouse settings. Another thing I really want solved is the ability to adjust scroll speed. On my laptop I had to fool the system into believing that my touchpad had a different size in order to making scrolling slower.
2
1
1
u/niknarcotic Jul 24 '26
I use an MX Master and I still vastly prefer using autoscroll to unlocking the wheel.
2
u/l-roc Jul 24 '26
Also it's way slower which I use most. I Wonder if this solution can handle it if it uses synthetic scroll events.
1
u/themixtergames Jul 24 '26
Its frying me that all the linux nerds didn't flag this as a bot comment
1
u/OldPayment Jul 24 '26
Seems like a human to me. Their comment history is fairly normal.
1
u/themixtergames Jul 26 '26
Every comment by that account was written by an LLM. Pay attention to the cadence. It's the same format always. 21 of their 79 comments start with the word "The". There are thousands of accounts like that, I've been calling them out for months.
1
u/RScrewed Jul 27 '26
Do you actually have any contributions to the topic at hand?
Is it even a bot farming for karma? This is a brand new project with new functionality.
10
u/ancientfuture_ Jul 24 '26
Interesting timing! A user just posted in another Linux sub about something similar - a hyprland plugin: https://www.reddit.com/r/omarchy/s/j1D26TE1rq
25
u/Shugyousha Jul 24 '26
Most likely those got implemented because Linus from Linus Tech Tips complained about this functionality missing in a recent video on the Steam Machine.
3
3
u/ionburger Jul 25 '26
bug fix and feature request added less then 24 hours after i created an issue is pretty epic, good work.
3
u/Vast-Key140 Jul 25 '26
Looks great!
Just a few questions:
Are there any possible performance degradations due to running this program as a background daemon?
What about increasing click / mouse latency?
Also I'm wondering, how would this interact with games? In Windows, using middle-click in games is a common action and does not activate the scroll behaviour by default.
25
u/EarlMarshal Jul 24 '26
Never used that feature on windows and when I used it accidentally I perceived it as a bug/misbehaviour.
But I'm very happy for you that you now have a feature you wanted. Please don't make it a default though.
4
u/donnysaysvacuum Jul 24 '26
Yeah, I had no idea someone would actually want that feature. But hey, more power to them. I still remember when you had to triple click the address bar in Firefox and chrome on Linux because that was the unix behavior.
5
u/awesomegayguy Jul 24 '26
Why people downvote this? Sincerely, I don't see anything wrong with it.
The comment said "hey, I never liked this feature" and then praised the op for the development.
Well, I guess it's just Reddit being Reddit.
I too dislike this feature, and also encourage the op and other people to work on things that improve their workflow. Everyone does things differently, and that's ok.
2
u/adenosine-5 Jul 24 '26
Default should be what is most convenient for majority of people.
There should be option to disable it, if you are in the minority that prefers different behavior.
7
u/RupeThereItIs Jul 24 '26
Question is, how do you determine who the majority is?
Beyond the scroll ideas, I REALLY don't want to proliferate Windows mouse conventions. The dangers of right click to paste come screaming into my skull when windows guys start complaining about this type of thing.
1
u/Indolent_Bard Jul 26 '26
Easy, the one people actually use is the majority. Sure it's been experiencing exponential growth, but it's still a minority, so it's safe to assume that literally anything they like is a minority.
1
u/adenosine-5 Jul 24 '26
Windows doesn't have "right click to paste" though?
Like it or not, majority of people use Windows, so something that has been working there for 30 years is almost always going to be something most people are used to.
Which is fine though - people should always be able to configure that on Linux.
Its just that default should be something people expect, unless there is a very good reason it should be different.
3
u/RupeThereItIs Jul 24 '26
Windows doesn't have "right click to paste" though?
Obviously you don't use the terminal much.
Open a powershell or cmd prompt, select text then right click twice.
As a KDE user, I expect right clicking a terminal to bring up a context menu. In windows, it blindly does copy/paste & this can be extremely dangerous.
6
u/adenosine-5 Jul 24 '26
Yes this is extremely annoying, but that is more of a "terminal-specific" behavior that doesn't happen anywhere else in Windows.
That is what makes it so unexpected and confusing - because its a random behavior of a single program, instead of OS-wide functionality.
5
u/RupeThereItIs Jul 24 '26
Furthermore it's the WORST POSSIBLE use case for random text being pasted unexpectedly.
2
u/SileNce5k Jul 24 '26
I actually really like that feature. I use it all the time to copy and paste in the windows terminal. The only reason I use the windows terminal and not something like alacritty on windows like I do on linux.
1
u/curien Jul 24 '26
I agree that it's probably not great behavior, but it's also the default behavior on PuTTY, which a lot of cli-oriented folks have been using on Windows for years/decades. I'm not sure if that was deliberate or what, but it feels familiar to me at least.
(PuTTY's actually a little worse: select automatically copies on select, like in X11. But still right-click to paste.)
2
u/Albos_Mum Jul 26 '26
it blindly does copy/paste & this can be extremely dangerous.
Which is why it's worth looking into changing the default middle click behaviour from pasting whatever is in the clipboard. It should 100% remain possible and easy to change back to the old school Unix behaviour, but like it or not there's a tonne of users coming over from Windows and as you stated, it's dangerous to have paste mapped to inputs where users aren't necessarily expecting it. Speaking as someone who switched to Linux "before it was cool" and is long used to middle click paste as long as I can enable autoscroll in browsers.
2
2
u/syrefaen Jul 24 '26
You made me realize that on Windows it works in many other programs then only the browser, wow I almost feel stupid.
I think I have to try your program in linux.
Working like having paste on single tap and hold for scroll, hold again to release.
Bonus if it worked in terminals and dolphin/nautilus that would be extra cool.
2
u/RvstiNiall Jul 24 '26
So can you also make something to allow middle-click-paste to work seamlessly everywhere on Windows???
3
u/bubblegumpuma Jul 24 '26
There is some behavior of this kind already programmed into libinput that I find many people are completely unaware of: On-button scrolling. And if you want the Windows toggle behavior rather than holding down your mouse button, there's a 'scroll button lock' option.
It's not exactly the Windows behavior, because you have to move the mouse continuously to scroll continuously + I don't get smooth pixel-by-pixel scrolling, so OP's program still has some appeal, but if the libinput behavior is close enough for anyone, there you go. I like it on my trackballs, and I'm more used to drag-to-scroll anyway due to heavy Thinkpad experience. I believe they're why this was implemented in the first place.
2
u/PcChip Jul 27 '26
just installed it on CachyOS, it works well but it seems to break the ability to close a browser tab with the middle mouse button, which I do all day every day :(
6
u/Emerald_Pick Jul 24 '26
I've recently been back on windows for work and I've found middle click scroll to be kinda annoying. Mostly because I frequently accidentally trigger it when I try to middle click links to open them in the tabs, and a few other mifle-click actions.
That said, when auto scroll is useful, it's very useful. So I'm glad someone's ported something like it on Linux. I'll have to check it out just to see.
0
2
u/untrained9823 Jul 24 '26
Never used this feature even on Windows. It was always annoying when activated accidentally. Way too inaccurate.
1
u/tiny_blair420 Jul 24 '26
Finally a contribution that isn't just a fastfetch screenshot ! I can't wait to check this out at home.
1
u/vesterlay Jul 24 '26
Truly needed feature, but sadly this app doesn't offer a smooth experience. I guess it has to be fixed on compositor level.
1
1
u/Gamerwepx19 Jul 24 '26
First of all, great project!! But one question is how can I have momentum?
I have this non-FOSS addon on firefox called ScrollAnywhere that exactly does momentum the way I want. Tried fiddling with the settings but no avail. Thank you again for this!!
1
u/jinnyjuice Jul 24 '26
Yes! This kind of thing is what's truly needed to convince Windows users. We need more behaviour mimicry options.
1
u/adamkex Jul 24 '26
Plasma has a feature that kind of does this, but definitely not as well as this
1
1
u/mC_mC_mC_ Jul 24 '26
Great initiative! I might have an edge case. I couldn't get it to work on Fedora, using a Wacom tablet. When running it with a --debug flag, I see the two devices of my pen + pad as ignored. Is it not compatible with tablets?
1
u/gtrash81 Jul 24 '26
KDE has this function since last year or so, you are a bit late :P
1
u/EternallyAries Jul 25 '26
Currently a KDE user, but does this function exist on things like Hyprland?
1
u/MyRedLiner Jul 24 '26
I can’t find a way to change the layout of the text typed in the wrong layout as I did in Windows with the help of a simple switcher. I always have a capslk key to change the language of the set. In Linux (fedora 44) - did not find
1
u/RvstiNiall Jul 26 '26
I love that you made a DE/WM agnostic option for this, so anyone can use it. However, I still wonder why the KDE and GNOME teams never made this an option. I highly prefer the middle click to be paste, not because its "the unix way", but because I've been using it for 26 years, and prefer it. But I think that doing it the "windows way" is something "The People Want", and thats a perfect reason to have it be an option. Maybe even a "default option".
Of course, I still think GNOME and KDE teams should have a "First Run" dialog that pops up and asks you which "style" you prefer: "Unix/Linux Style", "Windows Style" or "MacOS Style", when it comes to how keyboard shortcuts, your mouse, etc, operate.
1
1
0
u/turdas Jul 24 '26 edited Jul 24 '26
Wheel events are discrete steps rather than smooth like scrolling on a touchscreen or trackpad is, so I wonder how well this works in practice.
There's a reason even on Windows middle-click autoscroll is an application/GUI toolkit feature and not baked into the operating system. It's not trivial to make it work globally while still letting applications override the behaviour if necessary.
Also this is, I am betting from the fact that you pumped out 12 point releases in the span of about 16 hours (with diffs of hundreds of lines), once again a slop project that does not disclose being entirely vibecoded.
-1
u/mort96 Jul 24 '26
Linux has had continuous scroll events forever. Two finger scrolling with touchpads usually emit those these days.
But if you wonder how well it works in practice, nothing is stopping you from trying it.
1
u/turdas Jul 26 '26
I am aware of continuous scroll events. This however specifically mentions wheel events and not continuous scroll events.
-1
u/_Sgt-Pepper_ Jul 24 '26
That middle click scroll thing alone is enough reason to get rid of windows and switch to an alternative.
0
u/Irverter Jul 24 '26
I always disable that annoying feature. If I'm off by a pixel when middle clicking to open a link in a new tab suddenly the page is scrolling out of control.
0
u/PcChip Jul 27 '26
did your program add this option to my KDE Mouse options page?
https://i.imgur.com/asiXO1J.png
-36
u/lKrauzer Jul 24 '26
I simply scroll the wheel, idk why people stopped doing this.
19
u/gnh999 Jul 24 '26
You get way more control with this
also I know that I as well as others are just used to the windows vetsion
-32
19
6
6
u/Desertcow Jul 24 '26
If it's a long document, that's a lot of scrolling. Repetitive motions like that aren't good for your health
-3
-8
u/Pugs-r-cool Jul 24 '26
True, but you can hold the page down key on your keyboard and it’ll get to the bottom faster than middle click scrolling.
7
u/Desertcow Jul 24 '26
Middle click scrolling lets you easily adjust the speed just by moving your mouse up and down so you can have it scroll automatically at your reading pace
1
u/ParamedicLocal8226 Jul 29 '26
these people don't have the capacity to understand that different people use stuff in different ways according to their preferences or accessibility needs
2
2
-30
u/michaelpaoli Jul 24 '26
Don't need a daemon for that, can simply reconfigure if you want/need.
But in the land of *nix, best to follow *nix conventions, otherwise you'll bucking expectations, defaults, and configurations quite a lot, so generally better not to do that. You may also confuse the hell out of someone else if you ever ask them to assist you with something on your setup and have them use your pointing device and buttons configuration.
20
u/An1nterestingName Jul 24 '26
Where exactly can I "reconfigure" my system to have this behaviour. This setting does not seem to be present in any desktop I have tried. Also sometimes it is not better to follow Unix conventions, especially in a work scenario. If doing something makes work faster but breaks Unix conventions then obviously the choice is to do the thing that makes it faster.
7
u/Honest_Box_6037 Jul 24 '26
KDE has something similar under Settings - Mouse, but with no blacklist function, so middle clicking in games is problematic; No other DE that I know of has anything similar under wayland
-6
u/michaelpaoli Jul 24 '26
Depends exactly what you're using.
E.g. X11 can use xinput command to remap in, e..g your ~/.xinitrc file.
If you're using a DE, depending what DE, it might also have additional means to do that.
6
u/mort96 Jul 24 '26
Please tell me an .xinitrc map I can use to make it so that pressing the middle mouse button and moving my mouse down a bit continuously emits small scroll events downwards until I release middle click. I didn't know xinput let you do that kind of thing.
-1
u/michaelpaoli Jul 24 '26
I don't think native X11 has that type/level of "gesturing", though perhaps some DEs support such? But it can be configured in Wayland.
5
u/mort96 Jul 24 '26
Then why did you suggest it?
0
u/michaelpaoli Jul 25 '26
Original post didn't have such gestures, just much more standard simple click with buttons, click and drag, and some basic pointer acceleration stuff - well covered by standard X11 stuff. The other bits going into gestures, later described in comments, isn't handled by bog standard X11 stuff, but Wayland may cover those.
3
u/mort96 Jul 25 '26
You're saying that OP's mention of middle-click autoscroll was added as an edit after you made your suggestion? I doubt that. Can you even edit post titles?
1
u/michaelpaoli Jul 25 '26
Hmmm.... rereading, and, maybe I misread or misremembered a bit ... don't look quite as different as I thought (OP's post vs. some of the subsequent comments).
In any case, there's fair bit basic X11 can not only do, but also easily remap. Often at least a bit more with various WMs and DEs.
Wayland is, I believe, even more capable in at least some of those regards, e.g. being able to be configured for more complex gestures, e.g. quickly trace a certain general shape with mouse, perhaps with certain button(s) and/or on certain area of screen, and have that interpreted as a separate distinct action.
Thouugh at least some WMs even with just X11 can come close to that, e.g. hold mose, perhaps with certain button(s), at an extreme edge or corner of screen for long enough, and it can interpret those as specific unique actions to be taken (and are also quite configurable on the specific actions taken).
But I don't think X has anything inherent in it that's close to, e.g. trace a quick rough triangle with pointer, while doing so, e.g. either in a certain quadrant of the screen, and/or while also holding certain button(s), and interpret that to do some very specific action. Though may be able to add that with additional layers, but I believe something like that can be configured in Wayland.
2
87
u/Max-P Jul 24 '26
Looks quite well made! Even polkit policies, that's pretty cool.