Fix indexing into icon char buffers
This commit is contained in:
@@ -35,11 +35,11 @@ if upower -e | grep 'BAT' 2> /dev/null; then
|
||||
local percentage=$(echo $output | awk '{ print $4 }')
|
||||
if [ "$charging" = "Charging," ];then
|
||||
echo $percentage | awk '$battery ~ /.*/ {
|
||||
printf " %d%% %s\n", $battery, substr("", int($battery / 9), 1)
|
||||
printf " %d%% %s\n", $battery, substr("", int($battery / 100 * 11), 1)
|
||||
}'
|
||||
else
|
||||
echo $percentage | awk '$battery ~ /.*/ {
|
||||
printf " %d%% %s\n", $battery, substr("", int($battery / 9), 1)
|
||||
printf " %d%% %s\n", $battery, substr("", int($battery / 100 * 11), 1)
|
||||
}'
|
||||
fi
|
||||
}
|
||||
@@ -57,7 +57,7 @@ while true; do
|
||||
# Parse the current CPU load on all cores/threads.
|
||||
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) }'`"
|
||||
|
||||
# Parse the current CPU package temperature.
|
||||
cpu_temp=$(get_cpu_temp)
|
||||
|
||||
Reference in New Issue
Block a user