Created
March 6, 2013 22:53
-
-
Save DamnedFacts/5103958 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
-- Uses cleaner syntax than common solutions for toggling the state of the Notification Center in Mac OS X Mountain Lion (10.8) | |
set notificationStatus to do shell script "defaults -currentHost read com.apple.notificationcenterui doNotDisturb" | |
if notificationStatus is equal to "1" then | |
do shell script "defaults -currentHost write com.apple.notificationcenterui doNotDisturb -boolean false" | |
do shell script "defaults -currentHost delete com.apple.notificationcenterui doNotDisturbDate" | |
do shell script "launchctl stop com.apple.notificationcenterui.agent" | |
else | |
do shell script "defaults -currentHost write com.apple.notificationcenterui doNotDisturb -boolean true" | |
set theDate to quoted form of (do shell script "date +\"%Y-%m-%d %I:%M:%S +0000\"") | |
do shell script "defaults -currentHost write com.apple.notificationcenterui doNotDisturbDate -date " & theDate | |
do shell script "launchctl stop com.apple.notificationcenterui.agent" | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment