[wmii] Adding cpu usage to status bar

From: Jesús Gabriel y Galán <jgabrielygalan_AT_gmail.com>
Date: Tue, 5 May 2009 17:26:48 +0200

Hi,

I was trying to modify the status bar to add cpu % usage. The easiest
way I found (or so I thought) was this, which works in the command
line:

jesus_AT_localhost:~$ top -n 1 | awk 'NR==3 {print $2}'
1.9%us,

(I will massage $2 later to remove the us and the comma, but for now
it was enough as a test),
but when I add it like this to my wmiirc:

status() {
        echo -n $(acpi) '|' $(top -n 1 | awk 'NR==3 {print $2}') '|'
$(uptime | sed 's/.*://; s/,//g') '|' $(date)
}

it doesn't work. It shows an empty space between the two |. (the
status function is the one called in the original wmiirc)
Anybody can give a hint at what might be going on, or have a better
idea on how to show the cpu % usage?

Thanks,

Jesus.
Received on Tue May 05 2009 - 15:26:48 UTC

This archive was generated by hypermail 2.2.0 : Tue May 05 2009 - 15:36:07 UTC