natural scrolling on Unity desktop 20.04

image

I just installed Unity coming from Gnome and I don't see natural scrolling option there. What do I need to install on Ubuntu 20.04 LTS?


Solution 1:

Okay, I found the solution that works on 18.04 which also has the same problem. Dconf and gnome settings have no effect.


First, run the following command to list your devices:

xinput list

You should see something similar to this example:

⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ Lite-On Technology Corp. USB Keyboard Consumer Control    id=13   [slave  pointer  (2)]
⎜   ↳ Logitech Wireless Mouse                   id=10   [slave  pointer  (2)]

As we can see, the device is Logitech Wireless Mouse and the device is listed as id=10.


Next, run the following command to list the available parameters:

xinput list-props 10

We use 10 here because the device id=10.

Here is an example of the output:

Device 'Logitech Wireless Mouse':
    Device Enabled (131):   1
    Coordinate Transformation Matrix (133): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Natural Scrolling Enabled (266):   0
    libinput Natural Scrolling Enabled Default (267):   0
    libinput Scroll Methods Available (268):    0, 0, 1
    libinput Scroll Method Enabled (269):   0, 0, 0
    libinput Scroll Method Enabled Default (270):   0, 0, 0
    libinput Button Scrolling Button (271): 2

As we can see, Natural Scrolling is listed as parameter 266 and the value is currently 0 (zero).


Finally, run the following command to enable Natural Scrolling by changing the value from 0 to 1:

xinput set-prop 10 266 1

This example command changes device 10, parameter 266, to the value of 1.

You may need to add this command as a startup application if the changes don't survive a reboot.