Normally, connecting your AirPods to your Mac should be pretty easy and straightforward. However, sometimes you could run into connection issues. Here’s how to connect AirPods to a Mac with a keyboard shortcut (via Reddit).
Redditor u/TurdsofWisdom created a short script you can use. You launch it via the shortcut Option + A, using a free app called Snap.
tell application "System Events" to tell process "SystemUIServer"
set bt to (first menu bar item whose description is "bluetooth") of menu bar 1
tell (first menu item whose title is "YOUR_DEVICE_NAME") of menu of bt
tell menu 1
if exists menu item "Connect" then
click menu item "Connect"
Alfred, the Spotlight replacement app, can also do this. Just open AppleScript and copy and paste the above. Don’t forget to add your own device name.