summaryrefslogblamecommitdiff
path: root/i3blocks-cpuload.sh
blob: 8d61815ebed791e273d72273cdcbb02d2ca3d335 (plain) (tree)
1
2
3
4
5
6
7
8
9
10



           



              

                                                

                                                                                    



                                                                   
#!/bin/sh
cpu_count=4
low=25
high=75
icon_low=󰒲
icon_mid=󰜎
icon_high=󱅝

#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)

[ $percent -lt $low ] && printf $icon_low
[ $percent -ge $low ] && [ $percent -lt $high ] && printf $icon_mid
[ $percent -ge $high ] && printf $icon_high
printf " %s%%\n" $percent