Last active
February 5, 2020 15:29
-
-
Save talkingmoose/20848f9b06a684c8d0a4b12ec67ee623 to your computer and use it in GitHub Desktop.
Under Apple menu > System Preferences > Notifications > Do Not Disturb: Enables Do Not Disturb and sets time range from 7:01 a.m. to 7:00 a.m., effectively disabling macOS Notifications.
This file contains hidden or 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 | |
# get currently logged in user | |
currentUser=$( /usr/bin/stat -f "%Su" /dev/console ) | |
echo "Current user is $currentUser." | |
# set Do No Disturb for the current user to enabled between 7:01 a.m. and 7:00 a.m. | |
su "$currentUser" -c "defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.plist dndEnd -int 420" # minutes | |
su "$currentUser" -c "defaults write ~/Library/Preferences/ByHost/com.apple.notificationcenterui.plist dndStart -int 421" # minutes | |
exit 0 |
Author
talkingmoose
commented
Feb 5, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment