Handle more battery states
This commit is contained in:
parent
3ef4cf45a8
commit
3a5621ec82
1 changed files with 15 additions and 6 deletions
|
|
@ -20,12 +20,21 @@ fi
|
|||
|
||||
battery=$(cat /sys/class/power_supply/BAT0/capacity)
|
||||
battery_state=$(cat /sys/class/power_supply/BAT0/status)
|
||||
battery_symbol="❔"
|
||||
if [ "${battery_state}" = "Charging" ]; then
|
||||
battery_symbol="🗲"
|
||||
elif [ "${battery_state}" = "Discharging" ]; then
|
||||
case "${battery_state}" in
|
||||
"Charging"|"Full"|"Not charging")
|
||||
battery_symbol="🔌"
|
||||
;;
|
||||
"Discharging")
|
||||
if [ "${battery}" -lt 20 ]; then
|
||||
battery_symbol="🪫"
|
||||
else
|
||||
battery_symbol="🔋"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
battery_symbol="❔"
|
||||
;;
|
||||
esac
|
||||
|
||||
weather=$(cat /tmp/weather-report.txt)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue