0

I love XInput mouse wheel emulation! Evdev Wheel Emulation can enable on any mouse button by running bellow command (9 is the mouse button that trigger Evdev Wheel Emulation)

xinput set-prop $DEVICE_ID "Evdev Wheel Emulation Button" 9

I use it for almost 5 years and realy thankful to xorg guys who implement this great feature. Now I want to change the trigger from a mouse button to a keyboard key. Say I want to enable trigger emulation when I hold "H" key and disable when I release magic "H". How can I do that?

Tested Solutions That Not Worked

I tried to map a keyboard key to a mouse button 9 but pressing button 9 wont do the tricks. It seems that Evdev wont stimulate by a synthetic mouse button press. I create a script that when a magic "H" key pressed it run xdotool mousedpown 9 and run xdotool mouseup 9 on release of the key. I can confirm script do what it supposed to do by changing button from 9 to 1 (aka left click) and see holding "H" on keyboard will hold left click down but no hope on Evdev Emulation

0

The easy way is to create a virtual pointer with uinput module and python. then create a script to emit mouse button in virtual pointer on key press on keyboard.

I wrote a full explanation on my blog. If you need more detail you can check it out

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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