From 7f6ad5cbbbc39233aa45a3b79dc5e55ac5fceb5a Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Wed, 26 Jul 2017 16:51:31 +0200 Subject: [PATCH] zsh: prompt: check for battery and improve detection of pcs with acpi --- zsh/prompt.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 7c1fe78..0acc5d6 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -57,7 +57,7 @@ zshrc_prompt_precmd() { # battery percentage, if acpi is available local battery_pct= - if type acpi &> /dev/null ; then + if [[ -d /sys/class/power_supply/BAT*(#qN) ]] && type acpi &> /dev/null; then battery_pct="$(acpi -b | cut -d, -f2 | sed -e 's/[^0-9]//g')" # colorize battery percentage or display status