diff options
author | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-03-21 14:35:21 +0530 |
---|---|---|
committer | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-03-21 14:35:21 +0530 |
commit | fd98b1d6671858a2a725634c82d6907ec25771ea (patch) | |
tree | 2033a7c2ab14f588d698e86d5a4b5e5f2be2c20c /.config/lemonblocks/modules/cpu_load.sh | |
parent | 4e719d6ca4af5a7d56f37f2ec5ef5e59118b03b4 (diff) |
FINALLY THIS WORKS PROPERLY (Pushing all the dotfiles)
Diffstat (limited to '.config/lemonblocks/modules/cpu_load.sh')
-rwxr-xr-x | .config/lemonblocks/modules/cpu_load.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/.config/lemonblocks/modules/cpu_load.sh b/.config/lemonblocks/modules/cpu_load.sh new file mode 100755 index 0000000..1a677a9 --- /dev/null +++ b/.config/lemonblocks/modules/cpu_load.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +read cpu a b c previdle rest < /proc/stat +prevtotal=$((a+b+c+previdle)) +sleep 0.5 +read cpu a b c idle rest < /proc/stat +total=$((a+b+c+idle)) +cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) )) + +printf " CPU:%s%% " $cpu |