cleanup
This commit is contained in:
parent
4fa502d543
commit
7cf53768a0
|
@ -1,34 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
reset="\033[0m"
|
|
||||||
normal="\033[10m"
|
|
||||||
big="\033[11m"
|
|
||||||
red="\033[31m"
|
|
||||||
green="\033[32m"
|
|
||||||
orange="\033[33m"
|
|
||||||
|
|
||||||
cache=/tmp/cpubarscache
|
|
||||||
temp=$(sensors | awk '/CPU/ {print $2}' | tr -d "+")
|
|
||||||
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"
|
|
||||||
old=$(cat "$cache")
|
|
||||||
printf "%b" "$big$normal $temp "
|
|
||||||
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 "%b" "$green▁" ;;
|
|
||||||
"1") printf "%b" "$green▂" ;;
|
|
||||||
"2") printf "%b" "$green▃" ;;
|
|
||||||
"3") printf "%b" "$orange▄" ;;
|
|
||||||
"4") printf "%b" "$orange▅" ;;
|
|
||||||
"5") printf "%b" "$orange▆" ;;
|
|
||||||
"6" | "7" | "8") printf "%b" "$red▇" ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
printf "%b" "$reset\n"
|
|
||||||
echo "$stats" >"$cache"
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3ca57136b7a35d990792d946e3611ec7a1a15bbe
|
Subproject commit 8de31fd8c239a601c45dd3a507367c63fbdbe529
|
Loading…
Reference in New Issue