153

Two-fingered scrolling is working fine, but is there a way that I can reverse the direction (natural scrolling)? It seems backwards opposed to the way OSX does it.

Elin Y.
  • 893
Naftuli Kay
  • 4,226

19 Answers19

126

First way: using GNOME Settings

I don’t know which version of Ubuntu you’re using, but in Ubuntu 13.04 to Ubuntu 20.04 (I guess), it’s possible via Mouse and Touchpad settings.

So first, open System Settings > Mouse and Touchpad. As seen in the screenshot below if there’s an option for content sticks to fingers, check it. Then the scrollbars will work in reverse direction. I recommend clicking the "Test Your Settings" button to try it out.

Screenshot


Second way: using DConf Editor

This is also accessible via DConf Editor as well. To install DConf Editor, run:

sudo apt-get install dconf-editor

Then go to org.gnome.settings-daemon.peripherals.touchpad and check natural-scroll.


You can also set this option on the command line:

gsettings set org.gnome.settings-daemon.peripherals.touchpad natural-scroll true

On Ubuntu 20.04

The DConf path has been changed to: org.gnome.desktop.peripherals.touchpad and so does the command:

gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll true
AliNajafies
  • 5,874
  • Finally, it's about time they implement something like this :) – Naftuli Kay Mar 18 '13 at 17:37
  • I didn't consider the date of question! :D – AliNajafies Mar 18 '13 at 18:13
  • I think this is essential for Ubuntu Touch, where you move the content itself instead of scrollbar slider. – AliNajafies Mar 18 '13 at 20:35
  • 3
    Unfortunately, it doesn't work in Nautilus and few other applications, though it works in others – notablytipsy May 31 '13 at 20:21
  • 4
    The System Settings > Mouse and Touchpad for 14.04 is listed as "Natural scrolling" and works well, including Nautilus. – Steven Almeroth Jun 14 '14 at 21:52
  • And it doesn't work with all laptops. This setting does nothing on my HP laptop. syncclient VertScrollDelta -111 (suggested in another answer) does. The same is true with palm detection. – Nathan Jun 12 '15 at 23:21
  • 2
    If you want to set the scroll direction without GUI use the following command in your terminal (this sets the setting permanently per user): gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false or for your mice gsettings set org.gnome.desktop.peripherals.mouse natural-scroll false. (Fedora 24 recognizes your mouse as touchpad, therefore use the command line with .touchpad, see http://forums.fedoraforum.org/showthread.php?p=1778162&posted=1#post1778162 and the Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=1352159 – erik Dec 19 '16 at 06:25
  • loged in to thank for this mehod) +1 – Altenrion Jan 04 '17 at 15:15
  • @erik Nice CLI approach, but doesn't work for me: first, I have a slightly different path (I have "settings-daemon" where you have "desktop"), second, flipping the "natural-scroll" from true to false and back has no impact on the touchpad's behaviour (as observed in Ffox, a terminal and nautilus) and third, I have no "mouse.natural-scroll" to try out. Any suggestions? – Tomislav Nakic-Alfirevic Feb 17 '17 at 10:34
  • unfortunately dConf doesn't seem to affect my scrolling in Ubuntu 18.0.4 with Apple's Magic Trackpad 2, trackpad works for moving pointer and clicks but scrolling doesn't work. – Mobigital Nov 12 '18 at 04:11
  • In Ubuntu 20.04, the path for DConf Editor does not exist. – Flimm Nov 28 '20 at 19:25
  • @Flimm thank you for your report; just updated the answer. – AliNajafies Feb 24 '22 at 15:42
  • @AliNajafies I tried doing this using dconf editor, but my touchpad speed and scroll direction seems to be unaffected. Can you help me in solving this? – Ricky Aug 19 '23 at 06:31
86

There are several ways to enable system-wide inverse or natural scrolling for the mouse. Only two ways I have tried will enable it for all windows, including gedit, terminal, software center, nautilus, and others. The easiest way to do it is to do the following. This method will need the latest version of the xserver-xorg-input-evdev driver, which you can get from here. I know it will work because I am using it and tested it previous to writing this version of a guide I previously wrote for Fedora 21. Make sure that you have reverse scrolling turned off in Ubuntu-Tweak, or you won't see the effect of the changes. In addition, for those users who do not want to use natural scrolling on your system now that reverse scrolling will be system-wide, those users can use this option to turn off natural scrolling on a per user basis. Now, to get started...

