aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDean Fenster <dean.fenster@gmail.com>2016-12-03 20:46:25 +0300
committerDean Fenster <dean.fenster@gmail.com>2016-12-03 20:46:25 +0300
commit4bee6dc93db4ca411ac267431c9777cbc72eb60f (patch)
tree07646e1f8be8edc501003d66dffe332470327553 /powerlevel9k.zsh-theme
parent1ff9da64d974265ce2f22bd1da4a47d0b8f7ca90 (diff)
Fixed an issue where full battery registers as disconnected
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme11
1 files changed, 6 insertions, 5 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index c06d1286..8ada453d 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -397,11 +397,12 @@ prompt_battery() {
# Return if no battery found
[[ -z $bat ]] && return
-
- [[ $(cat $bat/capacity) -gt 100 ]] && local bat_percent=100 || local bat_percent=$(cat $bat/capacity)
- [[ $(cat $bat/status) =~ Charging ]] && local connected=true
- [[ $(cat $bat/status) =~ Charging && $bat_percent =~ 100 ]] && current_state="charged"
- [[ $(cat $bat/status) =~ Charging && $bat_percent -lt 100 ]] && current_state="charging"
+ local capacity=$(cat $bat/capacity)
+ local battery_status=$(cat $bat/status)
+ [[ $capacity -gt 100 ]] && local bat_percent=100 || local bat_percent=$capacity
+ [[ $battery_status =~ Charging || $battery_status =~ Full ]] && local connected=true
+ [[ $connected && $bat_percent =~ 100 ]] && current_state="charged"
+ [[ $connected && $bat_percent -lt 100 ]] && current_state="charging"
if [[ -z $connected ]]; then
[[ $bat_percent -lt $POWERLEVEL9K_BATTERY_LOW_THRESHOLD ]] && current_state="low" || current_state="disconnected"
fi