On Mac, I had one touchbar button that connected/disconnected the headphones and another that handed them over to the phone or from the phone to the laptop. Plus commands in Alfred that did the same. And same on the phone in the dropdown menu.
That’s the kind of stuff why people buy macs. You could configure that on Linux, but you’d have to write Bash scripts.
And on Windows, if they implemented it, it would work 80% of the time.