From 3ee3574351797a65482f547088703b583d32a9c4 Mon Sep 17 00:00:00 2001 From: Narvin Singh Date: Thu, 24 Dec 2020 11:34:53 -0500 Subject: [PATCH] Fix: CPU usage using %cpu Use %cpu format in ps and drop the percent sign from the output since the numbers don't usually add up to 100. --- status-bar | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/status-bar b/status-bar index a81c7a9..cfab110 100755 --- a/status-bar +++ b/status-bar @@ -28,7 +28,7 @@ DT_SYM='' DT_FMT='%a %d %I:%M%p' status_cpu() { - ps -ef | awk '{cpu = cpu + $4} END {print cpu "%"}' + ps --no-headers -eo %cpu | awk '{cpu = cpu + $1} END {print cpu}' } status_mem() {