diff --git a/plugins/battery/battery.plugin.zsh b/plugins/battery/battery.plugin.zsh index 0e96b00aa..db5eeb93a 100644 --- a/plugins/battery/battery.plugin.zsh +++ b/plugins/battery/battery.plugin.zsh @@ -153,7 +153,7 @@ elif [[ "$OSTYPE" = linux* ]]; then # Battery #1 : Unknown, 99.55% # Battery #2 : Discharging, 49.58%, 01:12:05 # All batteries : 62.60%, 02:03:03 - acpitool 2>/dev/null | command awk -F, ' + local -i pct=$(acpitool 2>/dev/null | command awk -F, ' /^\s+All batteries/ { gsub(/[^0-9.]/, "", $1) pct=$1 @@ -164,7 +164,8 @@ elif [[ "$OSTYPE" = linux* ]]; then pct=$2 } END { print pct } - ' + ') + echo $pct elif (( $+commands[acpi] )); then # Sample output: # Battery 0: Discharging, 0%, rate information unavailable @@ -227,7 +228,7 @@ function battery_level_gauge() { local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow} local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'} - local battery_remaining_percentage=$(battery_pct) + local -i battery_remaining_percentage=$(battery_pct) local filled empty gauge_color if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then