I had recently upgraded to Ubuntu 18.04 and installed Unity back. After installing, I found that Reverse Scrolling/Natural Scrolling option was missing from Settings in Unity, while it was available in GNOME settings. This was pretty much a deal breaker for me, so I had to find a way to enable reverse scrolling via some GUI or even a CLI.
libinput is a library which is used to handle input devices in Ubuntu’s Display Server X.org. With further investigation, I found out that Unity, GNOME and XFCE and a host of Desktop environments support it. My hopes were high after discovering this. To enable Reverse Scrolling via libinput, follow the steps below.
FIND WHICH IS YOUR TOUCHPAD
You need to find which one among the input devices is your touchpad since libinput is used to handle input devices. This can be easily known by executing the command xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Elan Touchpad id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Asus Wireless Radio Control id=7 [slave keyboard (3)]
↳ Video Bus id=8 [slave keyboard (3)]
↳ Video Bus id=9 [slave keyboard (3)]
↳ Sleep Button id=10 [slave keyboard (3)]
↳ USB Camera: USB Camera id=11 [slave keyboard (3)]
↳ Asus WMI hotkeys id=13 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
Now obviously my touchpad cannot be a keyboard, so it has to be one among the Virtual Core Pointer. Elan Touchpad definitely sounded familiar to me, as I had installed its driver in Windows 10.
CHECK IF REVERSE SCROLLING CAN BE ENABLED OR NOT
The next step is to check whether your touchpad supports Reverse Scrolling or not. While I had an option to enable Reverse Scrolling from Settings when in Unity in Ubuntu 16.04, the option was gone in 18.04, but it was still available in GNOME. So I thought it should be available in libinput as well. To check if I can enable Reverse Scrolling in Unity in Ubuntu 18.04, I tried the command
xinput --list-props "Elan Touchpad"
(PS. Make sure that Elan Touchpad is inside the quotation marks if the name of your touchpad has spaces in between, and I shouldn’t be telling you to substitute Elan Touchpad with the name of your touchpad)
Device 'Elan Touchpad':
Device Enabled (145): 1
Coordinate Transformation Matrix (147): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Tapping Enabled (280): 0
libinput Tapping Enabled Default (281): 0
libinput Tapping Drag Enabled (282): 1
libinput Tapping Drag Enabled Default (283): 1
libinput Tapping Drag Lock Enabled (284): 0
libinput Tapping Drag Lock Enabled Default (285): 0
libinput Tapping Button Mapping Enabled (286): 1, 0
libinput Tapping Button Mapping Default (287): 1, 0
libinput Natural Scrolling Enabled (288): 0
libinput Natural Scrolling Enabled Default (289): 0
libinput Disable While Typing Enabled (290): 1
libinput Disable While Typing Enabled Default (291): 1
libinput Scroll Methods Available (292): 1, 1, 0
libinput Scroll Method Enabled (293): 1, 0, 0
libinput Scroll Method Enabled Default (294): 1, 0, 0
libinput Click Methods Available (295): 1, 1
libinput Click Method Enabled (296): 1, 0
libinput Click Method Enabled Default (297): 1, 0
libinput Middle Emulation Enabled (298): 0
libinput Middle Emulation Enabled Default (299): 0
libinput Accel Speed (300): 0.000000
libinput Accel Speed Default (301): 0.000000
libinput Left Handed Enabled (302): 0
libinput Left Handed Enabled Default (303): 0
libinput Send Events Modes Available (265): 1, 1
libinput Send Events Mode Enabled (266): 0, 0
libinput Send Events Mode Enabled Default (267): 0, 0
Device Node (268): "/dev/input/event8"
Device Product ID (269): 1267, 5
libinput Drag Lock Buttons (304): <no items>
libinput Horizontal Scroll Enabled (305): 1
You should look for an option that has Reverse Scrolling, or Natural Scrolling in it. Luckily I did have an option called libinput Natural Scrolling Enabled (288): 0. So I was sure that I can enable it in Ubuntu 18.04. Now it was only a matter of another command, after which I can use Reverse Scrolling without hassles.
PS. If you do not see an option like Reverse Scrolling anywhere inside that output, I’m afraid my friend, I cannot help you.
ENABLE NATURAL SCROLLING
xinput --set-prop "Elan Touchpad" "libinput Natural Scrolling Enabled" 1
This was enough to enable Reverse Scrolling. Plus it happened in an instant, I never had to log out or restart at all.
PS. If the command with the list-props flag output shows something like ‘Synaptics’ at the beginning of each prop instead of ‘libinput’, please check the update below.
Using libinput I could bring back one feature I loved the most. But the behavior I get with the touchpad in Unity in Ubuntu 16.04 and 18.04 is completely different. There are three pain points with the new experience in Ubuntu 18.04:
- I could select text by tapping on the touchpad, and not clicking it.
- You could keep selecting the text and scroll up or down with the touchpad
- I could tap using two fingers to emulate right click
Sadly I can’t do either of these things with Ubuntu 18.04. While I can still do point no. 1 and 3 using GNOME, I can’t do point 2 with that either. So I still have hopes of getting points 1 and 3 back on track with libinput again, but I’ll pray that one day I’m able to get back point 2 as well.
With libinput, I ran the following command xinput --set-prop "Elan Touchpad" "libinput Tapping Enabled" 1, and I was able to get point 1 and 3 working fine. Point 2 was still not working.
I asked my friends who had a similar laptop model, to run the command and then they got synaptics props instead of libinput. I realized that Ubuntu 18.04 did not come with synaptics, rather it came with libinput. Now I installed synaptics using sudo apt install xserver-xorg-input-synaptics after which I restarted my laptop.
I was able to get the same Mouse experiences present in Ubuntu 16.04 to Unity in Ubuntu 18.04 without hassles. Moreover, the fine details of touchpad settings like Reverse Scrolling are now back in Touchpad settings in Ubuntu 18.04.