- install blueutil (cli app to control bluetooth) and sleepwatcher (run commands on sleep and wake)
brew install blueutil sleepwatcher
- find the address of your headphones with blueutil
> blueutil --paired
address: cc-98-8b-56-61-bd, connected (master, -45 dBm), not favourite, paired, name: "WH-1000XM3"
- create ~/.sleep and ~/.wakeup files:
#!/usr/bin/env bash
/usr/local/bin/blueutil -p 0
- ~/.wakeup (note the headphone address from before):
#!/usr/bin/env bash
/usr/local/bin/blueutil -p 1
sleep 0.5
/usr/local/bin/blueutil --connect cc-98-8b-56-61-bd
- make scripts executable
- make sleewpwatcher run on startup
brew services start sleepwatcher