Return to current app after running from a share sheet

Is there a way to always return to the shared-from app after using a Shortcuts share-sheet URL scheme action? Or is this limited to parameterized apps?

I have a variety of shortcuts that end with the opening of a URL scheme address. The result of this action, of course, is to end up in the resulting app. I can use a shortcuts:// callback URL to go back to Shortcuts, and I can launch Springboard to return to the homescreen, but it’d be really nice if there was a way to identify the current app and return to the screen I shared from originally.

I know I could use URL schemes to achieve this with specific apps. So, arguably, I could create some kind of If block function that recognizes certain kinds of content and selectively returns to common apps. But it’d be better to not have to manually set up each of those options, and to be able to return to apps that don’t have URL schemes!

I can’t fathom how to achieve this universally, but it seems like it should be possible. I feel like I’m overthinking it.

There is AFAIK no way of detecting the app from where the share sheet is opened.

Tough you can end your shortcut with a Choose from Menu action and build in your most used apps and open them with the Open App action. I just tried to assign a variable to the field where you select the app but it didn’t let me. A workaround would be by editing the underlying plist file. You could add the variable Ask when Run and try if that works.

Thanks, by the way. I haven’t tried editing Shortcuts plists before but it is probably the closest I’ll get.

Otherwise I suppose a menu/list with the most common apps I call these shortcuts from and then pre-defined Open App actions would be okay—only a couple extra taps.