From fd98b1d6671858a2a725634c82d6907ec25771ea Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Sun, 21 Mar 2021 14:35:21 +0530 Subject: FINALLY THIS WORKS PROPERLY (Pushing all the dotfiles) --- .config/lemonblocks/modules/cpu_load.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 .config/lemonblocks/modules/cpu_load.sh (limited to '.config/lemonblocks/modules/cpu_load.sh') 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 -- cgit v1.2.3