Update/install Evdev to latest version and reboot before continuing this guide.

Get your mouse device id by running the following in a terminal:

xinput list

Take that number you got (just the number after "id=") and replace "{device id}" with that number in the following command:

xinput list-props {device id} | grep "Scrolling Distance"

It is case sensitive unless you use -i in the grep command. Write down the numbers you find in the output from that command (in my case it was the number 1, shown three times and separated by commas). You will use the negative values of the numbers you get in your output. Also, make sure to write down the property number (it will be in parentheses in the output; in my case it was (272) in Ubuntu and (273) in Fedora).

Note: If you get no output containing the property "Scrolling Distance" this method will not work for you and you will need to stop here and skip to the alternate way shown below this guide.

Run the following command in your open terminal:

sudo touch /usr/share/X11/xorg.conf.d/20-natural-scrolling.conf

Now, run the following command (you can use your favorite text editor instead of nano but I use nano):

sudo nano /usr/share/X11/xorg.conf.d/20-natural-scrolling.conf

In the file you have opened in your preferred text editor, paste the following (but be sure to change the numbers to the same comma-separated numbers you got from step 3; in my case the number was 1 so I put -1):

Section "InputClass"
        Identifier "Natural Scrolling"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Option "VertScrollDelta" "-1"
        Option "HorizScrollDelta" "-1"
        Option "DialDelta" "-1"
EndSection

Save the file and exit the text editor. No need for a reboot. Just issue the following command (substituting the property number and the negatives of the numbers you got in the third step, and the device id you got from the second step):

xinput set-prop {device id} {property number} -1 -1 -1

You might need to quit nautilus and restart nautilus on some systems (skip this if natural scrolling is working in nautilus after running the above command). Press Alt+F2 and run each of these commands separately:

nautilus -q

nautilus -n

That's it! You should now have system-wide natural scrolling that will be persistent.

Alternate method:

