I’ve used Shortcuts on iOS since the Workflow days, but I haven’t been motivated to explore Shortcuts on macOS. For Mac automations, I rely mainly on Keyboard Maestro. Recently, I was sitting in front of my Mac when I had an idea for an iPhone shortcut, so I decided to go ahead and build it in the Shortcuts app for Mac. That’s when I discovered a fantastic feature of Shortcuts on macOS: You can add a shortcut to the Services menu. A shortcut can run Keyboard Maestro macros, so this is roundabout way of adding Keyboard Maestro macros to the Services menu.
At work, I’m often logged into our SaaS application in different browsers using different accounts. When I’m testing email notifications and the email contains a link, I need to be sure to open the link in the right browser. My previous solution to this was a set of Keyboard Maestro macros, each one set up to open a copied link in a specific browser. If I needed to open a link in a browser that wasn’t my default, I would copy the link and press the hotkey for that browser’s macro.
If you right-click a link and select a shortcut from the Services menu, the shortcut receives the link as input. I updated my macros to use the shortcut input (accessible in Keyboard Maestro as
%TriggerValue%) instead of the clipboard. Since Chrome is my default browser at work, I have shortcuts for Safari, Firefox and a Chrome incognito window. The shortcut naively checks that the input is a valid URL (it just has to start with “http”), and then calls the corresponding macro, passing the URL to it. Now all I have to do is right-click the link and select the appropriate shortcut to open the link in a specific browser.
To make these shortcuts useful to a wider audience, I also made versions that don’t rely on Keyboard Maestro. The non-Keyboard Maestro version of the Safari shortcut uses the Open URLs action in Shortcuts. The shortcuts for the other browsers use AppleScript. Even though I don’t need a shortcut for Chrome, I created one to share here. You can download the shortcuts and macros at the bottom of this post. (Although I thought I had tested it successfully, the non-Keyboard Maestro version of the Chrome incognito shortcut doesn’t work. Shortcuts apparently isn’t allowed to send keystrokes via AppleScript, so there’s no way that I know of to open a Chrome incognito window via Shortcuts.)
The first time you run one of the shortcuts, you’ll see a popup asking for permission to open the URL using the shortcut. Click Always Allow to permit the shortcut to open any URL in the future.
- Open URL in Chrome
- Open URL in Chrome with Keyboard Maestro
- Open URL in Chrome Incognito Windows with Keyboard Maestro
- Open URL in Firefox
- Open URL in Firefox with Keyboard Maestro
- Open URL in Safari
- Open URL in Safari with Keyboard Maestro