Controlling my Airpods from the comfort of my keyboard
I wanted to toggle between Noise Cancellation and Transparency mode on my Airpods Pro easily from my keyboard. After some googling around and finding many applescript snippets that seemed to be outdated and no longer worked with the latest version of Mac OS, I discovered the app, AirBuddy. It offers a few other features, but the main feature I wanted to use was the customizable keyboard shortcut for "Switch listening modes".
After setting an obscure keyboard shortcut (⌃⌥⇧⌘ + L), I set up a macro on my mechanical keyboard using the VIA application for QMK keyboards and assigned it to a dedicated key that I don't use. Works like a charm!
The bonus was that I could do the same thing forcing a connection to my AirPods for those times where automatic switching doesn't work properly. Nice!