no percentage, 25% intervals via font-awesome
This commit is contained in:
parent
d24065a7a5
commit
8173732805
@ -27,13 +27,21 @@ do
|
|||||||
printf '\n' &&
|
printf '\n' &&
|
||||||
continue
|
continue
|
||||||
|
|
||||||
status=$(sed "s/Discharging/🔋/;s/Not charging/🛑/;s/Charging/🔌/;s/Unknown/🔋/;s/Full/⚡/" "$battery"/status)
|
status=$(sed "s/Discharging//;s/Not charging/🛑/;s/Charging/🔌/;s/Unknown/🔋/;s/Full/⚡/" "$battery"/status)
|
||||||
# If it is discharging and 25% or less, we will add a ❗ as a warning.
|
# Center picture around the actual capacity.
|
||||||
[ "$capacity" -le 25 ] &&
|
# Displayable capacities: 0, 1/4, 1/2, 3/4, 1 -> intervall of length 25% centered around displaycategory
|
||||||
[ "$status" = "🔋" ] &&
|
# -> +- 12.5% for every level
|
||||||
warn="❗"
|
if [ "$status" = "" ]; then
|
||||||
printf "%s%s%s%%\n" "$status" "$warn" "$capacity"
|
[ "$capacity" -le 13 ] &&
|
||||||
unset warn
|
status=""
|
||||||
|
[ "$capacity" -le 37 ] &&
|
||||||
|
status=""
|
||||||
|
[ "$capacity" -le 63 ] &&
|
||||||
|
status=""
|
||||||
|
[ "$capacity" -le 87 ] &&
|
||||||
|
status=""
|
||||||
|
fi
|
||||||
|
printf "%s\n" "$status"
|
||||||
else
|
else
|
||||||
echo "Error. Capacity:$capacity" > /dev/stderr #if battery fails during reading, quit
|
echo "Error. Capacity:$capacity" > /dev/stderr #if battery fails during reading, quit
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user