Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#set -eux
AIRPODS_NAME='Greg’s AirPods Pro'
OUTPUT='🎧'
BLUETOOTH_DEFAULTS=$(defaults read /Library/Preferences/com.apple.Bluetooth)
SYSTEM_PROFILER=$(system_profiler SPBluetoothDataType 2>/dev/null)
MAC_ADDR=$(grep -b3 "Minor Type: Headphones"<<<"${SYSTEM_PROFILER}"|grep -a1 ${AIRPODS_NAME}|awk '/Address/{print $3}')
#!/usr/bin/osascript
activate application "SystemUIServer"
local isConnected
tell application "System Events"
tell process "SystemUIServer"
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
set isConnected to false
tell btMenu
click