You are not logged in.

#1 2012-01-10 08:30:25

felixonmars
Developer/TU
From: Wuhan, China
Registered: 2011-04-15
Posts: 63
Website

[SOLVED] Enable Mouse Wheel Emulation automatically for ANY mouse

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.

Last edited by felixonmars (2012-01-10 11:41:47)


PGP key: 30D7CB92
Key fingerprint: B597 1F2C 5C10 A9A0 8C60  030F 786C 63F3 30D7 CB92

Offline

#2 2012-01-10 11:04:10

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,461

Re: [SOLVED] Enable Mouse Wheel Emulation automatically for ANY mouse

Edit /etc/X11/xorg.conf.d/10-evdev.conf (probably the first section containing  MatchIsPointer "on" ). I do not know the exact syntax, just read man evdev.

Offline

#3 2012-01-10 11:36:14

felixonmars
Developer/TU
From: Wuhan, China
Registered: 2011-04-15
Posts: 63
Website

Re: [SOLVED] Enable Mouse Wheel Emulation automatically for ANY mouse

olive wrote:

Edit /etc/X11/xorg.conf.d/10-evdev.conf (probably the first section containing  MatchIsPointer "on" ). I do not know the exact syntax, just read man evdev.

Thank you!

I've now edited my 10-evdev.conf 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

So everything is working as expected then, thank you again!


PGP key: 30D7CB92
Key fingerprint: B597 1F2C 5C10 A9A0 8C60  030F 786C 63F3 30D7 CB92

Offline

Board footer

Powered by FluxBB