Thinkpad Middle Click Scroll

I've been a longtime Thinkpad user, and a long time Linux user. One feature some Linux distros get right is a "click and hold the center mouse button to scroll" using the TrackPoint (Red Nub Mouse). Ubuntu, and Fedora both set this by default. Most other distros do not.

I found a simple script today that enables this feature for me on all Thinkpads.

#!/bin/sh
xinput list | sed -ne 's/^[^ ][^V].*id=\([0-9]*\).*/\1/p' | while read id
do
        case `xinput list-props $id` in
        *"Middle Button Emulation"*)
                xinput set-int-prop $id "Evdev Wheel Emulation" 8 1
                xinput set-int-prop $id "Evdev Wheel Emulation Button" 8 2
                xinput set-int-prop $id "Evdev Wheel Emulation Timeout" 8 200
                xinput set-int-prop $id "Evdev Wheel Emulation Axes" 8 6 7 4 5
                xinput set-int-prop $id "Evdev Middle Button Emulation" 8 0
                ;;
        esac
done

Put that on your system, make it executible, and run it.

Enjoy the middle click to scroll magic!