Why does Obsidian jump in and out of focus when a workflow is running?
Short answer: Obsidian going in and out of focus (i.e. coming to the foreground, then going to the background again) is an unfortunate side effect of Actions for Obsidian translating between Obsidian and Shortcuts, and the way the Obsidian API is set up (no blame intended!) — and as of the time of this writing, I don't think there is any other way to do it.
Some more background: Obsidian's API is URL-based. Just like a Safari deals with URLs starting with
https://, Obsidian handles URLs starting with
obsidian://, and those URLs contain the information what to do.
So, the only way to communicate with the Obsidian API is telling iOS to open an
obsidian:// URL. iOS will then launch Obsidian (or bring it to the foreground if it is already running). Obsidian then returns its answers to AFO the same way, because due Obsidian provides no other communications channel. It's impossible for an app like mine to move this work into the background. (And I've tried basically everything.)
If you want to know the background and learn about the struggle (it's real!), continue to Why do the AfO actions behave differently than most other apps' actions?. 😉