Created
March 1, 2017 17:59
-
-
Save joshgachnang/cf376c9fe75f7702add292f3befa4500 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will turn on and off do not disturb mode in OSX. I use a cronjob to trigger this during my scheduled focus times. | |
if [ "$1" == "off" ]; then | |
defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean false | |
killall NotificationCenter | |
echo "Disabled Do Not Disturb mode" | |
elif [ "$1" == "on" ]; then | |
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 | |
echo "Enabled Do Not Disturb mode" | |
else | |
echo "Usage: donotdisturb.sh [on|off]" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment