diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2020-04-24 20:54:33 -0600 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2020-04-24 20:54:33 -0600 |
commit | c197ad40f1dca62fd1e0e555e7bfc84e39f31223 (patch) | |
tree | 5c1e753e0ff2cb9d0e08a699f17352225b9ef9f1 /plugins/battery | |
parent | 0b67340fd2fe9330d8487491e1983ad1a111fb2b (diff) | |
parent | 2560f04982dfc2693221c7c0f47d1a71df09a794 (diff) | |
download | zsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.tar.gz zsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.tar.bz2 zsh-c197ad40f1dca62fd1e0e555e7bfc84e39f31223.zip |
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'plugins/battery')
-rw-r--r-- | plugins/battery/battery.plugin.zsh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 4c4d0d4fc..755ec8d64 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -118,7 +118,7 @@ elif [[ "$OSTYPE" = linux* ]]; then function battery_pct() { if (( $+commands[acpi] )); then - acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Disc|C)harging' | cut -f2 -d ',' | tr -cd '[:digit:]' + acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Full|(Disc|C)harging)' | cut -f2 -d ',' | tr -cd '[:digit:]' fi } @@ -201,11 +201,11 @@ function battery_level_gauge() { battery_is_charging && charging=$charging_symbol # Charging status and prefix - printf ${charging_color//\%/\%\%}$charging${color_reset//\%/\%\%}${battery_prefix//\%/\%\%}${gauge_color//\%/\%\%} + print -n ${charging_color}${charging}${color_reset}${battery_prefix}${gauge_color} # Filled slots [[ $filled -gt 0 ]] && printf ${filled_symbol//\%/\%\%}'%.0s' {1..$filled} # Empty slots [[ $filled -lt $gauge_slots ]] && printf ${empty_symbol//\%/\%\%}'%.0s' {1..$empty} # Suffix - printf ${color_reset//\%/\%\%}${battery_suffix//\%/\%\%}${color_reset//\%/\%\%} + print -n ${color_reset}${battery_suffix}${color_reset} } |