iPhone 15 Action Button Contextual Shortcut

I was inspired by a comment that Viticci made on a recent episode of Connected where he was talking about his vision for the Action Button on iPhone 15. I knew that focus mode was an obvious choice for the AB, but when he mentioned doing something specific if an app was open it kind of blew my mind. But then I ran into the most obvious issue, Shortcuts has no way to check the current running app. So I did a workaround automation that updates a Data Jar file every time I open and close OmniFocus. I now have the below automation working, but the other issue is that apps will need new shortcuts to let you do things within the context of the app. Viticci suggested that he could defer a selected task in Things using the AB, but I don’t think there’s a way for OmniFocus to do that since no shortcuts work off the currently selected task(s). I think lots of apps need to make new shortcuts assuming you could be in the app at that moment.

At any rate, sharing my logic in case anyone has thought of something better than me.

Here’s a simple personal automation for when I open OmniFocus. When I close it, a similar action runs to change the text to “Cleared”

And here’s my Action Button Shortcut

My (very simple) shortcut, if anyone is interested: Shortcuts