-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get DND state (as setting DND state) is not working anymore on mac os v.11 (Big Sur) #9
Comments
I.e. there does not seem to be an officially supported way. I delegate toggling DND (not idempotent!) to BetterTouchTool until I find a better solution. sindresorhus/do-not-disturb#9
took a look at the issue, here is where I THINK the value is, but I'm stuck trying to update the UI to apply the change (works with logout though) |
value for key
|
sharing here as many others will surely stumble upon this thread. here's the Objective-C version of parsing that nested plist, also handles the scheduled prefs: felixrieseberg/macos-notification-state#15 |
@a7madgamal any luck on updating the UI after the change? I tried something similar to commitChanges with a 'com.apple.ncprefs' appid / notification name but couldn't get it to work |
Thanks for sharing, I found out the commands to trigger the new state. Just use your commands to enable or disable followed by:
Works perfectly on macOS 11.1 ;) Edit: I added a second kill command as it seems necessary if triggering the dnd for the first time after reboot. |
Nice one @tiiiecherle thanks for posting this! |
@mellson You're welcome, I'm glad I could help. I was trying to find a solution myself when I found this issue and @a7madgamal 's solution. After quite some time today I also found out how to get the correct values on the command line...
or
|
For those looking for a standalone solution, I’ve studied options out there (including this thread; thank you all for the previous research) and made a script which works robustly. It doesn’t require additional software (everything ships with macOS) and is only for Big Sur. If you use Homebrew, you can install it with |
@vitorgalvao For anyone who needs them in a shell script, this works for me in zsh with the new additions:
EDIT: I updated the functions after some testing. They seem to work reliably now. |
@tiiiecherle thanks for this! I've used this in this script to automatically stop and start Do Not Disturb when Zoom calls are running, seems to be working well! https://github.com/karlhorky/do-not-disturb-during-zoom-macos |
@karlhorky You are welcome. I'm glad I could help. Big credits and thanks go to everyone who posted here and gave the needed ideas and input, e.g. @a7madgamal and @vitorgalvao |
Edit, see comments below:
|
@karlhorky @tiiiecherle For me both enabling and disabling do not work on Monterey. Focus mode/DND stays the way it is set via the UI. |
@agross interesting, wonder what's different between your system and mine. Here's the script that I am using to trigger that code: https://github.com/karlhorky/do-not-disturb-during-zoom-macos |
@karlhorky I don't know either, but I have two Macs that show the same behavior. Getting the DND status does not change regardless of the Focus Mode setting. |
Yeah weirdly enough, the solution from @tiiiecherle stopped working for me on Monterey... 😫 Maybe it never worked, and I just tricked myself into thinking it was working... |
It’s not weird at all. Programmatically setting Do Not Disturb isn’t simple and Apple keeps breaking methods we come up with. Big Sur required a whole new method, and so will Monterey.
Seems like the likeliest explanation. |
Ah, just came up with an easy and elegant solution using macOS Monterey Shortcuts 🎉
Screenshots / videos: kap3.mp4 |
I’ve been thinking the same, that Shortcuts would be the solution going forward. At least we no longer need to worry about Apple breaking our solutions every time. Though that likely does not provide a way to check the state of Do Not Disturb. I’m still on Big Sur so can’t check. |
Right, that makes sense, although apparently SiriKit can query the state - also macOS via Mac Catalyst 15.0+ (the |
To get Do not Disturb state: vitorgalvao/tiny-scripts#206 (comment) |
Thanks to everyone for all the updates and the hints. I also decided to go with the Shortcuts.app when using macOS12 and updated all my scripts accordingly. Checking status and turning on and off seems to work reliably after some testing and a first time configuration of the Shortcuts.app. |
WIth this Shortcut, you can give it as input shortcuts run 'Calm Notifications' <<< 'on' |
@vitorgalvao Thanks for the hint. I am not an Alfred Powerpack user, but I will keep it in mind. |
That’s why I shared the link to the relevant file. While I do provide it as part of an Alfred tool, it can be downloaded and used independently. |
Thanks, but how and where do I install the workflow? Alfred states on it's website that you have to be a powerpack user to use workflows. |
Hey folks, I've created a library for shortcut-based focus mode management. @vitorgalvao I've used your shortcut if you don't mind) Thank you 🎉 🎉 🎉 |
I hope I've fixed that for the next version, need to check in the next 4.6.11 beta when it's out. |
getDoNotDisturb is not working anymore on mac os v.11 (Big Sur) since they removed ~/Library/Preferences/ByHost/com.apple.notificationcenterui setting
The text was updated successfully, but these errors were encountered: