Fix indexing into icon char buffers
This commit is contained in:
@@ -85,9 +85,9 @@ while true; do
|
||||
|
||||
cpu_load=$(sudo powermetrics --format text \
|
||||
--sample-rate 1200 --sample-count 1 --samplers cpu_power |
|
||||
grep --color=never -E 'CPU \d idle residency:' |
|
||||
grep --color=never -Eo '\d+\.\d+' |
|
||||
gawk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 10), 1) }'
|
||||
grep --color=never -E 'CPU \d active residency:' |
|
||||
gawk '{print $5}' |
|
||||
gawk '$idle ~ /[-.0-9]*/ { printf "%s", substr(" ▁▂▃▄▅▆▇█", int($idle / 100 * 9), 1) }'
|
||||
)
|
||||
|
||||
# Parse the current battery charge percentage.
|
||||
@@ -97,7 +97,7 @@ while true; do
|
||||
grep --color=never -Eo '\d+%' | \
|
||||
grep --color=never -Eo '\d+')"
|
||||
battery="$(echo $raw_battery | gawk '$battery ~ /.*/ {
|
||||
printf " %d%% %s\n", $battery, substr("", int($battery / 9), 1)
|
||||
printf " %d%% %s\n", $battery, substr("", int($battery / 100 * 11), 1)
|
||||
}')"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user