Integrate automatic Do Not Disturb with Session on Mac

Philip Young

IMPORTANT! This tutorial only works on macOS BigSur. Let me know on my email if you've tried this and it doesn't work.

Setting up Do Not Disturb without AppleScript experience is the easiest way to keep you stay focused and out of distraction. Instead of turning it on/off manually, Session can help you automate it.

There are 5 steps to follow:

  1. Add Do Not Disturb Cresent Moon Icon on Menu Bar,
  2. enable Do Not Disturb keyboard shortcut on your Mac,
  3. download the necessary file, and
  4. put it on Session script folder.
  5. Done!

Let's get started.

1. Add Do Not Disturb Cresent Moon on Menu Bar

If you have Cresent Moon icon (Do Not Disturb) on menu bar, you can skip this step. Otherwise, please follow the gif: Keyboard shortcut DND

  1. Press control icon
  2. Open Do Not Disturb
  3. Hold the Do Not Disturb text header into menu bar
  4. Make sure the Cresent Moon icon exists

2. Enable toggling Do Not Disturb with keyboard shortcut

  1. Go to Mac's System Preferences > Keyboard > Shortcuts > Mission control
  2. Enable Turn Do Not Disturb On/Off checkbox.
  3. Double click the input beside the "Turn Do Not..." text Keyboard shortcut DND
  4. Press CMD + SHIFT + OPT + CTRL + D key combination while the input is focused.
  5. Try pressing your new keyboard shortcut and see if Do Not Disturb is turned on/off

Great! Now you can toggle Do Not Disturb with keyboard shortcut! What we need to do next is to tell Session to press that keyboard automatically when Session has started, and when you have stopped working.

3. Download pre-made AppleScript file that turn on and off Do Not Disturb

You're going to download a code to toggle the Do Not Disturb. It basically does this:

  • When Session has started, we check if Do Not Disturb is off. If yes, press CMD + SHIFT + OPT + CTRL + D keyboard shortcut with code.
  • When you stopped working, we check if Do Not Disturb is on. If yes, press CMD + SHIFT + OPT + CTRL + D to turn off the Do Not Disturb.

Download the pre-made AppleScript code here

4. Extract the zip file on Session's AppleScript folder.

  1. Extract the files session_start.scptandsession_end.scpt on your Mac Desktop temporarily.
  2. Copy both files.
  3. Put both file on Session's AppleScript folder. The folder is accessible by clicking a open appple script folder on Session's setting page.

Open AppleScript folder gif

5. Check if the AppleScript is working

  1. Go back to Session Preferences > Automation (AppleScript),
  2. check Session start checkbox,
  3. check Stop working checkbox,
  4. press Test session Start,
  5. make sure it turn on Do Not Disturb.
  6. Press Test stop Working,
  7. make sure it turn off Do Not Disturb.

If it didn't ran, make sure you have put the script in correct location. Refer to screenshot above. Otherwise, you can contact me on my email

6. Enjoy undistracted working

Congratulations! Now Session will turn on and off Do Not Disturb while you're working :)

If you want to quit distracing app like Slack, play spotify playlist—consider learning and writing your first AppleScript. We've made a tutorial for you!