Triggering Alfred in Remote Access Apps

Whether I’m at home, or travelling, I often find I want to access my home-based Mac Mini from my Macbook Pro. I have several options at my disposal for doing this, and when I want to access the graphical user interface, then I want to be able to use all my usual tools. One of these is the launcher utility, Alfred.

By default, if I were to have Alfred configured the same across my devices, then it would be very difficult to know which device Alfred should trigger on, and it would default to my local device. For a good while, I used different triggers on different devices but I found it a little frustrating to have to switch up what was effectively muscle memory depending upon the device I was using.

In the end, I came up with a little automation to help me with this.

Setting up Alfred

Initially, I had my usual OPTION + SPACE keyboard shortcut set on my local Mac to trigger Alfred locally and SHIFT + CONTROL + OPTION + COMMAND + SPACE (I was actually triggering via HYPER + SPACE1) to trigger Alfred remotely. The first part to my alternative approach was to clip this around so that the remote trigger of Alfred was via OPTION + SPACE, and the local Alfred trigger was SHIFT + CONTROL + OPTION + COMMAND + SPACE.

Introducing Keyboard Maestro

The next step was to set up a Keyboard Maestro macro that was triggered by OPTION + SPACE, but then sent the SHIFT + CONTROL + OPTION + COMMAND + SPACE keystroke.

At first sight this seems a rather strange thing to do, which on its own, it most certainly would be. The part that changes this is that I place the macro into a macro group whose properties disable the macros within it when using a particular set of apps - the apps I might use for remote access to the graphical user interface.

When I am in one of these apps, my macro will not trigger, so the OPTION + SPACE keystroke will be sent to the remote access app and trigger Alfred remotely.

When I am not in on of these apps, my macro will be triggered when OPTION + SPACE is pressed and this will then send SHIFT + CONTROL + OPTION + COMMAND + SPACE which will trigger Alfred locally.

My macro actually also does an extra check when triggering and will start Alfred locally if it happens to have been quit (or crashed) for some reason utilising a little bit of AppleScript.

tell application "Alfred 4"
end tell


This interception of keystrokes only in a specific set of circumstances circumstances is a great little automation option, and it wasn’t until I started looking at my problem from an entirely different perspective that this approach came into focus for me. If you find yourself down a rabbit hole with no way forward, it is always worth looking at it from the opposite side and see if there’s a different path that could be taken to join things up.

  1. The Hyper key in Better Touch Tool. 

Author: Stephen Millard
Tags: | keyboard maestro | alfred |

Buy me a coffeeBuy me a coffee

Related posts that you may also like to read