Credit to Jason Shanks and Josh Johnson for the original idea and scripts provided in this post.
Step 1: Download workflow
Click the button below to download the Alfred Workflow
This should automatically open in Alfred and create the workflow for you. It should look something like this.
Step 2: Edit the workflow
Before you use this workflow, you need to edit the script inside and tailor it to the name of your Airpods.
Find the name of your Airpods by clicking the Bluetooth icon in the menu bar.
Then double click the script box of the workflow as seen above and type the name of your airpods as noted above into the string that says “Justin Wyne’s Airpods”.
Save the workflow and close the Alfred Settings.
Step 3: Run the workflow
You should now be all set.
Trigger the workflow by typing out “airpods”. You’ll see it trigger clicking the bluetooth icon and connecting to the device you named above.