How to open browser links in background from email client?

I switched from Airmail to Spark as my email client, and miss the feature where links would open in the background for later reading. Been trying to implement similar behavior via KM. How can I create a trigger that basically says "If browser launches after email client window was active, pause 5 seconds [for page to load] then go back to previous application"?
I've tried a number of things but they often start with something that runs periodically, and that's not what I want. The trigger should be when the browser activates and takes focus away from the specified email app. Is that possible, to name the previously active app? Do I need to parse content from the app switcher? Something like "if %Variable%%last active app% = "Spark""?

There's a token that contains the previous application name, so all you need to do is test if it contains Spark when your browser activates:

Example Macro.kmmacros (2.7 KB)


I haven't used Spark, and I didn't see anything on the developer's site, but does it perhaps replicate the Apple Mail feature whereby you can Command-Click a link to open it in the background?


Good catch. I just tested that and confirmed that a command-click does indeed work the same in Spark as in Apple Mail, so the only reason to use a macro for this would be to make it the default behavior.

1 Like

Thanks very much to both of you. I like both solutions. Wish I could mark them both.

Sorry to resurrect this thread after 3½+ years of inactivity, but the macro provided by @gglick above almost works for me and I need a bit of assistance.

My email client is the latest version of Outlook for Mac v16.76. When I click on a link within an email, the macro does exactly as advertised. The problem I'm running into occurs when I later click on Safari to take a look at what the link opened. The macro then kicks in and brings Outlook to the front again, covering the Safari window.. I've tried everything I know to suppress that from happening, but no success.

If anyone can assist with a suggestion it would be greatly appreciated. Thanks...