Disable when using MacOS menu bar

Is there a way to disable my macros when typing on menu bar apps?

I have macros for Mail but when I open a calendar app I have on the menu bar KM still thinks I am in mail.

There is always a way. The question is whether the way is efficient or easy.

I don't have an easy or efficient way, but (barring a better answer from other people) what I would do to solve that specific problem is I would start my macros for the Mail app with the following code:

This way, if the macro sees the string "May 2024" it would abort.

This may not solve your problem because you may be asking for your macros to be disabled no matter which Menu Bar you are activating, but you didn't say that, so I'm proposing this solution.

The OCR in macOS is extremely fast and accurate. Just make sure you specify "Apple Text Recognition" as I did above.

Please give some more details about what the problem is in practice, that is, what goes wrong.

I guess that:

(1) You have a macro group which is active only when Mail.app is the foreground application.
(2) When you interact with some menu bar applications, you can end up triggering one or more of that macros that you have set up within that group.

If that is the situation, the simplest solution would be to replace the triggers.

Alternatively, I could suggest a way to use a keyboard shortcut to pause Mail.app and open the desired menu application. You would then need to resume Mail.app. I can give details if you need them, but... I am not yet convinced that a fiddly approach like that would be necessary (or wise). Tell us more. :wink:

Definitely dont want to stop and start the shortcuts. Here are my triggers, let me know if tey can be changed to fix:

Using single letters as triggers is generally a bad idea, even with replacements like yours where it just passes through KM if the menu doesn't exist. Why? Because if you're typing at a somewhat normal "touch typist" speed, you'll find that you often wind up with transposed letters, or letters in the wrong spot, because KM took more time to process your macro than you gave it before you typed the next letter.

This seems like a ton of work to avoid pressing one additional key to activate the macro, but if it's a matter of reach of your hands or some other issue, then maybe consider using a modifier key tapped trigger, which you can do with the USB Device Key trigger:

In theory, this is more key presses, but you don't have to hold the modifier down. Remove the "Otherwise" from your macro and just have it send Command-R, and then you'll have your normal keyboard back with no macro processing.

Are your single-key macros all about this, just trying to get out of holding down one key while typing another?


I wondered if that might have been the problem. Yes, using a letter of the alphabet, with no modifiers, to trigger a macro is in general almost asking for trouble. :wink:

If activation using a single key is important, @Jaime_Schuster, here are just a few of the other options:

  • Use a function key, if you don't need to use it for anything else.
  • The same idea but using a key on a number pad (e.g. "3" on a number pad is not the same key as "3" on the top row).
  • Use an external device such as a Stream Deck.
1 Like

Or use the free version of Stream Deck Mobile for iOS or iPadOS which lets you create six buttons for free on your iPhone or iPad that work like hotkeys.

Or use my OCR detection code, above.

I think, given they would never know what might appear over there, it'd be better to use a "not found image" showing the buttons on the toolbar that are there when nothing is dropped down.

But still, they'd be left with the original issue of not being able to really type well, trying to pass single characters through a macro every time.