DEV Community

Dan Voyce
Dan Voyce

Posted on

Fixing Mouse Wheel on Chrome in Ubuntu 18.04 Virtualbox / VMWare

This has been driving me insane for at least a year now. Like many developers I run a Virtual Machine that holds my day to day development environment (For the rare days I get to actually code!).
One thing that has been a constant annoyance is going from the lovely smooth scrolling of Windows to a horrible messy, jagged, disjointed scrolling experience in Chrome and other apps under Ubuntu 18.04.

The problem (it turns out) was simple - libinput does not like trying to handle the mouse wheel at the same time as the mouse moving.

The solution seemed simple on the surface: Replace libinput with evdev and all should be solved.

Unfortunately Ubuntu 18.04 comes with its own Hardware Enablement layer, this replaces many of the standard components with version locked and layered versions that Canonical provide.

disclaimer: this worked on my system - you might break yours!

The first step is to remove this layer and instead install the standard versions of xorg:

sudo apt remove xserver-xorg-core-hwe-18.04 xserver-xorg-input-all-hwe-18.04 linux-generic-hwe-18.04 xserver-xorg-video-all-hwe-18.04

Now install the standard version of xorg and the evdev driver:

sudo apt install xserver-xorg-core xserver-xorg-input-evdev

Finally you need to edit the xorg config for libinput and change the driver to evdev:

sudo vi /usr/share/X11/xorg.conf.d/40-libinput.conf

and change the following line:

Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"

to:

Section "InputClass"
        Identifier "libinput pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"

This alone sorts out the "scrolling while moving" problem instantly resulting in a less jagged experience, however for some serious clout you might also want to install imwheel (https://wiki.archlinux.org/index.php/IMWheel is a good guide to getting it going)

My Config for this is:

None,      Up,   Button4, 2
None,      Down, Button5, 2
Control_L, Up,   Control_L|Button4
Control_L, Down, Control_L|Button5
Shift_L,   Up,   Shift_L|Button4
Shift_L,   Down, Shift_L|Button5

"^Navigator$"
None,      Up,   Button4, 2
None,      Down, Button5, 2
Control_L, Up,   Control_L|Button4
Control_L, Down, Control_L|Button5
Shift_L,   Up,   Shift_L|Button4
Shift_L,   Down, Shift_L|Button5

"^chromium$"
None,      Up,   Button4, 2
None,      Down, Button5, 2
Control_L, Up,   Control_L|Button4
Control_L, Down, Control_L|Button5
Shift_L,   Up,   Shift_L|Button4
Shift_L,   Down, Shift_L|Button5

".*gimp*"
Control_L, Up,   Control_L|Button4
Control_L, Down, Control_L|Button5
Shift_L,   Up,   Shift_L|Button4
Shift_L,   Down, Shift_L|Button5
Alt_L,     Up,   Alt_L|Button4
Alt_L,     Down, Alt_L|Button5
Control_L|Alt_L,     Up,   Control_L|Alt_L|Button4
Control_L|Alt_L,     Down, Control_L|Alt_L|Button5

".*nautilus*"
Control_L, Up,   Control_L|Button4
Control_L, Down, Control_L|Button5

I really hope this helps someone as this has been a massive annoyance for me.

Top comments (2)

Collapse
 
jamesattewell profile image
James Attewell

Thanks for this Dan, this has been annoying me so much and I have tried lots of other "solutions". I could put up with it in the browser but VSCode/VSCodium also had the issue and this is too much!

I just wanted to let you know that I used a much simpler solution to the one you posted above and it worked for me (I am using Linux Mint 19.3 but I presume this will work or all Ubuntu derived Linux flavours).

Instead of removing and installing the items you list, I simply installed xserver-xorg-input-evdev-hwe-18.04 with the following:-

sudo apt install xserver-xorg-input-evdev-hwe-18.04

and then made the edit you suggested to /usr/share/X11/xorg.conf.d/40-libinput.conf

Section "InputClass"
Identifier "libinput pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"

For other, newer versions of Ubuntu/Mint etc, I presume checking the HWE version with something like:-

sudo apt list --installed | grep hwe-

and then installing xserver-xorg-input-evdev-hwe- will work, fingers crossed!

Anyway, thanks again for posting this, I can now code without this major annoyance!

Collapse
 
osde8info profile image
Clive Da

havent noticed this yet since i mainly use FF but with try your fix as soon as i need it