One Thing Well

A weblog about simple, useful software.

Follow on Twitter, Google+ or via the feed. Feel free to get in touch. Sponsor the site.

Reverse Scrolling for X11

After giving ‘natural’ scrolling a chance in Lion and getting used to it almost immediately, I found myself struggling to scroll in the right direction on my netbook.

There are, as you’d expect, quite a few different ways to get upside down scrolling going under X11.

You can add the following option to /etc/X11/xorg.conf (or the appropriate config file under /etc/X11/xorg.conf.d/)

Option "ZAxisMapping" "5 4"

or pop this command in your ~/.xinitrc

xmodmap -e "pointer = 1 2 3 5 4"

or do the same with xinput, like so:

xinput set-button-map 13 1 2 3 5 4

That 13 is the id number of the trackpad on both my Linux machines, but it might be different on your system; to find the right number, 0x0000 offers the following one-liner:

xinput list | egrep "slave.*pointer" | grep -v XTEST | sed -e 's/^.*id=//' -e 's/\s.*$//'

The 5/4 flip might be different too, in which case you can run xinput test 13 (replacing 13 whatever id number that one liner threw out) then scroll up and down to see which numbers map to up- and down-scrolling on your computer.

Finally, there’s a menu bar widget aimed at Gnome users called naturalscrolling that lets you switch between scrolling directions on the fly.