|
|
|
@ -17,8 +17,13 @@ |
|
|
|
# Modified to add support for OpenBSD # |
|
|
|
# Modified to add support for OpenBSD # |
|
|
|
########################################### |
|
|
|
########################################### |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
: ${BATTERY_SHOW_WATTS:=false} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$OSTYPE" = darwin* ]]; then |
|
|
|
if [[ "$OSTYPE" = darwin* ]]; then |
|
|
|
|
|
|
|
function get_charger_power() { |
|
|
|
|
|
|
|
echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W " |
|
|
|
|
|
|
|
} |
|
|
|
function battery_is_charging() { |
|
|
|
function battery_is_charging() { |
|
|
|
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes' |
|
|
|
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes' |
|
|
|
} |
|
|
|
} |
|
|
|
@ -58,7 +63,10 @@ if [[ "$OSTYPE" = darwin* ]]; then |
|
|
|
fi |
|
|
|
fi |
|
|
|
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}" |
|
|
|
echo "%{$fg[$color]%}[${battery_pct}%%]%{$reset_color%}" |
|
|
|
else |
|
|
|
else |
|
|
|
echo "${BATTERY_CHARGING-⚡️}" |
|
|
|
if [[ "${BATTERY_SHOW_WATTS}" = "true" ]] ; then |
|
|
|
|
|
|
|
watts=$(get_charger_power) |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
echo "${watts}${BATTERY_CHARGING-⚡️}" |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|