From 727e03be6edc605ccce5b79d9fd3e590f3f45121 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Fri, 14 Oct 2022 16:34:00 +0200 Subject: [PATCH] Fix battery charging state --- roles/i3/files/battery | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/i3/files/battery b/roles/i3/files/battery index 32f2343..71a15fb 100755 --- a/roles/i3/files/battery +++ b/roles/i3/files/battery @@ -5,10 +5,10 @@ icon="${LABEL_100}" percent="$(upower -d | awk '/percentage/ {print $2}' | head -n 1 | cut -d% -f1)" remaining="$(upower -d | awk -F: '/time to empty/ {print $2}' | awk '{print $1,$2}' | head -n 1)" -if upower -d | grep '\bcharging\b' >/dev/null 2>&1; then +if upower -d | grep -E 'state.+\bcharging\b' >/dev/null 2>&1; then icon="${LABEL_CHARGING}" echo "${icon} ${percent}%" -elif upower -d | grep '\bdischarging\b' >/dev/null 2>&1; then +elif upower -d | grep -E 'state.+\bdischarging\b' >/dev/null 2>&1; then if [ "$percent" -lt 10 ]; then icon="${LABEL_10}" elif [ "$percent" -lt 20 ]; then