Fix indexing into icon char buffers

This commit is contained in:
2025-11-11 21:17:20 +00:00
parent 4635fc169d
commit 19e9306008
3 changed files with 9 additions and 9 deletions

View File

@@ -32,14 +32,14 @@ while true; do
cpu_load=" `mpstat -P ALL -n 1 -u 1 -o JSON | \
jq '.sysstat.hosts[0].statistics[0]["cpu-load"][1:]|.[].idle' | \
awk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 11), 1) }'`"
awk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 100 * 9), 1) }'`"
raw_battery=$($powershell -NoProfile \
"(Get-WmiObject win32_battery).EstimatedChargeRemaining" \
| sed 's/\r//')
if [ "" != "$raw_battery" ]; then
battery="$(echo $raw_battery | awk '$battery ~ /.*/ {
printf " %d%% %s\n", $battery, substr("", int($battery / 9), 1)
printf " %d%% %s\n", $battery, substr("", int($battery / 100 * 11), 1)
}')"
fi