Damien Rajon schrieb:
On Mon, Mar 9, 2009 at 4:26 AM, Владимир Байраковский <[email protected]> wrote:
Looks great but... I've tried this construction:

wicked.register(netwidget_down, wicked.widgets.net,
function ()
      string.format ("%04d", ${ppp0 down_kb})
end,
nil, nil, 3)

but error occurs: "unexpected symbol near '$'".

I tried other variations, but still did not work.

Hi,

Yeah, I figured out too. I think it's because the ${interface down_kb}
variable is expanded by wicked itself, so you cannot use it inside
your rc.lua.
The solution would be to register your own net-meter script with
wicked, since modifying directly /usr/share/awesome/lib/wicked.lua
isn't a good idea.
Wicked is parsing the output of 'cat /proc/net/dev', I'll probably
make a script  that parses this output and formats it to a fixed width
when I get home and post it here.


you can use something like that:

---------------------------------------------------------

cpuwidget = widget({
    type = 'textbox',
    align= 'right',
    name = 'cpuwidget'
})

wicked.register(cpuwidget, wicked.widgets.cpu,
    function (widget, usage)
return ' <span color="white">CPU:</span> ' .. string.format("%02d", usage[1]) .. '%'
    end, 2, nil, 3)

---------------------------------------------------------

this creates a cpu widget with two numbers. (reaching 100% is seldom...mostly 
:-) )

greetings

--
Sebastian Eichelbaum

--
To unsubscribe, send mail to [email protected].

Reply via email to