diff --git a/system-info/system-info-WSL.sh b/system-info/system-info-WSL.sh index ca476de..8274d83 100755 --- a/system-info/system-info-WSL.sh +++ b/system-info/system-info-WSL.sh @@ -28,7 +28,12 @@ while true; do jq '.sysstat.hosts[0].statistics[0]["cpu-load"][1:]|.[].idle' | \ awk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 11), 1) }'`" - echo "$cpu_temp$cpu_load" > $cache_file + raw_battery=$(powershell.exe -NoProfile \ + "(Get-WmiObject win32_battery).EstimatedChargeRemaining" \ + | sed 's/\r//') + battery=$(printf "%3d%%" "$raw_battery") + + 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; sleep 2 done