From 5d895f94b7c811f9599383b16c3f608bcb21bb44 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 23 Jul 2020 12:43:52 +0200 Subject: [PATCH] fixed _battery_info() not accommodating for empty lines, fixes #377 --- .tmux.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.tmux.conf b/.tmux.conf index 8f07d47..ee07a8a 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -284,6 +284,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # case "$_uname_s" in # *Darwin*) # while IFS= read -r line; do +# [ -z "$line" ] && continue # discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%') # charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') @@ -294,6 +295,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # ;; # *Linux*) # while IFS= read -r batpath; do +# [ -z "$batpath" ] && continue # grep -i -q device "$batpath/scope" 2> /dev/null && continue # # discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")