— Productivity, Alfred, Airpods, Mac, Automation — 1 min read
If you’re a Mac user with AirPods, you’ll know how cumbersome it can be when you want to switch them from your iPhone to your Mac.
The usual process is to click the Bluetooth icon in your tray, find ‘AirPods’ in the list and hit ‘Connect …’, but often this can be a pain as they fail to connect the first time or you find yourself fiddling with menus.
If you would rather have a quick and easy keyboard-only trigger to connect to your AirPods, you can with Alfred’s Workflow.
To automate the connection, we’ll use an app freely available through HomeBrew called BluetoothConnector.
1brew install bluetoothconnector
We’ll need to make a note of the MAC address for our AirPods. To do this, hold Alt and click on the BlueTooth icon in your system tray and hover over your AirPods, revealing the Address field (hidden below).
Open your Alfred preferences, and head to the Workflows tab.
Hit the plus icon at the bottom of the left-hand pane, and select Blank Workflow.
Give your workflow a name, description, category, and if you like, a beautiful icon that will show up when you run this workflow.
In the right-hand pane, right-click and select a Trigger or an Input for your workflow. I’ve chosen a Keyword input, which means I can type ‘airpods’ into Alfred and hit return to connect to my AirPods. You might want to select a keyboard shortcut, for example. You can connect multiple triggers or inputs to your workflow.
*Important — if you choose a keyword input, make sure to select ‘no argument.’*
Click and drag the nub next to your trigger or input, and in the resulting context menu, choose Actions and then Run Script
Choose /bin/bash for your language, and in the Script input pane, enter:
1BluetoothConnector 00:00:00:00:00:00 --notify
Replacing the dummy MAC address with the one you discovered in Step 2.
Now, when you trigger your workflow, Alfred will run the BluetoothConnector script, connect to your AirPods and notify you when it has finished.