Turn on Do Not Disturb while using certain apps

I'd like to have Do Not Disturb enabled when I'm using either of two apps that I use for presenting to clients because I don't want a text message to pop up during a meeting.

I've set a keyboard shortcut to toggle DND in the Mac system preferences but I'm struggling to figure out the series of triggers and conditions that will turn it on when I launch one of the apps and turn it off when quit the app. I need to make sure that it doesn't turn off until both apps are quit.

Thanks!

Here is a macro that will do what you want automatically. When specific applications are launched, Do Not Disturb is enabled. When any of the specific applications are quit, it will only disable Do Not Disturb if all of the applications are not running.

In this macro, I have configured Safari and App Store as the applications. Obviously you would change these to the apps you wish, but just make sure to change both locations. There is a comment in the macro explaining it in more details.


Toggle DND when running specific apps.kmmacros (10.3 KB)
image

3 Likes

Thank you very much. I've adjusted the macro to reflect my apps but it seems that there is something broken. When I open one of the apps, the Notification Center opens but DND does not get turned on... Do you know if this works with Mojave?

Hi @jessestarrphoto, it doesn't work for me under macOS Mojave either.
But you can try the macro of @ccstone:

Hey @jessestarrphoto,

What happens when you manually Option-Click the Notification Icon in the Menu Bar?

On macOS Sierra10.12.6 this will toggle the DND status On/Off.

Mojave has played havoc with macOS automation in a variety of respects in the name of security.

Try this macro:

Option-Click Notification Icon v1.00.kmmacros (6.4 KB)

If it works then you should be able to incorporate it into the other macro.

-Chris

Well, the script didn't work but I did figure out a way to use the 'Click at' action to make this work using an Option-Click. So, thanks for the help!

In MacOS Mojave 10.14.6 macro doesn't work :frowning:

hello @jessestarrphoto

would you be able to share the updated macro that works for Mojave?

Thank you!

To make Onan’s macro work again with macOS Mojave:

1​) Set a shortcut to toggle DND in System Preferences > Keyboard > Shortcuts:

13-pty-fs8

2​) In @Onan’s macro from this post, just replace each of the two AppleScript actions with a Type Keystroke action:

40-pty-fs8

Obviously, the keystroke must correspond to the shortcut you’ve set in System Preferences.

With this modification the macro works fine for me under Mojave 10.14.6.

4 Likes

So helpful for pandemic-era teaching (I'm triggering w/ zoom and Camtasia).