Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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"
EndSection
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.