This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |