Any Way to Enable a Focus Mode Directly From KM?

I would like to enable a specific focus mode on my Mac using Keyboard Maestro. I know you can do this using a shortcut, however when doing so, it’s very slow 15-20 seconds to propagate to my other devices. That said, I would like to do it directly from KM using either a built in action or AppleScript. Does anyone know how to do this?

Thanks you :grinning:

How do you do it manually?

I came wanting to ask the same question: can KM change the Focus mode? Typically, manually, this is done in the top right menu bar, when you click on that icon (sorry don't know its name) that gives you a pulldown interface to configure focus mode as well as other system-wide things (wifi, screen mirroring, sound, etc.) Screenshot:

Screenshot 2023-11-23 at 3.09.26 PM

I'm constructing a KM macro that executes several commands in a row that get me ready to do a voiceover recording -- load this file, go into Do Not Disturb mode, load this other file, arrange the windows like this, etc. So being able to put the computer into a Focus mode would be a really nice capability. (Of course it can be done via mouse x/y clicking, but if there's a more foolproof way, I'd like to do that.)

The easiest way is a shortcut that is called from keyboard maestro

1 Like

The only problem with this method is that when changing a focus mode via a shortcut, it can take upwards of 20 seconds for it to propagate to other devices. Normally, that’s not a problem unless you are using focus modes as a trigger for other time sensitive automations like I am.

Focus modes propagating slowly from macOS to iOS is an Apple problem. Perhaps we could trigger your other automations in a different way, or run them on a different device?

1 Like

The problem is that I have an automation that needs to run on my iPhone as a personal automation. Since there is no trigger tied to HomeKit devices, the only work around is to trigger a focus mode which can be tied to a shortcut. Not pretty, but it does work… :grinning:

Two points of interest:

• Toggling a focus mode off from a shortcut only takes approximately 3 seconds to propagate vs 15-20 when turning a focus mode on.

• Toggling a focus mode manually on any iOS or Mac device propagates almost instantly.

Given the menu is always in the same spot (unless you're adding/removing foci on regular basis), couldn't you use "move and click" actions to emulate what you do when you're setting it manually? Move to the proper area of the screen, click the mouse to see the pop-up with the Focus button, move and click the Focus button, wait a tiny bit, then move and click the focus you want to use?

Given that that location is fixed onscreen, and I don't think there are any icons that can make it move, this should work reasonably well.

(I don't use Focus mode at all, but I do know where it resides, and it seems that should work.)

-rob.