I figured I would do a data dump. I'm really happy with the results so far. Thanks to all that helped.
I figured I would do a data dump. I'm really happy with the results so far. Thanks to all that helped.
You can also use $if_up for your network, I got it from Pressko in post 17848. Here is the network part of my conky. The $if_existing variable is discussed at Conky Pitstop
${if_up wlan0}${voffset -20}${goto 60}${font size=12}D-Link Wireless${font}
${goto 60}Internal IP: ${addr wlan0}
${goto 60}External IP: ${exec wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'}
${goto 60}${downspeedgraph wlan0 25,100 110000 520000 -t} ${upspeedgraph wlan0 25,100 001100 005200 -t}
${voffset -40}${goto 60}Down ${downspeedf wlan0}${alignr}Total Dn ${totaldown wlan0}
${goto 60}UP ${upspeedf wlan0}${alignr}Total UP ${totalup wlan0}
#
${else}${if_up eth0}${voffset -20}${goto 60}${font style=bold}${font}
${goto 60}Internal IP: ${addr eth0}
${goto 60}External IP: ${exec wget -q -O - checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'}
${goto 60}${downspeedgraph eth0 25,100 110000 520000 -t} ${upspeedgraph eth0 25,100 001100 005200 -t}
${voffset -40}${goto 60}Down ${downspeedf eth0}${alignr}Total Dn ${totaldown eth0}
${goto 60}UP ${upspeedf eth0}${alignr}Total UP ${totalup eth0}${endif}${endif}
Last edited by akernan; June 6th, 2011 at 12:07 PM.
Right alignment is fairly easy using lua:
function conky_rjust(command, charwidth, end)
x = conky_parse(command)
x = string.len(x)
x = end - x * charwidth
x = "${goto "..x.."}"..command
return x
end
You would then call it with
${lua_parse rjust ${cpu cpu0} 7 400}
where 7 is the width of your font.
This of course only works for fixed width fonts.
returning a goto command with lua is a great idea
but it would be trickier than that
first when you give variables to lua in the conkyrc a space is used to seperate the variables so
${cpu cpu0} would be treated as 2 variables, the first read as command and the second read as charwidth
then there are other conky variables that have 3 parts
you could use a character in place of the spaces and then gsub the spaces back
send ${cpu;cpu0} then replace ";" with " "
then you could achieve the right adjust with any font using cairo_text_extents, you would have to send the font and font size to do this
Man conky is popular 18000+ post and 1800 pages! Way to go everyone!!!!
Walt
Dylan103 (Last Activity: October 23rd, 2006) created the monster and disappeared a day later.
Post all you're .conkyrc files with a screenshot please, Im interested in a basic, one liner at the top that has
CPU Usage, Free space on the hd, Time(12 hour), Ram, and network usage.
Sector recommended newer background .lua script and i moved to that one:
It works flawlessly on the main conky, which is aligned right, but the one on the left is a bit problematic - right hand corners won't get rounded.Code:--[[Background originally by londonali1010 (2009) ability to set any size for background mrpeachy 2011 ability to set variables for bg in conkyrc dk75 the conky bits that matter (sample): _ _ _ _ _ _ _ _ _ _ lua_load ~/lua/background.lua TEXT ${lua conky_draw_bg 10 100 100 100 100 0x000000 0.2} ${lua conky_draw_bg 10 200 200 100 100 0x000000 0.2} ${lua conky_draw_bg 10 100 300 100 100 0x000000 0.2} #${lua conky_draw_bg corner_radius x_position y_position width height color alpha} ${execpi 1800 conkyForecast --template=~/lua/test.template} _ _ _ _ _ _ _ _ _ _ test template: _ _ _ _ _ _ _ _ _ _ ${image [--datatype=WI --startday=1] -p 100,100 -s 90x90} ${image [--datatype=WI --startday=2] -p 200,200 -s 90x90} ${image [--datatype=WI --startday=3] -p 100,300 -s 90x90} ${image [--datatype=WI --startday=4] -p 200,400 -s 90x90} _ _ _ _ _ _ _ _ _ _ or you can have one background over the whole window and others to highlight parts of the conky _ _ _ _ _ _ _ _ _ _ TEXT ${lua conky_draw_bg 50 0 0 400 800 0x000000 0.2} # whole background ${lua conky_draw_bg 20 100 100 100 100 0x000000 0.2} # dark shade ${lua conky_draw_bg 0 200 200 100 100 0xffffff 0.2} # light square ${lua conky_draw_bg 50 100 300 100 100 0xff0000 0.2} # red circle _ _ _ _ _ _ _ _ _ _ ]] require 'cairo' local cs, cr = nil function rgb_to_r_g_b(colour,alpha) return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha end function conky_draw_bg(r,x,y,w,h,color,alpha) if conky_window == nil then return end if cs == nil then cairo_surface_destroy(cs) end if cr == nil then cairo_destroy(cr) end local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height) local cr = cairo_create(cs) cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha)) --top left mid circle local xtl=x+r local ytl=y+r --top right mid circle local xtr=(x+r)+((w)-(2*r)) local ytr=y+r --bottom right mid circle local xbr=(x+r)+((w)-(2*r)) local ybr=(y+r)+((h)-(2*r)) --bottom right mid circle local xbl=(x+r) local ybl=(y+r)+((h)-(2*r)) ----------------------------- cairo_move_to (cr,xtl,ytl-r) cairo_line_to (cr,xtr,ytr-r) cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4)) cairo_line_to (cr,xbr+r,ybr) cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1)) cairo_line_to (cr,xbl,ybl+r) cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2)) cairo_line_to (cr,xtl-r,ytl) cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3)) cairo_close_path(cr) cairo_fill (cr) ------------------------------------------------------------ cairo_surface_destroy(cs) cairo_destroy(cr) return "" end
This is no longer true. You must be using an old version. The lua api now recognizes conky commands as a single variable.first when you give variables to lua in the conkyrc a space is used to seperate the variables so
${cpu cpu0} would be treated as 2 variables, the first read as command and the second read as charwidth
Bookmarks