Wednesday, January 11, 2012

Flipping Vertical Scrolling Behavior in X Windows

I've grown used to Mac OS "natural scrolling" on my trackpad.  So when I recently set up a few ubuntu netbooks, for a quick lab experiment, I wanted to have their trackpads behave the same.  It's actually pretty simple to tell X windows to flip 'em.

Short story, on a completely stock ubuntu, (and should work for anything) this will flip your scrolling:
  • open a terminal
  • run `echo "pointer =  1 2 3 5 4 6 7 8 9 10 11 12" >> ~/.Xmodmap`
  • logout of your X windows session.
  • log back in.
  • ta-da.
Long story, since the days of the dinosaurs, X Windows has been really nice about letting you remap your mouse keys .. southpaws would frequently swap their left and right buttons.  The `xmodmap` command provides an interface for this stuff.  Try `man xmodmap` and `xmodmap -help` for more details.  The above instructions just append a custom button setting to the rc file that xmodmap evaluates at log in.

Up and down scroll are considered physical buttons 4 and 5, respectively.  The "pointer = " statement above has 4 and 5 swapped.  Simple as that.

Use `xmodmap -pp` to display your current button mappings, and `xmodmap -e "pointer = default"` to reset to normal.  If you want to suss out where all of your buttons are, launch `xev` to see what events X is handling .. look for the ButtonPress event and note the "button" attribute.

No comments:

Post a Comment