1
0
Fork 0
mirror of synced 2024-12-22 06:41:07 -05:00

fixed _battery_info() not accommodating for empty lines, fixes #377

This commit is contained in:
Gregory Pakosz 2020-07-23 12:43:52 +02:00
parent d357ae54ee
commit 5d895f94b7

View file

@ -284,6 +284,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim
# case "$_uname_s" in # case "$_uname_s" in
# *Darwin*) # *Darwin*)
# while IFS= read -r line; do # while IFS= read -r line; do
# [ -z "$line" ] && continue
# discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false") # discharging=$(printf '%s' "$line" | grep -qi "discharging" && echo "true" || echo "false")
# percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%') # percentage=$(printf '%s' "$line" | grep -E -o '[0-9]+%')
# charge=$(awk -v charge="$charge" -v percentage="${percentage%%%}" 'BEGIN { print charge + percentage / 100 }') # 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*) # *Linux*)
# while IFS= read -r batpath; do # while IFS= read -r batpath; do
# [ -z "$batpath" ] && continue
# grep -i -q device "$batpath/scope" 2> /dev/null && continue # grep -i -q device "$batpath/scope" 2> /dev/null && continue
# #
# discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false") # discharging=$(grep -qi "discharging" "$batpath/status" && echo "true" || echo "false")