Increase battery interval, improve multi-battery display

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-12-03 09:31:44 +01:00
parent 001b490654
commit 51bee6b664
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 4 additions and 7 deletions

View file

@ -1,21 +1,18 @@
#!/bin/bash
set -euo pipefail
BATTERY=/sys/class/power_supply/BAT0
ac_conn=0
for ac in $(find /sys/class/power_supply -type l -name 'A*'); do
[ $(cat "${ac}/online") -eq 1 ] && ac_conn=1
done
bat_cap=()
for bat in $(find /sys/class/power_supply -type l -name 'B*'); do
bat_cap+="$(cat "${bat}/capacity")%"
bat_cap+=("$(cat "${bat}/capacity")%")
done
if [ ${ac_conn} -eq 0 ]; then
printf '\uf58d %s' ${bat_cap[@]}
printf '\uf58d %s' "${bat_cap[*]}"
else
printf '\uf740 %s' ${bat_cap[@]}
printf '\uf740 %s' "${bat_cap[*]}"
fi

View file

@ -51,7 +51,7 @@ interval=30
interval=30
[battery]
interval=30
interval=10
[temp]
interval=10