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.