Can I Capture/Override a Key?

Is there a way to add a macro that will stop a keyboard input from being presented to applications?
basically I use apple-1,2,3,4 for switching desktops on my mac. I've used those keys for decades going back to various unix/linux systems. I don't want to remap them.

Problem is one of the applications i use on a daily basis also uses those keys - and has no way to remap them. Can i use KB Maestro to make sure that app doesn't receive the keystrokes?

If I'm understanding correctly your need, you may set that key as a trigger, and leave the macro blank (i.e., without any actions).

Put this macro in a macro group which is activated only when that application is active.

KM will capture that key press trigger when the application is active, but it will do nothing because there is no action in the macro. Or you can make it to do anything else you want by adding actions.

Yea I just tried that - the problem is the underlying application still gets the shortcut when i press it. So even though it changes workspaces, the app that i dont want being effected does what it does when you press one of those keys.

I want to try and make it so the macro will never let that app even see that the key was pressed

That's interesting. I've never seen anything like that. Normally, when the shortcut is captured by KM, applications won't be able to see it. I have no idea what else can be done. Maybe you can contact the developer of the app to see if they could make the shortcuts customizable...

See this:

Maybe you’re using a USB Device to generate the keystroke?

It's a usb keyboard - but i have the macro triggered by a hot key.
Did a quick test just making a macro triggered by apple-2, all it does is bring up an alert. When i press it - the offending app still does its annoying shortcut from apple-2, and the alert comes up

What’s the app you’re using?

This: https://tryshift.com

it shows a bunch of different email clients/services/etc in a single window - but hitting apple-2 (or other numbers) switches its view which i dont want it to do

@martin is absolutely correct about hotkey trigger not being seen by apps so there’s something else going on.

Can you post the macro you used to do the test please?

If you’re not sure how have a look at this:

sure - the macro im testing with is very simple:
test.kmmacros (1.5 KB)

the keyboard shortcut goes through to mac os as well because my workspace changes (mapped to apple-2 in system prefs) as well.

i would love for this app to have customizable shortcuts and ive requested it numerous times but they dont really seem to care.

The Hot Key trigger will swallow the key and only perform the hot key action.

However, multiple applications can register for the same hot key, in which case the key is swallowed and both applications are notified and so both actions will happen.

It sounds like this is what is happening, that this problematic application is using the keys as hot keys (do they work even when the application is not at the front, that would be a giveaway).

Keyboard Maestro cannot resolve this for you, your only options are:

  • tell the offending application to stop or change its hot keys
  • if that is impossible, report the problem to the application developer and hope for a solution
  • don't use the the offending application
  • use a tool like Karabiner to remap the command-1,2,3,4 keys to something else, and then change the switch desktop keys to match that.
1 Like

thanks - yea i was kind of thinking it was going to end up this way. There's a lot this app does to take over things i dont think it should take over that the devs dont seem to care about or want to listen to me on...

bummer because i really like the overall functionality besides that! anyway, appreciate the help