Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to have the behavior that using ANY mouse device I can hold down the middle key(or a real wheel) and move forward and back or left to right to emulate the wheel behavior.

I found a way to do this for now:

MouseID=`xinput list " USB OPTICAL MOUSE" 2>/dev/null|grep id=|sed -e "s/.*id=\([0-9]*\).*/\1/"`
xinput set-int-prop $MouseID "Evdev Wheel Emulation" 8 1 2>/dev/null
xinput set-int-prop $MouseID "Evdev Wheel Emulation Button" 8 2 2>/dev/null
xinput set-int-prop $MouseID "Evdev Wheel Emulation Axes" 8 6 7 4 5 2>/dev/null

But for every of my mouses I have to copy&paste the code above and change the first line to fit its name, and if I plug-out and in again the mouse, I have to run the script again to have the emulation enabled then.

Is there any better way to handle this, i.e. run the script using exactly the correct device ID every time when a mouse device is plugged-in?

Many thanks.

share|improve this question
up vote 1 down vote accepted

Thanks to help on Archlinux's forum , I've found the way to archive this:

Edit /etc/X11/xorg.conf.d/10-evdev.conf and change first section to:

Section "InputClass"
        Identifier "evdev pointer catchall"
        MatchIsPointer "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option      "EmulateWheel"      "true"
        Option      "EmulateWheelButton"    "2"
        Option      "XAxisMapping"      "6 7"
        Option      "YAxisMapping"      "4 5"
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .