1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-18 13:41:56 +00:00

Fixed an issue where full battery registers as disconnected

This commit is contained in:
Dean Fenster 2016-12-03 19:46:25 +02:00
parent 1ff9da64d9
commit 4bee6dc93d

View file

@ -397,11 +397,12 @@ prompt_battery() {
# Return if no battery found # Return if no battery found
[[ -z $bat ]] && return [[ -z $bat ]] && return
local capacity=$(cat $bat/capacity)
[[ $(cat $bat/capacity) -gt 100 ]] && local bat_percent=100 || local bat_percent=$(cat $bat/capacity) local battery_status=$(cat $bat/status)
[[ $(cat $bat/status) =~ Charging ]] && local connected=true [[ $capacity -gt 100 ]] && local bat_percent=100 || local bat_percent=$capacity
[[ $(cat $bat/status) =~ Charging && $bat_percent =~ 100 ]] && current_state="charged" [[ $battery_status =~ Charging || $battery_status =~ Full ]] && local connected=true
[[ $(cat $bat/status) =~ Charging && $bat_percent -lt 100 ]] && current_state="charging" [[ $connected && $bat_percent =~ 100 ]] && current_state="charged"
[[ $connected && $bat_percent -lt 100 ]] && current_state="charging"
if [[ -z $connected ]]; then if [[ -z $connected ]]; then
[[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state="low" || current_state="disconnected" [[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state="low" || current_state="disconnected"
fi fi