Created
January 15, 2021 18:01
-
-
Save paulrudy/822d1fd30ab18ff619ec77c45daf7629 to your computer and use it in GitHub Desktop.
Revisions
-
paulrudy created this gist
Jan 15, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ #!/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.