How to enable Do Not Disturb mode while Focus is running on your Mac.

Enabling Do Not Disturb mode for Focus on macOS

Focus is extremely flexible because of its BASH scripting capabilities. Because of this, it's easy to add new features & and integrations that weren't originally built into the software.

For example, this is how you turn on Mac OS X's "Do not disturb" mode when Focus is enabled.

Enabling Do Not Disturb mode with scripting

In Focus preferences, go to the "Scripting" panel.

Under the "Focus" section, copy the following three lines and copy them into the text box.

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean true
defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturbDate -date "`date -u +\"%Y-%m-%d %H:%M:%S +000\"`"
killall NotificationCenter

That's it!

Now when Focus runs, it will execute those three commands which will turn "Do Not Disturb" mode on.

Here's a quick explanation of each line:

  1. Enable Do Not Disturb mode
  2. Set the date for when to turn Do Not Disturb off (defaults to tomorrow)
  3. Apply changes by relaunching notification center

Disabling Do Not Disturb with scripting

Turning Do Not Disturb mode off is just as easy.

In Focus preferences, go to the "Scripting" panel.

Under the "Unfocus" section, copy the following three lines and copy them into the text box.

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean false
killall NotificationCenter

This will turn Do Not Disturb mode back on when Focus is done with a session.



Was this blog post helpful? Yes / No

« Back to Focus Productivity Blog
Posted on April 23, 2015



Focus

Drowning in distractions? They're chipping away at your productivity and focus. Fight back with Focus, the macOS app designed to block distractions and keep you on track. Regain your focus, achieve your goals, and find balance. Give Focus a try and see the difference it makes!

Download Focus
Try Focus free for 7-days!