Created
January 15, 2021 18:01
-
-
Save paulrudy/822d1fd30ab18ff619ec77c45daf7629 to your computer and use it in GitHub Desktop.
Determine whether Do Not Disturb (DND) is enabled (MacOS 11.x Big Sur)
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/zsh | |
dnd_enabled=$(plutil -extract dnd_prefs xml1 -o - ~/Library/Preferences/com.apple.ncprefs.plist | xpath -q -e 'string(//data)' | base64 -D | plutil -convert xml1 - -o - | xpath -q -e 'boolean(//dict/key[text()="enabled"])') | |
echo $dnd_enabled | |
# An output of 1 means Do Not Disturb is enabled, and 0 means it's disabled. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment