Philip Young
As of macOS 11 or later, it is better to rely on Apple Shortcut to turn on/off Do Not Disturb instead of relying on this Applescript hack.
You can follow it here.
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:
Let's get started.
If you have Cresent Moon icon (Do Not Disturb) on menu bar, you can skip this step. Otherwise, please follow the gif:
Do Not Disturb
Do Not Disturb
text header into menu barSystem Preferences
> Keyboard
> Shortcuts
> Mission control
Turn Do Not Disturb On/Off
checkbox.CMD + SHIFT + OPT + CTRL + D
key combination while the input is focused.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.
You're going to download a code to toggle the Do Not Disturb. It basically does this:
CMD + SHIFT + OPT + CTRL + D
keyboard shortcut with code.CMD + SHIFT + OPT + CTRL + D
to turn off the Do Not Disturb.Download the pre-made AppleScript code here
zip
file on Session's AppleScript folder.session_start.scpt
, session_end.scpt
, andstop_working.scpt
on your Mac Desktop
temporarily.open appple script folder
on Session's setting page.Preferences
> Automation (AppleScript)
,Session start
checkbox,Session end
checkbox,Stop working
checkbox,Test session start
,Test session end
,Test stop Working
,If it didn't ran, make sure you have put the script in correct location. Refer to screenshot above. Otherwise, you can contact us on our email
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!