Here's some snippets from my rc.lua.
battery_widget is a progressbar:
if color then
battery_widget:bar_properties_set("charge", { fg = color })
battery_title.text = "<span color=\"" .. color .. "\"> " .. title .. " </span>"
end
battery_widget:bar_data_add("charge", charge)
cpu_load_widget is a graph with two graphics (one per CPU core):
if cpu_load_cache then
if cpu_load_cache[1] < sum0 then
cpu_load_widget:plot_data_add("cpu0", 100 - (cpu0_times[4] - cpu_load_cache[2]) *
100 / (sum0 - cpu_load_cache[1]) )
end
if cpu_load_cache[3] < sum1 then
cpu_load_widget:plot_data_add("cpu1", 100 - (cpu1_times[4] - cpu_load_cache[4]) *
100 / (sum1 - cpu_load_cache[3]) )
end
end
So plot_data_add && bar_data_add methods are your friends.
Look api doc & wiki for details (you know what to look for now :)
Sergey Kondratenko пишет:
by the way,
i miss now the most interesting and the most important thing for the
graph- how to make it alive? how do you update the graph?
Sergey.
On Tue, Mar 10, 2009 at 12:57 PM, Sergey Kondratenko
<[email protected] <mailto:[email protected]>> wrote:
thank you calmar!
cool desktop :)
one small question, can you also share you theme configuration file ?
i am especially interested in the gradient stuff for the selected
window.
Sergey.
On Tue, Mar 10, 2009 at 12:47 PM, calmar c. <[email protected]
<mailto:[email protected]>> wrote:
On Tue, Mar 10, 2009 at 12:35:07PM +0100, Sergey Kondratenko wrote:
> hey guys,
>
> does anyone has an example of net widget that looks like a
graph?
http://www.calmar.ws/tmp/083-Tue-screen.png
(the orange graph widget)
copypaste stuff... from rc.lua
------------------------------
gr_net = widget({ type = "graph", align = "right" })
gr_net.width = 50
gr_net.height = 0.90
gr_net.grow = "left"
gr_net.bg <http://gr_net.bg> = beautiful.gr_net_bg
gr_net.border_color = beautiful.gr_net_border_color
gr_net:plot_properties_set("in",
{
["fg"] = beautiful.gr_net_in_fg,
["fg_center"] = beautiful.gr_net_in_center,
["fg_end"] = beautiful.gr_net_in_end,
["vertical_gradient"] = true,
["scale"] = true,
["max_value"] = "160",
["style"] = "bottom"
})
gr_net:plot_properties_set("out",
{
["fg"] = beautiful.gr_net_out_fg,
["fg_center"] = beautiful.gr_net_out_center,
["fg_end"] = beautiful.gr_net_out_end,
["vertical_gradient"] = true,
["scale"] = true,
["max_value"] = "12",
["style"] = "line"
})
in the theme file (beautiful....)
---------------------------------
gr_net_bg = #00000099
gr_net_border_color = #444466
gr_net_in_fg = #009900
gr_net_in_center = #00aa00
gr_net_in_end = #33ff33
gr_net_out_fg = #cc9900
gr_net_out_center = #ee9900
gr_net_out_end = #ff9900
cheers
--
(o_ It rocks: LINUX + Command-Line-Interface
//\ GPG: 0x59D90F4D
V_/_ http://www.calmar.ws
--
To unsubscribe, send mail to [email protected]
<mailto:[email protected]>.
--
To unsubscribe, send mail to [email protected].