Natural scrolling not working for horizontal scroll, how to fix this?

5,315

Solution 1

There is also a "nicer" xorg.conf based way to make the inverted <V_DISTANCE> and <H_DISTANCE> settings (determined according to @Eliran's answer) permanent:

Create a directory /etc/X11/xorg.conf.d/, and in it a file like 51-synaptics-tweaks.conf, containing:

Section "InputClass"
    Identifier "touchpad"
    Driver "synaptics"
    MatchIsTouchpad "on"
        Option "VertTwoFingerScroll" "on"
        Option "HorizTwoFingerScroll" "on"
        # In the following lines, use your own negative V_DISTANCE / H_DISTANCE values.
        Option "VertScrollDelta" "-113"
        Option "HorizScrollDelta" "-113"
EndSection

This follows Ubuntu's recommendations in the /usr/share/xorg.conf.d/* example files and also Archlinux instructions. To see the effect, restart X of course :)

Solution 2

Instead of using a designated application to configure natural scrolling, a script can be made to reverse the scrolling directions - both on the vertical and the horizontal axis.

  1. First, obtain the xinput prop related to the scrolling distance (note the variables wrapped in angle brackets):

    $ xinput list
    ⎡ Virtual core pointer id=2 [master pointer (3)]
    ⎜   ↳ Virtual core XTEST pointer id=4   [slave pointer (2)]
    ⎜   ↳ SynPS/2 Synaptics TouchPad id=<TOUCHPAD_ID>   [slave pointer (2)]
    ⎣ Virtual core keyboard id=3    [master keyboard (2)]
        (...)
    
  2. Fetch the appropriate values for that prop:

    $ xinput list-props <TOUCHPAD_ID> | grep "Scrolling Distance"
        Synaptics Scrolling Distance (<DISTANCE_KEY>):  <V_DISTANCE>, <H_DISTANCE>
        Synaptics Circular Scrolling Distance (301):    0.100000
    
  3. Than, create the script file to apply the reversed directions, by negating the values for vertical / horizontal distance. Feed the variables returned earlier:

    #!/bin/sh
    xinput set-prop <TOUCHPAD_ID> <DISTANCE_KEY> -<V_DISTANCE> -<H_DISTANCE>
    nautilus -q
    nautilus -n &
    
  4. Grant the file with execution permissions, set it to run at startup, and there you have it.

Source:

This method was ported from Andy C.'s old web blog, to create a self contained answer. Thank you, Andy, for providing an elegant, system wide solution.

Notes

  • It seems that calling nautilus is breaking the script on 13.04. Omitting the two calls to nautilus solves it.
  • Natural scrolling (both vertically and horizontally) is working properly out-of-the-box in 14.x, so no need for scripting there, just toggle the "Natural Scrolling" in the Mouse & Touchpad options.

Solution 3

As an alternative to using script files or Ubuntu Tweak, you can also try the app called "Natural Scrolling", made by Zedtux. It will come as an indicator.

To install it, the easiest way is using a terminal:

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

Solution 4

In xfce4 (Xubuntu, Ubuntu Studio,...) you can add this on the console:

echo 'pointer = 1 2 3 4 5 7 6 8 9 10 11 12' >> .Xmodmap
xmodmap .Xmodmap
Share:
5,315

Related videos on Youtube

Eliran Malka
Author by

Eliran Malka

I'm a full stack developer, here's my user story on stackoverflow and linkedin. I like electric guitars, electronic music, user experience, design, programming, sketching, and haiku/poetry. I really enjoy exploring the physics world, specifically high-energy physics, quantum mechanics and string theory. and I love learning.                             #SOreadytohelp

Updated on September 18, 2022

Comments

  • Eliran Malka
    Eliran Malka over 1 year

    I've enabled natural scrolling via Ubuntu Tweak's miscellaneous options, but that doesn't seem to take effect for horizontal scroll - neither in web browsers, nor in nautilus or other native applications.

    Is there a way to enforce this behavior on horizontal scrolling as well?

    I'm using Ubuntu 12.04.

  • Agmenor
    Agmenor over 11 years
    Interesting that your script works for any window ! I indeed have a bug with this. I'll have a try with your solution.
  • Eliran Malka
    Eliran Malka almost 8 years
    actually, this is awesome. accepting :)