How do I emulate mouse events?(mac_hid.mouse_button_emulation)

asked 2018-07-30 04:07:39 -0600

RyanWC gravatar image

I am trying to map my keyboard key to a mouse button by adding these lines to /etc/sysctl.conf :

dev.mac_hid.mouse_button_emulation = 1
dev.mac_hid.mouse_button2_keycode = 217

When I update using 'sudo sysctl --system', then run 'xev', it indeed shows that the button registers as a mouse event. However, it will only see the mouse-release event, and never the mouse-press event.

I have tried the same thing in Ubuntu, and it works in that environment. I have also attempted to emulate the mouse button with other keyboard keys, with the same effect.

I particularly need this as it is the best method to convert a keyboard button on my mouse to middle click. xbindkeys does not work well in the applications that I use.

edit retag flag offensive close merge delete


I have a similar problem. I have a mouse with several buttons that I want to assign functions to. I run Wayland instead of xorg. so xbindkeys and xdotool don't work at all. Gnome does not provide a way to map mouse keys. I put in a suggestion at gnome that such a feature would be handy

tablepc gravatar imagetablepc ( 2018-08-23 10:44:13 -0600 )edit