diff options
| author | ivan-boikov <ik.boikov.public@protonmail.com> | 2024-01-13 20:24:30 +0100 |
|---|---|---|
| committer | ivan-boikov <ik.boikov.public@protonmail.com> | 2024-01-13 20:24:30 +0100 |
| commit | 957dced5d85705e1ae65ca16eb902bd10d67b3e0 (patch) | |
| tree | f190e8e68ab7088b85279959d8ea482b88c72cbb /scripts/.local/bin/sb-cpubars | |
| parent | c09234bb6e65868ebe83cbf91da83356ee0a2c70 (diff) | |
1
Diffstat (limited to 'scripts/.local/bin/sb-cpubars')
| -rwxr-xr-x | scripts/.local/bin/sb-cpubars | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/.local/bin/sb-cpubars b/scripts/.local/bin/sb-cpubars index 64cf8b0..82567a3 100755 --- a/scripts/.local/bin/sb-cpubars +++ b/scripts/.local/bin/sb-cpubars @@ -5,7 +5,7 @@ cache="$XDG_CACHE_HOME/cpubarscache" # id total idle stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) -[ ! -f $cache ] && echo "$stats" > "$cache" +[ ! -f "$cache" ] && echo "$stats" > "$cache" old=$(cat "$cache") printf "" echo "$stats" | while read -r row; do @@ -18,6 +18,7 @@ echo "$stats" | while read -r row; do printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \ id="$id" total="$total" idle="$idle")" in + # these are called "block elements" "0") printf "▁";; "1") printf "▂";; "2") printf "▃";; @@ -27,6 +28,7 @@ echo "$stats" | while read -r row; do "6") printf "▇";; "7") printf "█";; "8") printf "█";; + *) printf " ";; esac done; printf "\\n" echo "$stats" > "$cache" |
