There is no per-app Do Not Disturb in macOS.
The closest you're probably going get to this is retrieving the enabledRemoteNotificationTypes
method of NSApplication
This returns a NSRemoteNotificationType
value, which contains a bitmask whose values indicate the types of push notifications that the app requested.
The possible values are:
NSRemoteNotificationTypeNone
- The app should not display a badge.
NSRemoteNotificationTypeBadge
- The app should display a badge.
NSRemoteNotificationTypeSound
- The app should play a sound.
NSRemoteNotificationTypeAlert
- The app should display an alert.
This is only going to be useful for the current running app and you can get more info from the Apple Developer site
Another potential place to look:
You can find the SQLite database that NotificationCenter uses at in following directory:
getconf DARWIN_USER_DIR
+ /com.apple.notificationcenter/db
, however do be careful, as mine wasn't in /db
, the latest version was in /db2
Prior to Yosemite, this file was located at ~/Library/Application\ Support/NotificationCenter/
I haven't gone through this database so I can't tell you whether or not applicable settings reside here, but it's a good place to start looking.
If you're publishing your app on the App Store, you probably won't be able to use this method because of sandboxing, but it's worth a try either way.