Fix battery charging state

This commit is contained in:
flyingscorpio@clevo 2022-10-14 16:34:00 +02:00
parent bd39d8af10
commit 727e03be6e

View file

@ -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