Thursday, February 26, 2009

Tip of the day - wheel emulation

[update 30 May 2012: add xorg.conf.d snippet] First, run xinput --list --short to identify your mouse device. Let's assume that your mouse is called "USB Mouse".
Then, run the following command:

xinput --set-int-prop "USB Mouse" "Evdev Wheel Emulation" 8 1
xinput --set-int-prop "USB Mouse" "Evdev Wheel Emulation Button" 8 3

Now, holding the right mouse button and moving up and down will scroll. Very useful for reading long articles.

Requirements: evdev 2.1, X server 1.6 and xinput 1.4. Don't forget to check the evdev man page, there's a few extra tweaks related to wheel emulation. xinput is not persistent, but the above can be achieved with the following xorg.conf.d snippet:
Section "InputClass"
   Identifier     "Wheel Emulation"
   MatchIsPointer "on"
   MatchProduct   "USB Mouse"
   Option         "EmulateWheelButton" "3"
   Option         "EmulateWheel" "on"
EndSection
Save this as /etc/X11/xorg.conf.d/99-wheel-emulation.conf and you're good to go. Requires X Server 1.8 or later, for older servers you can do the same by merging the keys input.x11_options.EmulateWheel and input.x11_options.EmulateWheelButton your HAL fdi file.

2 comments:

  1. Is the prefixed "Evdev" a permanent fixture? I noticed they appeared in the newer evdev in Ubuntu Jaunty, so I updated by xinput script accordingly, but I'm curious if they'll be changing at some point?

    ReplyDelete
  2. All properties provided by the evdev driver have the Evdev prefix. Similarly, all synaptics property have a Synaptics prefix.

    ReplyDelete

Comments are moderated thanks to spammers