Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
godbout committed Apr 25, 2020
1 parent ed86a71 commit 8fd2eb6
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions AirpodsBattery
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# query=$1

#!/bin/bash
# AirPods Battery CLI, Version 2.3
# Contributors: duk242, ankushg, spetykowski, danozdotnet
# Released under the MIT License.

OUTPUT='🎧'; BLUETOOTH_DEFAULTS=$(defaults read /Library/Preferences/com.apple.Bluetooth); SYSTEM_PROFILER=$(system_profiler SPBluetoothDataType 2>/dev/null)
MAC_ADDR=$(grep -b2 "Minor Type: Headphones"<<<"${SYSTEM_PROFILER}"|awk '/Address/{print $3}')
CONNECTED=$(grep -ia6 "${MAC_ADDR}"<<<"${SYSTEM_PROFILER}"|awk '/Connected: Yes/{print 1}')
Expand All @@ -16,18 +9,11 @@ if [[ "${CONNECTED}" ]]; then
declare -x "${I}"="$(awk -v pat="${I}" '$0~pat{gsub (";",""); print $3 }'<<<"${BLUETOOTH_DATA}")"
[[ ! -z "${!I}" ]] && OUTPUT="${OUTPUT} $(awk '/BatteryPercent/{print substr($0,15,1)": "}'<<<"${I}")${!I}%"
done
# Modified by Laz
printf -v res "%s\\n" "${OUTPUT}"
else
# Modified by Laz
printf -v res "%s Not Connected\\n" "${OUTPUT}"
fi


# AirpodsBattery Alfred workflow
# Author: Laz (lasviceju@gmail.com)
# License: MIT

battery=$(echo $res | awk '{if ($2 ~ "n|Not") print "Not Connected"; else print " L: " $5 " R: " $7}')
if [[ $battery == "Not Connected" ]]; then
arg=0;
Expand Down

0 comments on commit 8fd2eb6

Please sign in to comment.