Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save du-song/4711924 to your computer and use it in GitHub Desktop.
Save du-song/4711924 to your computer and use it in GitHub Desktop.
Disable & Re-Enable Notification Center Alerts and Banners
do shell script "defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist doNotDisturb -boolean true"
set theDate to quoted form of (do shell script "date +\"%Y-%m-%d %I:%M:%S +0000\"")
do shell script "defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist doNotDisturbDate -date " & theDate
do shell script "killall NotificationCenter"
do shell script "defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist doNotDisturb -boolean false"
try
do shell script "defaults delete ~/Library/Preferences/ByHost/com.apple.notificationcenterui.*.plist doNotDisturbDate"
end try
do shell script "killall NotificationCenter"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment