Requesting a method to detect if an end user has enabled Do Not Disturb

Originator:tom.larkin80
Number:rdar://35104343 Date Originated:October 20 2017
Status:submitted Resolved:
Product:macOS Product Version:
Classification: Reproducible:
 
Ability to detect if a user has enabled DnD on their Mac.  My Org has a very large fleet of Macs that the team I work on manages.   We would like to provide the best possible end user experience possible.   Currently there seems to be no consistent way to detect with code if a user has enabled DnD.   There is a way to detect if it is enabled but it seems to be inconsistent.   Example:

$ defaults -currentHost read com.apple.notificationcenterui
{
    doNotDisturb = 1;
    doNotDisturbDate = "2017-10-20 22:01:03 +0000";
}

and

$ defaults -currentHost read com.apple.notificationcenterui
{
    doNotDisturb = 0;
}

This works if I manually switch the DnD on in Notification Center.   What doesn't seem to be written to this file is all the options you can set DnD for.   Scheduled DnD time, if a Mac goes into mirrored screen mode on a projector/Apple TV, if an Application goes into Fullscreen mode, etc.    It also doesn't seem consistent across all versions of macOS.

There also does not seem to be a native Apple API for this looking through the dev documentation.    

The business case for this feature would be the following:
1 - ensure that we never disturb a stakeholder with automation from IT if they have switched on DnD
2 - Mitigate all instances of creating a bad user experience if a user wishes to not be disturbed
3 - Mitigate any failure rates of our workflows where we may depend on an active user session being a dependent.
4 - Allow compliance to the rules the stakeholder sets.   Since there are options in the DnD settings to allow certain notifications through, we would expect those to be respected as the stakeholder sees fit.  We would need to be able to read in what options they have set.

This is a feature request, and not a bug.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!