Make KM "consume" mouse click

I have this macro to zoom screen out on cmd+option+RMB. The thing is the mouse click "falls through" and the frontmost window registers it as a right mouse click. Is it possible to "consume" the mouse click and not let it pass through?

thanks

I have two possible approaches:

FIRST APPROACH

The short answer that most people will give you is "no" but I have a different answer, and I have achieved exactly what you are trying to do.

My answer works if your mouse has software that lets you redefine your mouse buttons. If you have such software, then this should be achievable. What you would do is redefine the mouse button that you "want to be ignored" to some new USB key code that is ignored by the app in question. That's how easy it is. (Although I didn't try it with modifiers, as you are doing. I just did it with the primary mouse button.) If your mouse isn't a "smart mouse" with software that lets you program its buttons, then you will have to get a different mouse which does have this feature.

On the downside, when I did this, I felt a slight "lag" between my clicks and the response on screen. So if you are trying to do this for something like an online shooter game that requires ultra-fast response time, this solution may not be satisfactory. (I'm not saying the lag was horrible, just that it was noticeable.)

SECOND APPROACH

You will still need a mouse with software for redefining the mouse buttons, but instead of defining the mouse button as a USB key code, you could define it as an ASCII character (preferably a key that's not already on your keyboard.) If you do that, then you can use the KM Hotkey trigger instead of the USB Device Key trigger and doing that will cause KM to "consume" the key and not let it pass through.

I didn't test this approach so I'm not sure if there will be a "lag" issue here.

Thanks. I have a plain USB mouse that is plug and play and has no software whatsoever. Fancy mice with software are usually too big for my hand.

It's a bit odd that KM does not do this by default. On the PC side, Autohotkey lets you specify whether whatever keyboard/mouse input you are intercepting get passed through to the system.

In general, if KM can't do something simple, it's because Apple hasn't released a public API for it. It's a design principle to ensure that KM is always compatible with macOS into the far future.

2 Likes

Give Steermouse a try -- as a driver, it can intercept mouse button presses rather than pass them through. And it does a whole bunch more that you'll likely find useful.

There's a 30 day trial, so you can test for compatability with your mouse and give it a fair shake before deciding. And, IIRC, you can set profiles for different apps (or, at least, easily switch between profiles) so you can have the right mouse button do this in this app and that in that one.

1 Like