9

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.

Eliran Malka
  • 1,205
  • 18
  • 36

4 Answers4

9

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.
Eliran Malka
  • 1,205
  • 18
  • 36
4

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

tanius
  • 6,303
  • 1
  • 39
  • 49
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
Agmenor
  • 16,214
  • i'm aware of that. it seems, however, to fail the task for some native applications. plus, it seem redundant to install an application (and clutter up the panel with yet another indicator) solely for that purpose, while a four-liner script can resolve this, possibly better. thanks for the alternative anyhow. – Eliran Malka Oct 20 '12 at 03:55
  • 1
    Interesting that your script works for any window ! I indeed have a bug with this. I'll have a try with your solution. – Agmenor Oct 20 '12 at 07:34
1

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
rubo77
  • 32,486