most of the time I do an Alt+Tab (switch windows), go from browser (chrome) to Visual Code and vice versa, mouse scrolling misbehaves, it jumps to somewhere in the page, either way down the current scroll position, or way up, any thoughts on what's going on?
-
2bugs.chromium.org/p/chromium/issues/detail?id=807187 and bugs.chromium.org/p/chromium/issues/detail?id=608246 sadly not fixed at the time of this comment.– Ru HashaCommented Nov 13, 2018 at 9:15
-
Thank you @RuHasha for sharing that link, probably in the future I'll be reporting those bugs if I don't find solutions for.– KareemCommented Nov 13, 2018 at 18:06
6 Answers
Installing and running imwheel
fixes the problem for me.
$ sudo apt-get install imwheel
$ imwheel
INFO: imwheel started (pid=80085)
You have to start it at every boot (or add it at the applications to start).
pgrep -lf imwheel
to see if it's running ; you can stop it with pkill imwheel
.
/!\ It disables the zoom by Ctrl + wheel
in applications (Firefox, Chromium, LibreOffice, PDF reader...)
(Maybe a setting in imwheelrc could fix that)
-
4To add to startup, go to 'startup applications' from the menu, then add an item. Just use the command 'imwheel'. Commented Oct 7, 2019 at 1:15
-
3Just wanted to explicitly thank you for providing a solution to this problem which drove me mad for weeks now.– NiKoCommented Apr 16, 2020 at 10:01
-
2Thanks! Works for me, this bug was driving me mad too...! I would up-vote mutiple times if I could!– SeFCommented May 13, 2020 at 7:27
-
1
-
1I didn't have this bug on 20.04, but 22.04 introduced the bug.
imwheel
worked for me! Commented Sep 10, 2022 at 4:43
What you described is still an unsolved bug. When scrolling in one window, its scroll is buffered and repeated in another window after Alt+Tab
. As you exemplified, it happens between Chrome and VS Code.
Fortunately, there's a GNOME extension as a quick fix for that: Alt+Tab Scroll Workaround. Just activate it and it should solve the problem.
I developed this extension to, among other things, surpass the imwheel
's problem of scrolling "stepwise" while using a notebook touchpad.
-
1Thank you for making this plugin. github.com/microsoft/vscode/issues/… Commented Oct 10, 2023 at 17:11
-
2
-
2
-
1On PopOS, thank you so much for the Gnome plugin @lucasresck!! I was frustrated moving between chrome and my IDE, I have now reclaimed by inner peace 🐼– DineshKPCommented Nov 15 at 6:51
If you are asking for a solution, It's still an unsolved bug. But if you wonder why such a thing may happen, I think the reason is that scroll position is being unique for all windows, or it's being changed for all of them when you scroll. for example, if you scroll up in a window a little, then go to the other one and start scrolling, the bar jumps a little upper and starts moving from there, showing that scroll changes from the other tab are being applied to the new one too.
This is a bug in Chromium source code. See https://bugs.chromium.org/p/chromium/issues/detail?id=608246#c68 for steps to reproduce. There's a long discussion about this issue at https://github.com/microsoft/vscode/issues/28795 and the root cause is explained in an blog post https://who-t.blogspot.com/2012/06/xi-21-protocol-design-issues.html from year 2012 which explains that the first scroll event after switching windows should be ignored. GTK has this workaround implemented for all GTK apps, but Chromium uses custom implementation which is missing this workaround.
There has been comments that this doesn't happen with Wayland which makes sense because the design bug is in X11 XI protocol. And if you have NVIDIA GPU, then Wayland is not a good option because the NVIDIA drivers are often unstable on Wayland.
I solved this problem by logging in with configuration Ubuntu on Wayland instead of simply Ubuntu. Something like that. Image quality is low but you'll get the point.
That means I use Wayland instead of xorg but changing file /etc/gdm3/custom.config does not seem to solve the problem as stated here.
If you are not too attached to GNOME, switching to Unity solves the scroll issue on the mouse & trackpad:
sudo apt install ubuntu-unity-desktop
To restore the natural scrolling and other trackpad features, also install synaptics drivers:
sudo apt install xserver-xorg-input-synaptics