Skip to content

Instantly share code, notes, and snippets.

Created Oct 24, 2017
What would you like to do?
Do Not Disturb
set -eou pipefail
# From and
if [[ $(defaults -currentHost read ~/Library/Preferences/ByHost/ doNotDisturb) -eq 0 ]]; then
defaults -currentHost write ~/Library/Preferences/ByHost/ doNotDisturb -boolean true
defaults -currentHost write ~/Library/Preferences/ByHost/ doNotDisturbDate -date "`date -u +\"%Y-%m-%d %H:%M:%S +000\"`"
killall NotificationCenter
echo "Do Not Disturb is enabled. Run $0 to turn it off (OS X will turn it off automatically tomorrow)."
defaults -currentHost write ~/Library/Preferences/ByHost/ doNotDisturb -boolean false
killall NotificationCenter
echo "Do Not Disturb is disabled. Run $0 to turn it on again."

This comment has been minimized.

Copy link

@dylan-chong dylan-chong commented Mar 9, 2019

Dnd doesnt appear to be changed on high sierra/mojave with this solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment