MacOS Shortcuts – Restore previous Focus mode after switching to Do Not Disturb

0
1
MacOS Shortcuts – Restore previous Focus mode after switching to Do Not Disturb


I’m trying to build a Shortcut for switching to Do Not Disturb for a given number of minutes. Afterwards, the previous Focus mode should be restored.

For example, I have a mode called "Work". When starting the Shortcut and providing 1 minute as input, I want it to switch to Do Not Disturb for 1 minute, and switch back to Work afterwards.

My problem is that restoring the previous Focus mode does not work. Instead, DND turns off as expected, but then it turns on DND again, and not the previous Focus mode.

Here’s how my Shortcut currently looks:

MacOS Shortcuts – Restore previous Focus mode after switching to Do Not Disturb

I added Speak as debug output, and it correctly outputs "Work" for the example described above, both before prompting for input, as well as after waiting till DND is over.

I also added additional 10 seconds of waiting, to make sure I’m not running into race conditions, but that doesn’t change anything.

Does anyone know how to restore the previous Focus mode correctly?