3

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?

mchid
  • 43,546
  • 8
  • 97
  • 150
mLstudent33
  • 739
  • 1
  • 11
  • 33
  • 1
    Have you tried opening the gnome settings manager from the Unity desktop? Often times, you can use either/or on Unity. – mchid Dec 25 '21 at 10:14
  • @mchid I never would have thought to look but it was there. However, even when I try different combinations of natural scrolling under Mouse and Touchpad, I don't get natural scrolling. – mLstudent33 Dec 25 '21 at 19:15
  • To go back to the gnome, simply run: sudo apt install ubuntu-desktop If you want all the applications also, then run sudo apt install ubuntu-desktop^ – Error404 Dec 26 '21 at 03:43
  • I found an answer to your original question. Feel free to revert my edits to your question but it really would be better to ask a new question if you still feel you want to switch back to Gnome. Answer is below. – mchid Dec 26 '21 at 09:36
  • However, on the login screen, you must select the Gnome or Ubuntu desktop from the list or from the gear icon menu. You should have a choice between Unity, Ubuntu Desktop, and/or Gnome et al. – mchid Dec 26 '21 at 09:38
  • @mchid, thanks for both answers. This comment made me notice the gear icon in the bottom right which I clicked and saw Gnome, Gnome on Xorg, Ubuntu, Ubuntu Wayland, Unity. – mLstudent33 Dec 27 '21 at 04:47

1 Answers1

4

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.

mchid
  • 43,546
  • 8
  • 97
  • 150
  • 1
    The example in this answer is for a mouse but the method is the same for a touchpad: identify the touchpad device id, then the parameter number, and then set the value to 1. – mchid Dec 26 '21 at 09:44
  • 1
    X Error of failed request: BadAccess (attempt to access private resource denied) Major opcode of failed request: 131 (XInputExtension) Minor opcode of failed request: 57 () Serial number of failed request: 20 Current serial number in output stream: 21 – mLstudent33 Dec 27 '21 at 00:43
  • 1
    @mLstudent33 It looks like 316 is "Natural Scrolling Enabled Default" or the default parameter (for all users). Try using xinput set-prop 12 315 1 instead. – mchid Dec 27 '21 at 04:52
  • 1
    @mLstudent33 Since the "default" parameter is for all users, your user doesn't have permission to change the value of 316. – mchid Dec 27 '21 at 04:56
  • I'll try it but went back to gnome for the time being @mchid. Thanks for following up. – mLstudent33 Dec 28 '21 at 08:35
  • Could this answer be extended to include the "add this command as a startup application" since these changes do not survive a reboot. I've tried to do this (following https://askubuntu.com/a/598198/653099 ) but without any success... – J. Schmidt Mar 16 '23 at 18:30
  • 1
    @J.Schmidt You should have an app installed by default called "startup applications" so search for "startup applications" in your installed apps. Open the startup applications app, create a new startup application and for the name you can put anything like "Natural Scroll" and then for the command, just copy and paste the command you would like to startup like xinput set-prop 10 266 1 for example. – mchid Mar 18 '23 at 22:35
  • 1
    @J.Schmidt Please let me know if that doesn't work or if you're not sure. Sometimes we need to tell the command to wait a few seconds to give the system time to adjust the settings before running the command so something like sleep 5; xinput set-prop 10 266 1 would tell the command to wait 5 seconds and then execute the command. Also, it's possible that the DISPLAY variable might need to be set. In any case, just let me know if it doesn't work and I will edit it into the answer above. – mchid Mar 18 '23 at 22:40
  • @mchid I posted a seperate question on the issue here https://askubuntu.com/questions/1459765/how-to-execute-bash-file-on-ubuntu-unity-startup . To answer your question, there was no need for me to use sleep command. Thanks – J. Schmidt Mar 21 '23 at 14:23