Is it possible to connect to AirPods Pro via keyboard shortcut? I want to connect to my AirPods Pro on mac (Big Sur 11.1) using keyboard shortcut. I find it tedious to manually choose the top-right icon on the menu bar and click 'connect', but at the same time I don't want to make the pairing automatic since not always do I want to connect to my mac, such as while I play the music on my iPad.
So I want to connect to it via keyboard shortcut. Is it possible? It's fine to use 3rd-party apps such as Hammarspoon or Karabiner-Elements, though I could not find a way to connect to the AirPods.
Karabiner + Blueutil Solution
I do something like this using a bluetooth cli tool named blueutil. Here is a complex modification you could use in Karabiner.
{
    &quot;title&quot;: &quot;Bluetooth Connect&quot;,
    &quot;rules&quot;: [
        {
            &quot;description&quot;: &quot;Connect to AirPods&quot;,
            &quot;manipulators&quot;: [
                {
                    &quot;from&quot;: {
                        &quot;key_code&quot;: &quot;a&quot;,
                        &quot;modifiers&quot;: {
                            &quot;mandatory&quot;: [&quot;fn&quot;]
                        }
                    },
                    &quot;to&quot;: [
                        {
                            &quot;shell_command&quot;: &quot;/usr/local/bin/blueutil -p 1; /usr/local/bin/blueutil --connect \&quot;AirPods Pro\&quot;&quot;
                        }
                    ],
                    &quot;type&quot;: &quot;basic&quot;
                }
            ]
        }
    ]
}


+ Goku
Goku is a tool for more easily managing your karabiner configuration. I use this to manage mine. I have configured Karabiner to use F10 as a &quot;audio layer&quot;/modifier key for audio related mappings. If you learn a little about how Goku works, you can check out my configuration if you want to implement something like this for yourself.