I would like to write an Alfred workflow that shows a list of focus modes and lets the user select one to make it the focus. I have looked around in ~/Library/DoNotDisturb/DB
but cannot find a list anywhere. Does anyone have any ideas?
I started working on exactly the same sort of Alfred workflow last year - I ended up in the same location as you, and the list is there, but you have to do some processing to parse it out of the available data. My in development workflow, “Lens”, works to the point of producing a list of focus modes.
Where I left it was at the point of being able to set a focus mode by name. At the time I couldn’t find a way to easily do it, and I note that even in the latest Shortcuts, you can’t set a focus mode by name.
Someone else tried for a generic solution (a node.js solution) at around the same time and the result was similar.
I do have an idea of how it might be possible (without UI scripting), but I haven’t put any further time into researching it … yet. When I’ve cleared some other things from my to do list I plan to take a closer look - but it may amount to nothing.
If you get a list of focus modes, do you already have a way to set the focus mode already in mind?