Focus Mode Turns on and off

I only use Slack for work. So this seemed like an obvious trigger for my Work focus mode. BUT I actually work OUTSIDE of Slack. So while the window is open on my desktop, a completely different window is active. And whenever the Slack window is not the active window, the focus mode turns back to normal.

I want an option where the “Work” focus mode would turn on when I opened/activated Slack and turned off when I turn off Slack. In other words, if the app is running, I’m working, otherwise I’m not.

I have another focus mode I use when using Scrivener or ProWritingAid, but again, the trigger only works if I never leave the app. And while I’m more single-app focused when I’m writing, I still do research in apps like Firefox too.

I thought “hey! Keyboard Maestro” - which yes, it has the trigger I want, but it hasn’t AFAICT added focus mode switching as an action.

Thoughts? Suggestions?

Use Keyboard Maestro to trigger an appropriate shortcut, which then changes the focus mode using the Set Focus action.

Yay! I was hoping there would be a “duh, Jenn, you shoulda thought of that!” solution, and there was!