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