diff options
| author | Blista Kanjo | 2023-07-19 13:51:07 -0400 |
|---|---|---|
| committer | Blista Kanjo | 2023-07-19 13:51:07 -0400 |
| commit | 5f171c1a6e480ea051b5abb9dc312096ede23b81 (patch) | |
| tree | e542f51d8101cec8aff93f7b442304649050b456 /.local/bin/awesome-widgets/widget-cpu_usage | |
| parent | 820a3081360cdc33122a0b7b952bff7482af9b59 (diff) | |
refactor: removing `awesome-widgets` from the repo
Diffstat (limited to '.local/bin/awesome-widgets/widget-cpu_usage')
| -rwxr-xr-x | .local/bin/awesome-widgets/widget-cpu_usage | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/.local/bin/awesome-widgets/widget-cpu_usage b/.local/bin/awesome-widgets/widget-cpu_usage deleted file mode 100755 index 4be33eb..0000000 --- a/.local/bin/awesome-widgets/widget-cpu_usage +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Cache in tmpfs to improve speed and reduce SSD load -cache=/tmp/cpubarscache - -stats=$(awk '/cpu[0-7]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) -[ ! -f $cache ] && echo "$stats" > "$cache" -old=$(cat "$cache") -printf " 🫀 " -echo "$stats" | while read -r row; do - id=${row%% *} - rest=${row#* } - total=${rest%% *} - idle=${rest##* } - - case "$(echo "$old" | awk '{if ($1 == id) - printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \ - id="$id" total="$total" idle="$idle")" in - - "0") printf "▁";; - "1") printf "▂";; - "2") printf "▃";; - "3") printf "▄";; - "4") printf "▅";; - "5") printf "▆";; - "6") printf "▇";; - "7") printf "█";; - "8") printf "█";; - esac -done; printf "\\n" -echo "$stats" > "$cache" |
