Thread: Bar graphs from LAU dont work with my conky - help
i know there lots of conky threads, , have read / searched / googled many possible try , work out ive missed im coming blank.
im running vin conkyrc in xubuntu 11.10 (64) , working except bargraphs. strangely call of draw_bg.lua working fine (as tried # out , conky window changed expect).
here section conkyrc:
#####
## load lua shading (optional)
## set path script here.
#
lua_load ~/conky/draw_bg.lua
lua_draw_hook_pre draw_bg
####
## load lua bargraphs (required)
## set path script here.
#
lua_load ~/conky/bargraph.lua
lua_draw_hook_post main_bars
both draw_bg.lua , bargraph.lua in same folder, call 1 think work other?
below contents of bargraph.lua:
require 'cairo'
----------------start of parameters ----------
function conky_main_bars()
local bars_settings={
{ --[ graph cpu1 ]--
name="cpu",
arg="cpu1",
max=100,
alarm=50,
alarm_colour={0xff0000,0.72},
bg_colour={0xffffff,0.25},
fg_colour={0x00ff00,0.55},
mid_colour={{0.45,0xffff00,0.70}},
x=78,y=156,
blocks=56,
space=1,
height=2,width=5,
angle=90,
smooth=true
},
{ --[ graph cpu2 ]--
name="cpu",
arg="cpu2",
max=100,
alarm=50,
alarm_colour={0xff0000,0.72},
bg_colour={0xffffff,0.25},
fg_colour={0x00ff00,0.55},
mid_colour={{0.45,0xffff00,0.70}},
x=78,y=170,
blocks=56,
space=1,
height=2,width=5,
angle=90,
smooth=true
},
{ --[ graph memory ]--
name="memperc",
arg="",
max=100,
alarm=50,
alarm_colour={0xff0000,0.72},
bg_colour={0xffffff,0.25},
fg_colour={0x00ff00,0.55},
mid_colour={{0.45,0xffff00,0.70}},
x=15,y=220,
blocks=77,
space=1,
height=2,width=5,
angle=90,
smooth=true
},
{ --[ graph root ]--
name="fs_used_perc",
arg="/",
max=100,
alarm=50,
alarm_colour={0xff0000,0.72},
bg_colour={0xffffff,0.25},
fg_colour={0x00ff00,0.55},
mid_colour={{0.45,0xffff00,0.70}},
x=15,y=267,
blocks=77,
space=1,
height=2,width=5,
angle=90,
smooth=true
},
{ --[ graph nas ]--
name="fs_used_perc",
arg="/media/nas",
max=100,
alarm=50,
alarm_colour={0xff0000,0.72},
bg_colour={0xffffff,0.25},
fg_colour={0x00ff00,0.55},
mid_colour={{0.45,0xffff00,0.70}},
x=15,y=295,
blocks=77,
space=1,
height=2,width=5,
angle=90,
smooth=true
},
{ --[ graph swap ]--
name="swapperc",
arg="",
max=100,
alarm=50,
alarm_colour={0xff0000,0.72},
bg_colour={0xffffff,0.25},
fg_colour={0x00ff00,0.55},
mid_colour={{0.45,0xffff00,0.70}},
x=15,y=323,
blocks=77,
space=1,
height=2,width=5,
angle=90,
smooth=true
},
}
-----------end of parameters--------------
if conky_window == nil return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
--prevent segmentation error when reading cpu state
if tonumber(conky_parse('${updates}'))>3 then
in pairs(bars_settings) do
draw_multi_bar_graph(bars_settings[i])
end
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end
function draw_multi_bar_graph(t)
cairo_save(cr)
--check values
if t.draw_me == true t.draw_me = nil end
if t.draw_me ~= nil , conky_parse(tostring(t.draw_me)) ~= "1" return end
if t.name==nil , t.argdarkorange`/usr/bin/banshee --query-title --no-present | cut -f1- -d ${if_empty ${wireless_essid wlan0}}${else}1$endif==nil
print ("no input values ... use parameters 'name' 'arg' or parameter 'arg' ")
return
end
if t.max==nil then
print ("no maximum value defined, use 'max'")
return
end
if t.name==nil t.name="" end
if t.arg==nil t.arg="" end
--set default values
if t.x == nil then t.x = conky_window.width/2 end
if t.y == nil then t.y = conky_window.height/2 end
if t.blocks == nil then t.blocks=10 end
if t.height == nil then t.height=10 end
if t.angle == nil then t.angle=0 end
t.angle = t.angle*math.pi/180
--line cap style
if t.cap==nil then t.cap = "b" end
local cap="b"
for i,v in ipairs({"s","r","b"})
if v==t.cap cap=v end
end
local delta=0
if t.cap=="r" or t.cap=="s" delta = t.height end
if cap=="s" cap = cairo_line_cap_square
elseif cap=="r" then
cap = cairo_line_cap_round
elseif cap=="b" then
cap = cairo_line_cap_butt
end
--end line cap style
--if t.led_effect == nil then t.led_effect="r" end
if t.width == nil then t.width=20 end
if t.space == nil then t.space=2 end
if t.radius == nil then t.radius=0 end
if t.angle_bar == nil then t.angle_bar=0 end
t.angle_bar = t.angle_bar*math.pi/360 --halt angle
--colours
if t.bg_colour == nil then t.bg_colour = {0x00ff00,0.5} end
if #t.bg_colour~=2 then t.bg_colour = {0x00ff00,0.5} end
if t.fg_colour == nil then t.fg_colour = {0x00ff00,1} end
if #t.fg_colour~=2 then t.fg_colour = {0x00ff00,1} end
if t.alarm_colour == nil then t.alarm_colour = t.fg_colour end
if #t.alarm_colour~=2 then t.alarm_colour = t.fg_colour end
if t.mid_colour ~= nil then
for i=1, #t.mid_colour
if #t.mid_colour[i]~=3
print ("error in mid_color table")
t.mid_colour[i]={1,0xffffff,1}
end
end
end
if t.bg_led ~= nil , #t.bg_led~=2 then t.bg_led = t.bg_colour end
if t.fg_led ~= nil , #t.fg_led~=2 then t.fg_led = t.fg_colour end
if t.alarm_led~= nil , #t.alarm_led~=2 t.alarm_led = t.fg_led end
if t.led_effect~=nil then
if t.bg_led == nil t.bg_led = t.bg_colour end
if t.fg_led == nil then t.fg_led = t.fg_colour end
if t.alarm_led == nil t.alarm_led = t.fg_led end
end
if t.alarm==nil t.alarm = t.max end --0.8*t.max end
if t.smooth == nil t.smooth = false end
if t.skew_x == nil
t.skew_x=0
else
t.skew_x = math.pi*t.skew_x/180
end
if t.skew_y == nil
t.skew_y=0
else
t.skew_y = math.pi*t.skew_y/180
end
if t.reflection_alpha==nil t.reflection_alpha=0 end
if t.reflection_length==nil t.reflection_length=1 end
if t.reflection_scale==nil t.reflection_scale=1 end
--end of default values
local function rgb_to_r_g_b(col_a)
return ((col_a[1] / 0x10000) % 0x100) / 255., ((_surface_destroy(cs)
cairo_destroy(cr)
end
standard can see yet dont of graphs in of sections.
hope can help, have missed something, not sure what?
sorry bump, can give me steer on this? im bit out of ideas myself..
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [xubuntu] Bar graphs from LAU dont work with my conky - help
Ubuntu
Comments
Post a Comment