If you do not want to install the latest version of Evdev (or, if your mouse doesn't have the "Scrolling Distance" property even in the latest Evdev), you can do the following:

Run the following command in your open terminal:

sudo touch /usr/share/X11/xorg.conf.d/20-natural-scrolling.conf

Now, run the following command (you can use your favorite text editor instead of nano but I use nano):

sudo nano /usr/share/X11/xorg.conf.d/20-natural-scrolling.conf

In the file you have opened in your preferred text editor, paste the following:

Section "InputClass"
        Identifier "natural scrolling for mouse wheel"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "mouse"
        Option "Device" "/dev/input/mice"
        Option "Protocol" "Auto"
        Option "ZAxisMapping" "5 4"
EndSection

Save the file and reboot. As above, individual users can switch it off on a per-user basis by using Ubuntu-Tweak to "turn on" natural scrolling (it will be the reverse of the system-wide setting on a per-user basis but will not affect the actual system setting for other users who will want to use natural scrolling).

Note: The alternative method here will not work if you have the latest Evdev installed, such as in Fedora 22. Use the Evdev method above. Also note: Neither method will work with libinput in Wayland. You will need an alternative way of doing it per user or otherwise. If using libinput, make sure to remove the files created as above, and create a startup item in a desktop file. After creating the desktop file, place the following in the Exec line (be sure to use the device id for your mouse and the naturalscrolling property number for your mouse while using libinput; my device id was 11 and the property was 272; adjust yours accordingly).

sh -c "sleep 5; exec xinput set-prop 11 272 1"

Following that, save the file and logoff. When you logon again you should have natural scrolling on a per-user basis or may be able to set it in the autostart for all users.

  • Perfect! I did not have to use the alternative method. Lenovo Helix, Arch Linux, Gnome 3.16 and Logitech MX wireless mouse. THANK YOU! – eduncan911 Apr 30 '15 at 19:38
  • Thank you! For other users (with multiple keyboards like me)... the part about xinput set-prop etc. in this answer is only necessary to avoid reboot. – robert Jun 11 '15 at 13:34
  • The 'alternate method' without evdev did not work for me on Fedora 22 and made the mouse pointer unresponsive (failed to load mouse module). – robert Jun 11 '15 at 13:40
  • 1
    Yes, I found that the alternative method no longer works with Fedora 22 and above. You get to choose between Evdev or libinput. If you install the Evdev driver, please do not use the alternative method. It won't work. With Fedora 22 you get one of the latest versions of Evdev anyway so the alternative method is a moot point in that version although it still works in other distributions until the newest changes become incorporated in them. I recommend Evdev rather than libinput. Libinput still is very buggy and will not work with either method here. – D. Charles Pyle Jun 12 '15 at 21:43
  • First method works like a charm. Ubuntu 15.4 and Microsoft Touch Mouse. Thanks! – kza Sep 01 '15 at 07:49
  • This works for me when I use 2-finger scrolling, but not when I use circular scrolling. I tried setting a negative value for "Synaptics Circular Scrolling Distance" but it doesn't scroll at all then. Any ideas? – Chris Moore Mar 09 '16 at 03:30
  • Not sure about how to help circular scrolling. I do not have the hardware to test. I do know that certain hardware will lose all scrolling when the negative number value is too low. I tried setting that number lower to get faster scrolling and I ended up getting no scrolling at all. If you are already at -1 there isn't anything that can be done at the moment. But, if you used another number (say, -108 or something else), try setting it to -1 and see where that gets you. Try using a different parameter. Also, some devices require lower numbers than -1, such as, say, -200 or some other. – D. Charles Pyle Mar 10 '16 at 17:30
  • Got it on elementary OS 0.3.2 Freya! First method doesn't work in several apps like Terminal and Skype, but second method works everywhere! Thanks a lot! – menkow Apr 11 '16 at 15:54
  • 1
    Second method worked for me in Ubuntu 14.04 and first method worked for me in Ubuntu 16.04. Second did not work on Ubuntu 16.04. Probably because of latest evdev.. – Skywalker May 29 '16 at 07:04
  • In Ubuntu 16.04, similarly to Meharoof, the first method worked (for a bluetooth mouse), and the second didn't (for my trackpad). Any ideas how to make it work for trackpad (which list-props shows Device Enabled; Coordinate Transformation Matrix; Device Product; and Device Node only)? Thanks – Rafael Xavier Jun 19 '16 at 00:13
  • I wonder if it is possible, using the first method, to put a little 2-liner in ~/.xinitrc just using xinit set-prop. I.e., is the change to a .conf file even necessary? –  Nov 23 '16 at 08:07
  • To set it permanently off, per user, you can use the following command: gsettings set org.gnome.desktop.peripherals.touchpad natural-scroll false (for the touchpad and also for Fedora 24 mice (bug in Fedora 24)) or gsettings set org.gnome.desktop.peripherals.mouse natural-scroll false. See http://forums.fedoraforum.org/showthread.php?p=1778162&posted=1#post1778162 and the Fedora bug https://bugzilla.redhat.com/show_bug.cgi?id=1352159 – erik Dec 19 '16 at 06:17
  • An easier, less wordy version of this method is available in my answer. https://askubuntu.com/questions/91426/reverse-two-finger-scroll-direction-natural-scrolling/861626#861626 – Timothy Zorn Jan 16 '17 at 05:19
  • Setting synclient VertScrollDelta=50 did the trick for me – Augustin Riedinger Mar 24 '17 at 11:32
  • this worked perfectly on Ubuntu 16.10, but stopped working after upgrading to Ubuntu 17.04. here is what helped for Ubuntu 17.04 in my case: https://askubuntu.com/a/905625/424125 – Alex Apr 17 '17 at 00:14
  • 100% works with Synaptics touchpad driver. – diamondburned Oct 07 '17 at 00:37
  • The first method works on Ubuntu 18.04 too (the other one I've not tested), even without Evdev (it might be that I'm not aware of having it in my system, actually...). I used a different header for the .conf file, taking it from the Arch wiki. – Arch Stanton Jul 30 '18 at 08:16
  • This method is still working in 2019! I just used this explanation to fix scrolling issues in Xubuntu 19.10. – Bo Johnson Oct 27 '19 at 03:46
  • Thanks for not assuming I'm using gnome desktop nonsense! – Freeman Sep 19 '21 at 05:19
44

The simplest and in my opinion the best way to achieve this on Ubuntu 12.10 and above (didn't test it on 12.04 and below) is to edit synaptics configuration:

sudoedit /usr/share/X11/xorg.conf.d/50-synaptics.conf

On 16.04, copy this file under /etc/X11/xorg.conf.d/50-synaptics.conf, then edit:

cp /usr/share/X11/xorg.conf.d/50-synaptics.conf /etc/X11/xorg.conf.d/
sudoedit /etc/X11/xorg.conf.d/50-synaptics.conf

add those lines in the Section "InputClass" Identifier "touchpad catchall":

        Option "VertScrollDelta" "-111"
        Option "HorizScrollDelta" "-111"

So that it reads like follows:

Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
        Option "VertScrollDelta" "-111"
        Option "HorizScrollDelta" "-111"
# ...

Reboot (or read on) and have fun with natural scrolling :)

If you want to try your settings without reboot, you can use synclient

synclient VertScrollDelta=-111
synclient HorizScrollDelta=-111

The changes are immediately applied, but won't stay after reboot if you don't add them in 50-synaptics-conf file.

Note for GNOME or Cinnamon:

If you're using GNOME or Cinnamon desktop manager, there is a good chance that GNOME/Cinnamon's settings can override your custom settings. To prevent GNOME/Cinnamon's settings override yours, open dconf Editor [dconf-editor] and edit following entry:

/org/gnome/settings-daemon/plugins/mouse/
or
/org/cinnamon/settings-daemon/plugins/mouse/

Uncheck active.

P.S.:

The default value is 111 and it indicates the speed, that means you can play with the value to adjust the scrolling speed to you favor. Giving it a negative value makes it simply to scroll in reversed direction.

Elin Y.
  • 893
  • This works in 12.04 as well, but not for Nautilus. – Lars Nyström Aug 26 '13 at 08:04
  • In 13.04 works for Files (Nautilus). I don't know why it wouldn't work in 12.04. I used this approach in 12.10 and now using in 13.04. – Elin Y. Aug 26 '13 at 08:08
  • Ubuntu 12.04 uses Nautilus version 3.4.2. I believe newer versions of Ubuntu uses newer versions of Nautilus. – Lars Nyström Aug 26 '13 at 10:07
  • +1. I was hoping to make VertEdgeScroll go the opposite way from VertTwoFingerScroll but they appear to be booleans and it's probably a crazy idea anyway. http://www.x.org/archive/X11R7.5/doc/man/man4/synaptics.4.html – joeytwiddle Jan 18 '14 at 18:28
  • 50-synaptics-conf should probably be 50-synaptics.conf, otherwise this worked for me on Lubuntu 14.04. – Peppe L-G Oct 27 '14 at 07:14
  • @PeppeL-G yes, thanks for the attention, I'll correct it immediately. – Elin Y. Oct 27 '14 at 08:50
  • 1
    This is probably the best solution because it is independent from the desktop environment used. For my Ubuntu 14.10 the xorg.conf.d folder and the file didn't exsist so I needed to create them manually and create a custom InputSection – 0xAffe Oct 29 '14 at 19:41
  • This is a great answer, as it should work on any Linux distro that uses X.org. – Josh Glover Sep 12 '15 at 12:01
  • This answer works well for Ubuntu GNOME 16.04 running gnome-shell 3.20 - the trackpad was inverted and couldn't find a desktop option to change it. – benJ Apr 27 '16 at 12:20
  • If you're a moron like I am and put these settings in the wrong spot because you read through too fast and didn't pay attention, it will cause X to fail at boot, leaving you with a black screen. Luckily, you can use Ctrl + Alt + F1 or whichever F key to switch to a login console and correct your mistake there. – William Brawner Jul 13 '16 at 12:34
  • @BillyBrawner I've updated the answer and added the snippet for the whole section. – Elin Y. Jul 13 '16 at 20:13
  • Moreover, I've added an info for 16.04, that the file should not be edited directly. This may also be valid for older versions, but I don't have any older Ubuntu for the moment to test it. – Elin Y. Jul 13 '16 at 20:13
  • Note it is not exactly speed, but inverse of speed: higher (absolute) values mean lower scrolling speed. 111 and -111 scroll slower than 31 and -31 – Ciprian Tomoiagă Sep 23 '17 at 07:36
19

UPDATE: This solution does not work for apps that use GTK3, such as core Gnome apps like Nautilus (file browser). See D Charles Pyle's answer below for a workaround that works in all applications. Or follow Gnome bug 682457 for progress on a core fix that won't require a workaround.

You can use "Natural Scrolling" to have a system wide inverse scrolling.

What is Natural Scrolling?

Natural Scrolling is a GNOME Applet allowing you to reverse the direction of scrolling. You push your fingers upwards to move the page content upwards (and downwards for downwards) just like on iOS devices. Don't move scrollbars anymore but your file.

Install Natural Scrolling:

Natural Scrolling can be installed from its PPA.

Hit Alt+Ctrl+T to open terminal and run following commands:

sudo add-apt-repository ppa:zedtux/naturalscrolling
sudo apt-get update
sudo apt-get install naturalscrolling

How to enable Natural Scrolling?

Once installed, Hit Super key (Windows key) to open Unity dash and search for "natural scrolling" and open it. You'll see a new indicator in Unity panel, Click on it and select your device. In the preferences you can set it to start at login. That's it!

enter image description here

David Foerster
  • 36,264
  • 56
  • 94
  • 147
Basharat Sialvi
  • 24,046
  • 8
  • 62
  • 82
17

On Ubuntu 14.04 to Ubuntu 20.04, go to "Settings", then "Mouse & Touchpad" and select "Natural Scrolling".

enter image description here

Flimm
  • 41,766
14

The reverse scrolling you're talking about is called "natural scrolling," and can be enabled several different ways in Ubuntu. Here's an article on OMG! Ubuntu! detailing how to install the software that will get you what you need. If you're familiar with Ubuntu Tweak, you can also enable it in the latest release.

Nathan Dyer
  • 2,047
  • Awesome, thanks. "Natural Scrolling" in Ubuntu Tweak messes with the mouse as well, I'll see if the .Xmodmap tweak works. – Naftuli Kay Dec 30 '11 at 04:05
13

Get the device-id using:

xinput list

Get the numbers from this command:

xinput list-props {device id} | grep "Scrolling Distance"

For example, a sample output:

Synaptics Scrolling Distance (290): 102, 102

Here, the numbers 102, 102 are of our interest. In your case, they would be something else. Just put negative of those numbers in the below mentioned config.

Edit ~/.profile and put these lines at end of file.

synclient VertScrollDelta=-102
synclient HorizScrollDelta=-102

Logout and login, natural scrolling should work fine.

Rahul
  • 269
  • 1
    The most popular approaches at the top didn't work for me on Xubuntu 14.04. This one did! – rajb245 Jul 12 '16 at 02:44
  • 2
    This was the only thing that worked for me on GNOME + Arch. THANK YOU – tmsimont Sep 02 '16 at 03:32
  • 3
    These lines should be placed in ~/.xsessionrc, not ~/.profile – Timothy Zorn Dec 17 '16 at 03:07
  • Ubuntu 17.10 has "natural-scroll" checkbox in Mouse settings, but has not effect. Tried dconf-editor too, which also didn't enable natural-scrolling. This is the only method that worked. – Ajay M Nov 16 '17 at 13:49
9

The Natural Scrolling application referred to in Basharat Sial's answer does not fix natural scrolling in certain system windows.

As an alternative, I recommend the guide provided in this answer. You won't need the natural scrolling application anymore when you use his guide.

Steven Roose
  • 1,928
9

The easiest way to set natural scrolling system-wide and for it to work with all system apps, is to set up the following file(s).

Touchpads only:

/usr/share/X11/xorg.conf.d/20-natural-scrolling-touchpads.conf

Section "InputClass"
    Identifier "Natural Scrolling Touchpads"
    MatchIsTouchpad "on"
    MatchDevicePath "/dev/input/event*"
    Option "VertScrollDelta" "-111"
    Option "HorizScrollDelta" "-111"
EndSection

Mouses only:

/usr/share/X11/xorg.conf.d/20-natural-scrolling-mouses.conf

Section "InputClass"
    Identifier "Natural Scrolling Mouses"
    MatchIsPointer "on"
    MatchIsTouchpad "off"
    MatchDevicePath "/dev/input/event*"
    Option "VertScrollDelta" "-1"
    Option "HorizScrollDelta" "-1"
    Option "DialDelta" "-1"
EndSection

For both mouses and touchpads, create both files.

Then, reboot.

The benefit of using one of these two configurations is they are not device-specific. You can plug in other mouses or touchpads or keyboards with touchpads, and it'll work.

5

Please follow below steps to system widely change the scrolling.

  1. On Terminal write: xev -event mouse. You will get one small box and when you bring your mouse into that section you will get a lot data getting generated into the Terminal.
  2. On scrolling up, note the button name, lets say "x" (in my case it is button 5). Also note down the button name on scrolling down, lets say "y". in my case it is "4".
  3. Create a backup of ~/.Xmodmap file by using cp ~/.Xmodmap ~/.Xmodmap.bak.
  4. Do cat ~/.Xmodmap. Output would be like pointer = 1 2 3 5 4 6 7 8 9 10 11 12
  5. In the above output search for x and y and they will be in consecutive position and just swap them. In my case echo "pointer = 1 2 3 4 5 6 7 8 9 10 11 12" > ~/.Xmodmap && xmodmap ~/.Xmodmap worked. Note switch of 4 and 5.
  6. Now the scrolling will be applied system wide. No need to reboot.
  • 3
    For most users this can be reduced to a single instruction: echo "pointer = 1 2 3 5 4 6 7 8 9 10 11 12" >>~/.Xmodmap && xmodmap ~/.Xmodmap – tremby Dec 20 '15 at 20:38
4

You can also use Ubuntu Tweak tool to enable natural scrolling (misc settings)

Screenshot

Official homepage with .deb distributive: http://ubuntu-tweak.com/

DJCrashdummy
  • 1,911
  • I can confirm that this worked on 14.10. For some reason, I was unable to install the naturalscrollingpackage (W: Failed to fetch http://ppa.launchpad.net/zedtux/naturalscrolling/ubuntu/dists/utopic/main/binary-amd64/Packages 404 Not Found) – BoD Nov 20 '14 at 14:07
  • I tried this on 16.04 and though the option is present in Tweaks under "Miscellaneous", it didn't change the scroll order at all (ever after logging out and back in). – Brian White Aug 30 '16 at 17:03
3

The naturalscrolling package doesn't seem to work for Ubuntu 12.10. I installed Ubuntu Tweak:

sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak

and you can adjust scrolling at

Tweaks -> Miscellaneous -> Natural Scrolling

kon
  • 173
  • 1
  • 5
2

Based on this blog, the script below worked for me on Ubuntu 12.04. It sets your touchpad's horizontal and vertical scrolling scale-factors both to negative values (which usually ensures "natural" scrolling). It does it "under the hood" so all your applications will be affected, even those that don't pay attention to the settings adjusted by tweakUI. Several unnecessary commands and comments are there just so you can see what's going on. You'll probably want to turn off any natural scrolling settings in TweakUI or similar.

xinput list | grep "[Tt]ouch" | grep "id=([0-9]+)"
# ⎜   ↳ SynPS/2 Synaptics TouchPad                  id=11    [slave  pointer  (2)]
id=`xinput list | grep -Po "[Tt]ouch[^=]*id=[0-9]+" | grep -Po [0-9]+`
xinput --list-props $id | grep "Scrolling Distance"
# Synaptics Scrolling Distance (269):    -107, -107
# Synaptics Circular Scrolling Distance (282):    0.100000
prop_id=`xinput --list-props $id | grep -P ".*[^C][^i][^r][^c][^u][^l][^a][^r]\sScrolling Distance" | grep -Po '\([0-9]+\)' | grep -Po "[0-9]+"`
prop_xy=xinput --list-props $id | grep -P ".*[^C][^i][^r][^c][^u][^l][^a][^r]\sScrolling Distance" | grep -Po '\s+[-+]{0,1}[0-9]+\,\s*[-+]{0,1}[0-9]+' | tr -d '-'
xinput --list-props $id |  -P ".*[^C][^i][^r][^c][^u][^l][^a][^r]\sScrolling Distance" | grep -Po '\s+[-+]?[0-9]+[,]?' | tr -d '-' | tr -d ',' | tr ' \t' '-' | xargs xinput --set-prop $id $prop_id
nautilus -q
nautilus -n &
hobs
  • 512
  • 3
    You could try | grep -v 'Circular' for [^e][^x][^t][^r][^a] [^r][^e][^a][^d][^a][^b][^i][^l][^i][^t][^y]. Oh silly me, just realised you are a -Perl coder! – joeytwiddle Jan 18 '14 at 18:20
  • Indeed. Silly me use -P in one place and not all and make work for myself. Will fix. – hobs Jan 19 '14 at 17:15
  • Actually, I was trying to negate one part of the regex and not the other, so no joy on the @joeytwiddle simplification. Regex's don't do negation combined with nonnegation well (-Perl or otherwise) – hobs Jan 19 '14 at 17:19
  • 1
    Hehe. My suggestion would require an extra command, which is certainly less efficient (on single processor machines anyway). It would look like this: ... | grep -v 'Circular' | grep "\sScrolling Distance" | ... They might be more efficient swapped around. Um. – joeytwiddle Jan 20 '14 at 02:55
  • Yea, but yours would match a completely different set of strings than mine. Yours would exclude all strings with "Circular". Mine would exclude only those with "Circular" immediately preceding the "Scrolling". Mine is definitely uglier, but it behaves differently, and it's the only one I've tested and made sure is correct enough (it worked on my machine). – hobs Jan 20 '14 at 19:17
  • This was the only thing I could get to work to get my horizontal natural scroll back in Ubuntu 18. For any other 18 users that are wondering. – DjH Sep 06 '18 at 00:45
2

In newer versions of GNOME (starting from at least 3.6), installing an extension is no longer required. It can be found under the standard GNOME "Mouse and Touchpad"-settings. Somewhat confusingly however, the Gnomesters decided to call it "Content sticks to fingers".

Max
  • 21
0

OK, so I had Firefox scrolling one way and Evolution scrolling the other. I set natural scrolling under System settings, but find that Ubuntu tweak natural scrolling counteracts it in certain apps. I have to have both system settings AND Ubuntu tweak set to natural scrolling to get universal scroll in the same direction, otherwise they seem to fight each other. It took me many hours to figure this out.

0

This worked on Mate and presumably other environments that don't have a simple option for this in the control panel.

Add this line by hand if you already have an .Xmodmap file.

# standard
echo "pointer = 1 2 3 4 5 6 7 8 9 10 11 12" > ~/.Xmodmap && xmodmap .Xmodmap


# "natural"
echo "pointer = 1 2 3 5 4 6 7 8 9 10 11 12" > ~/.Xmodmap && xmodmap .Xmodmap
0

I used the Alternative method @D. Charles Pyle mentioned, but with a slight modification:

Option "ZAxisMapping" "4 5" 

instead of

Option "ZAxisMapping" "5 4"

Ubuntu 14.04, GNOME, Logitech Optical Mouse

muru
  • 197,895
  • 55
  • 485
  • 740
ptgamr
  • 101
0

On 12.04.5

sudo add-apt-repository ppa:zedtux/naturalscrolling
sudo apt-get update
sudo apt-get install naturalscrolling

Start it by searching by Natural Scrolling application

Right click on its icon on top right menu. Natural Scrolling>your device

Also, Preferences>start at login

Vitor Abella
  • 7,537
0

I just got a new Latitude E5570 which is affected by bug #1590590 (among others... :\ ) and a very quick and easy solution was provided in this comment:

~/.xinputrc

xinput set-button-map "ImPS/2 Generic Wheel Mouse" 1 2 3 5 4 6 7

in this way only the two-finger scrolling direction of the unrecognized touchpad will be inverted, while the wheel scrolling direction of an external mouse will not be modified.

In addition, due to some bug in unity/gnome not all the applications interpret correctly .xinputrc/.Xmodmap commands. So for example chrome/firefox will be ok, but nautilus windows will still use the "natural" scrolling, regardless of .xinputrc/.Xmodmap content. I did not find a solution to solve these inconsistencies.

The only real solution will be of course a proper support of our touchpad at kernel level