Merge pull request #47 from a06kin/master

Fix battery for OSX
This commit is contained in:
Dustin Kirkland 2023-11-22 23:28:42 -06:00 committed by GitHub
commit b3378dcb0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,7 +81,7 @@ __battery() {
# MacOS support
local key
for key in CurrentCapacity MaxCapacity ExternalChargeCapable FullyCharged; do
line=$(/usr/sbin/ioreg -n AppleSmartBattery -w0 | grep $key | sed -e 's/|//g' | awk '{ print $3 }')
line=$(/usr/sbin/ioreg -n AppleSmartBattery -w0 | grep -w $key | sed -e 's/|//g' | awk '{ print $3 }')
case "$key" in
CurrentCapacity) rem="$line";;
MaxCapacity) full="$line";;