Skip to content

Commit

Permalink
update for macOS 12.3
Browse files Browse the repository at this point in the history
  • Loading branch information
godbout committed Mar 25, 2022
1 parent 5142030 commit cf0f6d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/connector.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SYSTEM_PROFILER=$(system_profiler SPBluetoothDataType 2>/dev/null)

MAC_ADDRESS=$(grep -B8 "Minor Type: Headphones" <<< "${SYSTEM_PROFILER}" | awk '/Address/{ print $2 }')
CONNECTED=$(grep -A6 "${MAC_ADDRESS}" <<< "${SYSTEM_PROFILER}" | awk '/Connected: Yes/{ print 1 }')
MAC_ADDRESS=$(grep -B8 "Minor Type: Headphones" <<< "${SYSTEM_PROFILER}" | awk '/Address/{print $2}')
CONNECTED=$(grep -A10 "${MAC_ADDRESS}" <<< "${SYSTEM_PROFILER}" | awk '/Services:/{print 1}')
NAME=$(grep -B9 "Minor Type: Headphones" <<< "${SYSTEM_PROFILER}" | awk '/AirPods/{ print }' | sed -e 's/^ *//' -e 's/://')

if [[ "${CONNECTED}" ]]; then
Expand Down

0 comments on commit cf0f6d2

Please sign in to comment.