Don't display battery %age on WSL system with no battery

This commit is contained in:
Kenneth Benzie 2022-10-29 13:28:27 +01:00
parent 2bb99ee369
commit 6629046ec2

View File

@ -31,7 +31,9 @@ while true; do
raw_battery=$(powershell.exe -NoProfile \
"(Get-WmiObject win32_battery).EstimatedChargeRemaining" \
| sed 's/\r//')
battery=$(printf "%3d%%" "$raw_battery")
if [ "" != "$raw_battery" ]; then
battery=$(printf "%3d%%" "$raw_battery")
fi
echo "$cpu_temp$cpu_load$battery" > $cache_file
# echo -e "HTTP/1.1 200 OK\n\n$cpu_temp $cpu_load" | nc -l -k -p 8080 -q 1;