summaryrefslogtreecommitdiff
path: root/i3blocks-cpuload.sh
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@sparrowhawk.53hor.net>2020-05-13 08:19:11 -0400
committerAdam T. Carpenter <atc@sparrowhawk.53hor.net>2020-05-13 08:19:11 -0400
commit8b1a2abb3bc497af04f9531db46af4b0dda42117 (patch)
tree14e91cc7a77d6d4756d58db6e004cdab3546f627 /i3blocks-cpuload.sh
parentb184782970853b3c479f6c4ad833a36a3aea7afa (diff)
downloadscripts-8b1a2abb3bc497af04f9531db46af4b0dda42117.tar.xz
scripts-8b1a2abb3bc497af04f9531db46af4b0dda42117.zip
updated for FreeBSD userland, included wpg scripts
Diffstat (limited to 'i3blocks-cpuload.sh')
-rwxr-xr-xi3blocks-cpuload.sh5
1 files changed, 2 insertions, 3 deletions
diff --git a/i3blocks-cpuload.sh b/i3blocks-cpuload.sh
index 6d3773f..8d61815 100755
--- a/i3blocks-cpuload.sh
+++ b/i3blocks-cpuload.sh
@@ -2,15 +2,14 @@
cpu_count=4
low=25
high=75
-icon=󰻠
icon_low=󰒲
icon_mid=󰜎
icon_high=󱅝
-avg_load=$(uptime | cut -d, -f4 | cut -d: -f2)
+#min_avg_usage=$(vmstat | tail -1 | cut -w -f17)
+avg_load=$(sysctl vm.loadavg | cut -w -f3)
percent=$(echo "result = $avg_load / $cpu_count * 100; scale=0; result / 1" | bc -l)
-printf $icon
[ $percent -lt $low ] && printf $icon_low
[ $percent -ge $low ] && [ $percent -lt $high ] && printf $icon_mid
[ $percent -ge $high ] && printf $icon_high