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

Solution 1:

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.

  • Fixing natural scrolling in Ubuntu 12.04 by Andy C..

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 2:

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 :)