From 67a67f7988017bd2ad2a5e0b0115a2b537564f7c Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sun, 16 Jul 2017 13:23:27 +0200 Subject: [PATCH] zsh: prompt: fix battery display on computers without acpi --- zsh/prompt.zsh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 67a0479..7c1fe78 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -59,17 +59,17 @@ zshrc_prompt_precmd() { local battery_pct= if type acpi &> /dev/null ; then battery_pct="$(acpi -b | cut -d, -f2 | sed -e 's/[^0-9]//g')" - fi - # colorize battery percentage or display status - if [[ $(acpi -a | cut -d':' -f2) == " on-line" ]]; then - battery_pct="charging" - elif [[ $battery_pct -le 20 ]]; then - battery_pct="%F{red}${battery_pct}%%%f" - elif [[ $battery_pct -le 65 ]]; then - battery_pct="%F{yellow}${battery_pct}%%%f" - else - battery_pct="%F{green}${battery_pct}%%%f" + # colorize battery percentage or display status + if [[ $(acpi -a | cut -d':' -f2) == " on-line" ]]; then + battery_pct="charging" + elif [[ $battery_pct -le 20 ]]; then + battery_pct="%F{red}${battery_pct}%%%f" + elif [[ $battery_pct -le 65 ]]; then + battery_pct="%F{yellow}${battery_pct}%%%f" + else + battery_pct="%F{green}${battery_pct}%%%f" + fi fi # prefix characters in first and second line