From 31e461fb387e03e6f9847500d1543cedcb9a4422 Mon Sep 17 00:00:00 2001 From: Thomas Preisner Date: Sat, 3 Feb 2018 00:11:39 +0100 Subject: [PATCH] zsh: prompt: only show percentage of the first battery available --- zsh/prompt.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/prompt.zsh b/zsh/prompt.zsh index 8f4d0c2..a2d8fac 100644 --- a/zsh/prompt.zsh +++ b/zsh/prompt.zsh @@ -67,7 +67,7 @@ zshrc_prompt_precmd() { # battery percentage, if acpi is available local battery_pct= 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')" + battery_pct="$(acpi -b | cut -d, -f2 | sed -e 's/[^0-9]//g' | head -n1)" # colorize battery percentage or display status if [[ $battery_pct -le 20 ]]; then