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

View file

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