Am 17.01.2011 16:39, schrieb Jörg Thalheim:
This is the code use to set the different widgets in vicious depending on which functions exist.function update in vicious/init.lua: line 75 ... if widget.add_value ~= nil then widget:add_value(tonumber(data) and tonumber(data)/100) elseif widget.set_value ~= nil then widget:set_value(tonumber(data) and tonumber(data)/100) elseif widget.set_markup ~= nil then widget:set_markup(data) else widget.text = data end ... For awful.widget.graph this is add_value. `data` is the callback what you initial set vicious.register(). This must be convertable to number using the tonumber(). So you can't using custom formatting as you wan't. The question is, what kind of custom formating you wan't to use and why?
Thank you for the detailed explanation. I'd like to colorize some output (mem & cpu usage, temperature ..). Since the simple widget (of type textbox) has no gradient functions itself, I thought I could use gradient() together with this xml markup. I think, this may work by writing something like '<span color="' .. gradient(0,100,???) ... '">$1</span>' where ??? is my unknown part. I don't know how to get the variable from vicious.widget.mem. The function "worker" where the values are calculated is a local function (I guess this means private) and I can't use it directly. For the graphical stuff, there are already functions in widget.graph I can use, so somebody already made some thoughts about this (and didn't implement those functions in the simple widget, because it can be archieved in the format string). No need to use this way for graphs:)
Concerning the progressbar I'm not sure if I found a bug: I had to set max_value(0.8) to make the bar work (at least my eyes say so, 1GB used ~ 1/4 of the bar with 4GB of RAM). The text value says 23% (format string '$1%'), so the data value is correct.
-- To unsubscribe, send mail to [email protected].
