Skip to content

Commit cf0f6d2

Browse files
committed
update for macOS 12.3
1 parent 5142030 commit cf0f6d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/connector.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SYSTEM_PROFILER=$(system_profiler SPBluetoothDataType 2>/dev/null)
22

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

77
if [[ "${CONNECTED}" ]]; then

0 commit comments

Comments
 (0)