Last active
June 16, 2017 12:16
-
-
Save romashamin/5a5661f430b9ddd18564282e986f5d94 to your computer and use it in GitHub Desktop.
Enables ‘Do Not Disturb’ for 10 min
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
my setDoNotDisturbON() | |
say "Do not disturb is on now" using "Samantha" | |
delay 600 | |
my setDoNotDisturbOFF() | |
say "Do not disturb is off. Welcome to hell!" using "Samantha" | |
on setDoNotDisturbON() | |
tell application "System Events" | |
tell application process "SystemUIServer" | |
try | |
if not (exists menu bar item "Notification Center, Do Not Disturb enabled" of menu bar 1 of application process "SystemUIServer" of application "System Events") then | |
key down option | |
click menu bar item "Notification Center" of menu bar 1 | |
key up option | |
end if | |
on error | |
key up option | |
end try | |
end tell | |
end tell | |
end setDoNotDisturbON | |
on setDoNotDisturbOFF() | |
tell application "System Events" | |
tell application process "SystemUIServer" | |
try | |
if exists menu bar item "Notification Center, Do Not Disturb enabled" of menu bar 1 of application process "SystemUIServer" of application "System Events" then | |
key down option | |
click menu bar item "Notification Center, Do Not Disturb enabled" of menu bar 1 | |
key up option | |
end if | |
on error | |
key up option | |
end try | |
end tell | |
end tell | |
end setDoNotDisturbOFF | |
# src: https://github.com/johnotander/do-not-disturb/blob/master/index.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment