Skip to content

Instantly share code, notes, and snippets.

@paulrudy
paulrudy / is_dnd_enabled.sh
Created January 15, 2021 18:01
Determine whether Do Not Disturb (DND) is enabled (MacOS 11.x Big Sur)
#!/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.