Fix monterey detect DND status#27
Conversation
|
Thanks for this work! Do you happen to know if this works for older versions, too? I'd hate to break this library on older macOS versions. |
|
Package already worked for BigSur and prior versions. My changes just added support for Monterey. |
|
@felixrieseberg do you still have concerns preventing to merge this? |
|
I tested it on BigSur and Monterrey. On ARM and on Intel. It was working like a charm. |
|
@felixrieseberg @MarshallOfSound - friendly reminder - please take a look
|
|
Sorry for the delay - and thanks for the email! |
|
fixes issue #26 |
|
could this be bumped in |
|
I thought I would add that this does not work in Sandboxed apps, where they do not get direct access to ~/Library. In a sandboxed app, this results in errors: The "correct" way to do this is to:
Example: Which results in a request to query the status, and then a console output of: I don't have time at the moment to implement this in macos-notification-state, but hopefully in the future I will free up to do so. |
|
@schetle It seems that the |
|
@tboulis It was long enough ago that it's likely changed. You can review the documentation for the INFocusStatusCenter to determine what is required as of today. |
Hello,
@felixrieseberg @MarshallOfSound
com.apple.ncprefs approach no longer works for Monterey.
And actually there could be issue - if you updated to Monterey with DND turned on - ncprefs will still have userPrefs with DND enabled value (MacOS even not erased it on update).
During some investigation i found that there is "~/Library/DoNotDisturb/DB/", which contains all DND setting state.
It updates immediately after manual/scheduled change of DND status. So, for Monterey i added logic to read it instead of ncprefs.
Probably its not proper fix, but anyway it works.
Feel free to provide better solution.