Wanted: A DND (Do Not Disturb) Macro that Works with Monterey

I need a Do Not Disturb macro that toggles Focus on Monterey.

None of the ones posted in this form work for me. I think that's because Monterey changed from DND to Focus mode.

Turning Focus off is like a toggle, but when you turn it on you have to decide which of several options you want to turn on. So that's not really a toggle in that direction. Which Focus option do you want when it's turned on?

I recently uploaded a macro that turns Bluetooth off and on by clicking on the Bluetooth icon in the system menu at the top of the screen. I could adapt that macro to solve this, but I realize it's much better to get an AppleScript solution. So I'll wait to see if someone gives you that.

Actually, I found a solution that doesn't require Keyboard Maestro. macOS Monterey makes it super-easy.

  1. Load System Preferences.

  2. Click on Notifications and Focus, then click on the Focus tab.

  3. Now, under Turn on Automatically, click the + sign and add your live streaming apps (e.g., Ecamm Live and Zoom).

Now, whenever you load those programs, your Mac will automatically turn Focus mode on. The best part is that this turns it on across ALL your devices, including iPhone and iPad. When you unload these apps, your Mac will automatically turn Focus mode off.

4 Likes

Ok, great. I didn't know that you had that goal of turning it on when an app activates.

Thanks for this. It gets close, but... that Focus mode only stays enabled when the app is active and frontmost. As soon as I switch to another app, boom, it turns off. Has anyone found a way of triggering a focus mode from within KM and leaving it active (for a while, or indefinitely)?

It can be done, but you have to tell us which Focus do you want turned on. I see by default there are three possible states: Driving, Sleep and Do Not Disturb. Which one do you want to set? If you tell me which one, I can make it happen. There's more than one way to make it happen.

  1. Use KM to click on the Menu Bar to change the Focus. (This requires some finessing.)
  2. Use KM to call AppleScript to change the focus (someone else will have to help you with this choice, as I'm very much a noob with AppleScript.)
  3. Use KM to call a MacOS Shortcut to set the Focus. This requires KM calling a shortcut which you will create in MacOS that will look something like this:

So in my opinion the third option is probably the simplest. Did I give you enough information to continue this on your own, or do you need help writing the KM macro and writing the MacOS shortcut?

2 Likes

That's perfect. Works great. Thank you!

For anyone needing to do this, I implemented this by using AppleScript.

Credit to MacSparky, too. Running a Shortcut from a Keyboard Maestro Script - MacSparky

1 Like

Thanks for showing me how to launch shortcuts with Execute AppleScript. I have only done it with Execute Shell Script.

What I’m looking for is a macro that will turn on DND the moment I do screen sharing in Teams or Webex, even if I’m using Teams and Webex from a browser.

One idea I have is to check whether the Accessibility - Screen Sharing is triggered. I’d assume that when these apps do a Screen Sharing, there’s some switches I can check on.

If anyone knows what the switches to check, I’d appreciate that.

I'm now looking for a way to toggle this: if focus mode is off turn it on to “Do Not Disturb.” If it’s on, turn it off.

Apple Shortcuts has an action called "Get current focus,” but I can't find documentation on how to use it. I'm also not very experienced with Shortcuts.

Does anyone have a solution for this?

Actually, I figured it out:

1 Like