When an App Intent lives in the host app and runs the app intent “in the background” on macOS, it still launches the app and puts it in the Dock.

Technically that makes sense, because that’s just how Mac apps behave when launched. But it doesn’t really feel like background execution to me.

@simonbs not always true, its got to depend on some setting probably Activation Policy. I know because I wasted a good hour last night before realizing that the reason my Shortcut wasn't working was because the system launched a version of the app behind my back.

@paul Interesting! No combination of `supportedModes ` and `openAppWhenRun` seem to prevent my app from running on macOS.

Maybe setting a Activation Policy will do but then I’ll need to detect if the app is run from a shortcut or not and set an appropriate activation policy.

@simonbs FWIW this was Cocoa app…
@paul @simonbs There is definitely a special launch mode for background intents that hides the app on Mac. Drafts has many openAppWhenRun=false/supportedModes=[.background] intents that work that way and Drafts show up in Activity Monitor but not the Dock if it wasn’t already running.
@paul @simonbs Also AppKit. So maybe something in the SwiftUI lifecycle?
@agiletortoise @paul @simonbs Yes, in my experience with my AppKit app, if it gets launched in the background triggered by an intent, AppKit sets an activation policy if .prohibited. If it later gets foregrounded, then it switches the policy to .regular.