1,076

Re: My Conky Config

just a few changes and tweaks

http://omploader.org/tNHp1ag

-simplified the angles
-central ring now shows a cpu usage history bargraph around it
-memperc ring on the left - outer ring is current, subsequent rings are memperc from 5, 10 and 15 seconds ago

need to change the start point for memperc rings!

a clip if you want to see it working
http://jmcdowall.blip.tv/file/3907699/

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,077

Re: My Conky Config

mrpeachy wrote:

just a few changes and tweaks

http://omploader.org/tNHp1ag

-simplified the angles
-central ring now shows a cpu usage history bargraph around it
-memperc ring on the left - outer ring is current, subsequent rings are memperc from 5, 10 and 15 seconds ago

need to change the start point for memperc rings!

a clip if you want to see it working
http://jmcdowall.blip.tv/file/3907699/

That's awesome!

1,078

Re: My Conky Config

spamming thread with minor updates smile

but im quite pleased with how things are going...

http://omploader.org/tNHp2eQ

so we have in the top right cpu indicator ring and orbiting 5 min average circle
then going clockwise around the central ring (displaying cpu history bargraph) we have:

-clock (main ring with orbiting ring and circle)
-an inactive ring orbiting the central ring (any suggestions what this could do?)
-bar displaying downspeed as a percentage of my maximum downspeed
-bar displaying upspeed as a percentage of my max upspeed
-ring displaying memperc.  outer ring is current, then there are 10 rings, the first 1 second behind current.  then each successive ring 1 second behind.
-bar showing percent used of my first hdd
-bar showing percent used of my second hdd
-an inactive circle (again any ideas would be welcome)

I need a couple of more bars and then it's done!

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,079

Re: My Conky Config

ok, i think im finished

http://omploader.org/tNTA1MQ

and unlabeled is the cpu usage history around the middle ring

you just need this in conky:

lua_load /home/username/lua/newconky.lua
lua_draw_hook_pre draw_newconky
TEXT

and then you need the lua script saved as specified:
line 253 is where you can make some changes... specify position and define bars/ring

--abstract conky by mrpeachy 2010

require 'cairo'

function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end

function circlegraph(inum, text, ival, font, fsize, radi, horiz, verti, tred, tgreen, tblue, var1, var2)
deg=(360/inum)
text_arc=((2*math.pi/inum)*ival+var1)+(2*math.pi/(360)*45)
txs=0+radi*(math.sin(text_arc))
tys=0-radi*(math.cos(text_arc))
cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 22);
cairo_set_source_rgba (cr, tred, tgreen, tblue, 1);
cairo_translate (cr, txs+horiz, tys+verti)
cairo_rotate (cr, (deg*(ival+var2)*(math.pi/180)))
cairo_rectangle (cr, 0, 0, 1, (text*-1)*(30/100))
cairo_fill (cr)
cairo_rotate (cr, ((deg*(ival+var2)*(math.pi/180)*-1)))
cairo_translate (cr, -1*(txs+horiz), -1*(tys+verti))
end

function draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, lw, lr, lg, lb, la, rotate)
--indicator calculation
conum=tonumber(co)
local inum=(((width-lw)/100)*conum)
--background bar
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_source_rgba (cr, bgr, bgg, bgb, bga);
cairo_rectangle (cr, 0, 0, (width-lw), (height-lw))
cairo_fill (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 
--indicator bar
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_source_rgba (cr, inr, ing, inb, ina);
cairo_rectangle (cr, 0, 0, inum, (height-lw))
cairo_fill (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 
--boundary line
cairo_translate (cr, (across+(lw/2)), (down+(lw/2))) 
cairo_rotate (cr, rotate*math.pi/180)
cairo_set_line_width (cr, lw);
cairo_set_source_rgba (cr, lr, lg, lb, la);
cairo_rectangle (cr, -lw/2, -lw/2, width, height)
cairo_stroke (cr)
cairo_rotate (cr, (rotate*-1)*math.pi/180)
cairo_translate (cr, -1*(across+(lw/2)), -1*(down+(lw/2))) 
end

function draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder)
if rounded == 1 then
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
end
deg=(rend-rstart)/100
degrads=1*(math.pi/180)
start=rstart*degrads-math.pi/2
finish=rend*degrads-math.pi/2
interval=degrads*(start+(deg*(co)))
stx=0+rad*(math.sin(degrads*rstart))
sty=0-rad*(math.cos(degrads*rstart))
ftx=0+rad*(math.sin(degrads*rend))
fty=0-rad*(math.cos(degrads*rend))
-- Draw background ring
cairo_move_to (cr, across+stx, down+sty)
cairo_arc(cr,across,down,rad,start,finish)
cairo_set_source_rgba(cr,bgr,bgg,bgb,bga)
cairo_set_line_width(cr,inlw)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc(cr,across,down,rad,start,start+interval)
cairo_set_source_rgba(cr,inr,ing,inb,ina)
cairo_stroke(cr)
--boundary rings
cairo_set_line_cap  (cr, CAIRO_LINE_CAP_BUTT)
--outside boundary
cairo_arc(cr,across,down,(rad+(inlw/2)+(bolw/2)),start,finish)
cairo_set_source_rgba(cr,bor,bog,bob,boa)
cairo_set_line_width(cr,bolw)
cairo_stroke(cr)
if roundedborder == 1 then
xc=across+stx
yc=down+sty
radius=(inlw/2)+(bolw/2)
angle1=rstart*(math.pi/180.0)+math.pi/2
angle2=(rstart+180)*(math.pi/180.0)+math.pi/2
cairo_set_line_width (cr, bolw)
cairo_arc (cr, xc, yc, radius, angle1, angle2)
cairo_stroke (cr)
xc=across+ftx
yc=down+fty
radius=(inlw/2)+(bolw/2)
angle1=(rend+180)*(math.pi/180.0)+math.pi/2
angle2=rend*(math.pi/180.0)+math.pi/2
cairo_set_line_width (cr, bolw)
cairo_arc (cr, xc, yc, radius, angle1, angle2)
cairo_stroke (cr)
cairo_arc(cr,across,down,(rad-(inlw/2)-(bolw/2)),start,finish)
cairo_stroke(cr)
elseif roundedborder == 0 and squareborder == 0 then
--inside boundary
cairo_arc(cr,across,down,(rad-(inlw/2)-(bilw/2)),start,finish)
cairo_set_source_rgba(cr,bir,big,bib,bia)
cairo_set_line_width(cr,bilw)
cairo_stroke(cr)
end
if squareborder == 1 then
cairo_set_source_rgba(cr,bor,bog,bob,boa)
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT)
cairo_set_line_width(cr, bolw)
cairo_translate (cr, across+stx, down+sty)
cairo_rotate (cr, rstart*degrads)
cairo_move_to (cr, (bolw/2)*-1, (inlw/2)+bolw) 
cairo_rel_line_to (cr, 0 ,-1*((bolw*2)+inlw))
cairo_stroke (cr)
cairo_rotate (cr, rstart*degrads*-1)
cairo_translate (cr, -across-stx, -down-sty)
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT)
cairo_set_line_width(cr, bolw)
cairo_translate (cr, across+ftx, down+fty)
cairo_rotate (cr, rend*degrads)
cairo_move_to (cr, (bolw/2), (inlw/2)+bolw) 
cairo_rel_line_to (cr, 0 ,-1*((bolw*2)+inlw))
cairo_stroke (cr)
cairo_rotate (cr, rend*degrads*-1)
cairo_translate (cr, -across-ftx, -down-fty)
cairo_arc(cr,across,down,(rad-(inlw/2)-(bolw/2)),start,finish)
cairo_stroke(cr)
end
end

function draw_ringanti(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder)
if rounded == 1 then
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
end
deg=(rend-rstart)/100
degrads=1*(math.pi/180)
start=rstart*degrads-math.pi/2
finish=rend*degrads-math.pi/2
interval=degrads*(start-(deg*(co)))
stx=0+rad*(math.sin(degrads*rstart))
sty=0-rad*(math.cos(degrads*rstart))
ftx=0+rad*(math.sin(degrads*rend))
fty=0-rad*(math.cos(degrads*rend))
-- Draw background ring
cairo_move_to (cr, across+stx, down+sty)
cairo_arc_negative (cr,across,down,rad,start,finish)
cairo_set_source_rgba(cr,bgr,bgg,bgb,bga)
cairo_set_line_width(cr,inlw)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc_negative (cr,across,down,rad, start, start-interval)
cairo_set_source_rgba(cr,inr,ing,inb,ina)
cairo_stroke(cr)
if rounded == 1 then
--draw center circle
circrad=3
circx=across+stx
circy=down+sty
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_fill (cr)
end
--boundary rings
cairo_set_line_cap  (cr, CAIRO_LINE_CAP_BUTT)
--outside boundary
cairo_arc_negative(cr,across,down,(rad+(inlw/2)+(bolw/2)),start,finish)
cairo_set_source_rgba(cr,bor,bog,bob,boa)
cairo_set_line_width(cr,bolw)
cairo_stroke(cr)
if roundedborder == 1 then
xc=across+stx
yc=down+sty
radius=(inlw/2)+(bolw/2)
angle1=rstart*(math.pi/180.0)-math.pi/2
angle2=(rstart+180)*(math.pi/180.0)-math.pi/2
cairo_set_line_width (cr, bolw)
cairo_arc (cr, xc, yc, radius, angle1, angle2)
cairo_stroke (cr)
xc=across+ftx
yc=down+fty
radius=(inlw/2)+(bolw/2)
angle1=(rend+180)*(math.pi/180.0)-math.pi/2
angle2=rend*(math.pi/180.0)-math.pi/2
cairo_set_line_width (cr, bolw)
cairo_arc (cr, xc, yc, radius, angle1, angle2)
cairo_stroke (cr)
cairo_arc_negative(cr,across,down,(rad-(inlw/2)-(bolw/2)),start,finish)
cairo_stroke(cr)
elseif roundedborder == 0 and squareborder == 0 then
--inside boundary
cairo_arc_negative(cr,across,down,(rad-(inlw/2)-(bilw/2)),start,finish)
cairo_set_source_rgba(cr,bir,big,bib,bia)
cairo_set_line_width(cr,bilw)
cairo_stroke(cr)
end
if squareborder == 1 then
cairo_set_source_rgba(cr,bor,bog,bob,boa)
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT)
cairo_set_line_width(cr, bolw)
cairo_translate (cr, across+stx, down+sty)
cairo_rotate (cr, rstart*degrads)
cairo_move_to (cr, (bolw/2), (inlw/2)+bolw) 
cairo_rel_line_to (cr, 0 ,-1*((bolw*2)+inlw))
cairo_stroke (cr)
cairo_rotate (cr, rstart*degrads*-1)
cairo_translate (cr, -across-stx, -down-sty)
cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT)
cairo_set_line_width(cr, bolw)
cairo_translate (cr, across+ftx, down+fty)
cairo_rotate (cr, rend*degrads)
cairo_move_to (cr, (bolw/2)*-1, (inlw/2)+bolw) 
cairo_rel_line_to (cr, 0 ,-1*((bolw*2)+inlw))
cairo_stroke (cr)
cairo_rotate (cr, rend*degrads*-1)
cairo_translate (cr, -across-ftx, -down-fty)
cairo_arc_negative(cr,across,down,(rad-(inlw/2)-(bilw/2)),start,finish)
cairo_stroke(cr)
end
end

function conky_draw_newconky()
if conky_window == nil then 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)
local updates=tonumber(conky_parse('${updates}'))
if updates==1 then     
len_t=180
t1={}

len_t2=31
t2={}

min5length=(60*5)
min5table={}

end
if updates > 10 then
--user variables-------------------------------------------------------------------------------------
--position
horizontal=250
vertical=250
--bar setup
bar1=conky_parse("${fs_used_perc /}")
bar2=conky_parse("${fs_used_perc /media/Windows XP}")
bar3=conky_parse("${cpu}")
bar4=conky_parse("${cpu}")
bar5=conky_parse("${cpu}")
--ring setup
ring1=conky_parse("${cpu}")
--define max upspeed and downspeed (must be in bytes, here i have converted Mbits to bytes)
maxuploadspeed=(2.5*131072)
maxdownloadspeed=(14*131072)
--user variables end---------------------------------------------------------------------------------

--CENTRAL LARGE RING initial setup
hori=horizontal
vert=vertical
bigcircrad=55
--set width of circle
bigcircwidth=30

--small orbit ring
cairo_translate (cr, hori, vert)
outer1=bigcircrad+40
text_arc=((2*math.pi/(360))*155)
txs=0+outer1*(math.sin(text_arc))
tys=0-outer1*(math.cos(text_arc))
circrad=15
circx=txs
circy=tys
co=ring1
across=txs
down=tys
rad=circrad
inlw=4
rstart=155+180
rend=rstart+360
bgr, bgg, bgb, bga=0.3,0.3,0.3,1
inr, ing, inb, ina=0.5,0.5,0.5,1
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
cairo_translate (cr, -hori, -vert)

desk=conky_parse("${desktop}")
if desk=="1" then
dsk1=0.5
dsk2=0.3
dsk3=0.3
dsk4=0.3
else
if desk=="2" then
dsk1=0.3
dsk2=0.5
dsk3=0.3
dsk4=0.3
else
if desk=="3" then
dsk1=0.3
dsk2=0.3
dsk3=0.5
dsk4=0.3
else
if desk=="4" then
dsk1=0.3
dsk2=0.3
dsk3=0.3
dsk4=0.5
end
end
end
end

--small orbit circle1
cairo_translate (cr, hori, vert)
outer1=bigcircrad+40
text_arc=((2*math.pi/(360))*327)
txs=0+outer1*(math.sin(text_arc))
tys=0-outer1*(math.cos(text_arc))
circrad=7
circx=txs
circy=tys
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,dsk1,dsk1,dsk1,1)
cairo_fill (cr)
cairo_translate (cr, -hori, -vert)

--small orbit circle2
cairo_translate (cr, hori, vert)
outer1=bigcircrad+40
text_arc=((2*math.pi/(360))*337)
txs=0+outer1*(math.sin(text_arc))
tys=0-outer1*(math.cos(text_arc))
circrad=7
circx=txs
circy=tys
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,dsk2,dsk2,dsk2,1)
cairo_fill (cr)
cairo_translate (cr, -hori, -vert)

--small orbit circle3
cairo_translate (cr, hori, vert)
outer1=bigcircrad+40
text_arc=((2*math.pi/(360))*347)
txs=0+outer1*(math.sin(text_arc))
tys=0-outer1*(math.cos(text_arc))
circrad=7
circx=txs
circy=tys
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,dsk3,dsk3,dsk3,1)
cairo_fill (cr)
cairo_translate (cr, -hori, -vert)

--small orbit circle4
cairo_translate (cr, hori, vert)
outer1=bigcircrad+40
text_arc=((2*math.pi/(360))*357)
txs=0+outer1*(math.sin(text_arc))
tys=0-outer1*(math.cos(text_arc))
circrad=7
circx=txs
circy=tys
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,dsk4,dsk4,dsk4,1)
cairo_fill (cr)
cairo_translate (cr, -hori, -vert)

--bar1
co=bar1
if co==nil then co=0 end
width=80
height=5
outer1=bigcircrad+(bigcircwidth/2)-1
degplace=105
arc=((2*math.pi/360)*degplace)
txs=0+outer1*(math.sin(arc))
tys=0-outer1*(math.cos(arc))
across=hori+txs
down=vert-tys
bgr, bgg, bgb, bga=0.3,0.3,0.3,1
inr, ing, inb, ina=0.5,0.5,0.5,1
rotate=90+(360-degplace)
draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, 0, 0, 0, 0, 0, rotate)

--bar2
co=bar2
if co==nil then co=0 end
width=60
height=5
outer1=bigcircrad+(bigcircwidth/2)-1
degplace=75
arc=((2*math.pi/360)*degplace)
txs=0+outer1*(math.sin(arc))
tys=0-outer1*(math.cos(arc))
across=hori+txs
down=vert-tys
bgr, bgg, bgb, bga=0.3,0.3,0.3,1
inr, ing, inb, ina=0.5,0.5,0.5,1
rotate=90+(360-degplace)
draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, 0, 0, 0, 0, 0, rotate)

--bar3
co=bar3
if co==nil then co=0 end
width=80
height=5
outer1=bigcircrad+(bigcircwidth/2)-1
degplace=5
arc=((2*math.pi/360)*degplace)
txs=0+outer1*(math.sin(arc))
tys=0-outer1*(math.cos(arc))
across=hori+txs
down=vert-tys
bgr, bgg, bgb, bga=0.3,0.3,0.3,1
inr, ing, inb, ina=0.5,0.5,0.5,1
rotate=90+(360-degplace)
draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, 0, 0, 0, 0, 0, rotate)

--bar4
co=bar4
if co==nil then co=0 end
width=30
height=5
outer1=bigcircrad+(bigcircwidth/2)-1
degplace=335
arc=((2*math.pi/360)*degplace)
txs=0+outer1*(math.sin(arc))
tys=0-outer1*(math.cos(arc))
across=hori+txs
down=vert-tys
bgr, bgg, bgb, bga=0.3,0.3,0.3,1
inr, ing, inb, ina=0.5,0.5,0.5,1
rotate=90+(360-degplace)
draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, 0, 0, 0, 0, 0, rotate)

--bar5
co=bar5
if co==nil then co=0 end
width=50
height=5
outer1=bigcircrad+(bigcircwidth/2)-1
degplace=300
arc=((2*math.pi/360)*degplace)
txs=0+outer1*(math.sin(arc))
tys=0-outer1*(math.cos(arc))
across=hori+txs
down=vert-tys
bgr, bgg, bgb, bga=0.3,0.3,0.3,1
inr, ing, inb, ina=0.5,0.5,0.5,1
rotate=90+(360-degplace)
draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, 0, 0, 0, 0, 0, rotate)

--bars - upspeed
--this section formats upspeed
local upspeed=conky_parse("${upspeed}")
upnum=string.gsub(upspeed, "[%a ]", "")
upspcalc=string.split(upnum, "%p")
upumunit1=string.gsub(upspeed, "[%p%d]", "")
upumunit=string.gsub(upumunit1, "iB", "")
if upumunit=="K" then
if upspcalc[2]==nil then upspcalc[2]=0 end
upspeedout=(upspcalc[1]+(upspcalc[2]/100))*1024
else if upumunit=="M" then
if upspcalc[2]==nil then upspcalc[2]=0 end
upspeedout=(upspcalc[1]+(upspcalc[2]/100))*1048576
else
upspeedout=upspcalc[1]
end
end
--max upspeed
maxup=maxuploadspeed
width=60
height=5
co=(100/maxup)*upspeedout
outer1=bigcircrad+(bigcircwidth/2)-1
degplace=170
arc=((2*math.pi/360)*degplace)
txs=0+outer1*(math.sin(arc))
tys=0-outer1*(math.cos(arc))
across=hori+txs
down=vert-tys
bgr, bgg, bgb, bga=0.3,0.3,0.3,1
inr, ing, inb, ina=0.5,0.5,0.5,1
rotate=90+(360-degplace)
draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, 0, 0, 0, 0, 0, rotate)

--this section formats downspeed
local downspeed=conky_parse("${downspeed}")
downnum=string.gsub(downspeed, "[%a ]", "")
dwnspcalc=string.split(downnum, "%p")
dwnumunit1=string.gsub(downspeed, "[%p%d]", "")
dwnumunit=string.gsub(dwnumunit1, "iB", "")
if dwnumunit=="K" then
if dwnspcalc[2]==nil then dwnspcalc[2]=0 end
downspeedout=(dwnspcalc[1]+(dwnspcalc[2]/100))*1024
else if dwnumunit=="M" then
if dwnspcalc[2]==nil then dwnspcalc[2]=0 end
downspeedout=(dwnspcalc[1]+(dwnspcalc[2]/100))*1048576
else
downspeedout=dwnspcalc[1]
end
end
--max downspeed
maxdown=maxdownloadspeed
width=80
height=5
co=(100/maxdown)*downspeedout
outer1=bigcircrad+(bigcircwidth/2)-1
degplace=230
arc=((2*math.pi/360)*degplace)
txs=0+outer1*(math.sin(arc))
tys=0-outer1*(math.cos(arc))
across=hori+txs
down=vert-tys
bgr, bgg, bgb, bga=0.3,0.3,0.3,1
inr, ing, inb, ina=0.5,0.5,0.5,1
rotate=90+(360-degplace)
draw_bar(co, width, height, across, down, bgr, bgg, bgb, bga, inr, ing, inb, ina, 0, 0, 0, 0, 0, rotate)

--central ring continued
circx=hori
circy=vert
cairo_arc(cr,circx,circy,bigcircrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.3,0.3,0.3,1)
cairo_set_line_width(cr, bigcircwidth)
cairo_stroke (cr)

--MEM INDICATOR
--CIRCLE--SETUP-----------------------------------------------------------------
--conky object
for i = 1, tonumber(len_t2) do
if t2[i+1]==nil then t2[i+1]=0 end
t2[i]=t2[i+1]    
if i==len_t2 then
t2[len_t2]=tonumber(conky_parse('${memperc}'))
end
end 

--line to memperc
outer1=bigcircrad
arc=((2*math.pi/360)*270)
txs1=0+outer1*(math.sin(arc))
tys1=0-outer1*(math.cos(arc))
rad=36
outer1=rad
across=hori-150
down=vert
arc=((2*math.pi/360)*270)
txs2=0+outer1*(math.sin(arc))
tys2=0-outer1*(math.cos(arc))
cairo_move_to (cr, hori+txs1, vert+tys1)
cairo_line_to (cr, across-txs2, down-tys2)
cairo_set_line_width (cr, 13)
cairo_set_source_rgba(cr,0.3,0.3,0.3,1)
cairo_stroke (cr)

co=t2[len_t2]
--start and end degrees
rstart=90
rend=rstart+360
--linewidths inlw=indicator, bolw=boundary outside, bilw=boundary insdie
inlw=8
bolw=0
bilw=0
--line colors
--background, reg, green, blue, alpha
bgr, bgg, bgb, bga=0.3, 0.3, 0.3, 1
inr, ing, inb, ina=0.5, 0.5, 0.5, 1
bor, bog, bob, boa=1, 0, 1, 0.5
bir, big, bib, bia=0, 1, 1, 0.8
--line end 1=rounded, 0=square
rounded=0
--borders 1=present, 0=absent (if 1 then all boundary lines will take on color of outside boundary)
roundedborder=0 
squareborder=0

--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-1]
rad=31
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-2]
rad=29
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-3]
rad=27
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-4]
rad=25
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-5]
rad=23
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-6]
rad=21
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-7]
rad=19
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-8]
rad=17
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-9]
rad=15
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

co=t2[(len_t2)-10]
rad=13
inlw=2
--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 


--CPU INDICATOR
--CIRCLE--SETUP-----------------------------------------------------------------
--conky object
cpu=conky_parse('${cpu}')
co=cpu
-- position
across=hori+125
down=vert-125
--radius
rad=60
--start and end degrees
rstart=225
rend=rstart+360
--linewidths inlw=indicator, bolw=boundary outside, bilw=boundary insdie
inlw=8
bolw=0
bilw=0
--line colors
--background, reg, green, blue, alpha
bgr, bgg, bgb, bga=0.3, 0.3, 0.3, 1
inr, ing, inb, ina=0.5, 0.5, 0.5, 1
bor, bog, bob, boa=1, 0, 1, 0.5
bir, big, bib, bia=0, 1, 1, 0.8
--line end 1=rounded, 0=square
rounded=0
--borders 1=present, 0=absent (if 1 then all boundary lines will take on color of outside boundary)
roundedborder=0 
squareborder=0

--line to cpu
outer1=bigcircrad
arc=((2*math.pi/360)*45)
txs1=0+outer1*(math.sin(arc))
tys1=0-outer1*(math.cos(arc))
outer1=rad
arc=((2*math.pi/360)*45)
txs2=0+outer1*(math.sin(arc))
tys2=0-outer1*(math.cos(arc))
cairo_move_to (cr, hori+txs1, vert+tys1)
cairo_line_to (cr, across-txs2, down-tys2)
cairo_set_line_width (cr, 13)
cairo_set_source_rgba(cr,0.3,0.3,0.3,1)
cairo_stroke (cr)

--call draw function
draw_ring(co, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, inr, ing, inb, ina, bolw, bor, bog, bob, boa, bilw, bir, big, bib, bia, rounded, roundedborder, squareborder) 

--calculations
--CALCULATIONS OVER 5 MINUTES---------------------------------------------------
for i = 1, tonumber(min5length) do
if min5table[i+1]==nil then min5table[i+1]=0 end
min5table[i]=min5table[i+1]    
if i==min5length then
min5table[min5length]=tonumber(conky_parse('${cpu}'))
end
end   
--CALCULATE AVERAGE
sum5=0
for i=1,min5length do
if min5table[i]==nil then min5table[i]=0 end
sum5=sum5+min5table[i]
end

--cpu orbit 1 cycle behind
cairo_translate (cr, across, down)
outer1=80
text_arc=(2*math.pi/(100)*(sum5/min5length))+(2*math.pi/(360)*rstart)
txs=0+outer1*(math.sin(text_arc))
tys=0-outer1*(math.cos(text_arc))
circrad=10
circx=txs
circy=tys
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.5,0.5,0.5,1)
cairo_fill (cr)
cairo_translate (cr, -across, -down)

--CLOCK SECTION-------------------------------------------------------------
--hours
hrs=os.date("%I")
--minutes
min=os.date("%M")
--seconds
sec=os.date("%S")
--seconds indicator-------------------------------------------------------------
-- position
across=hori+(150)
down=vert+(150)
--radius
rad=60
--start and end degrees
secperc=(sec/60)*100
secperc2=secperc*(360/100)
rstart=secperc2-4
rend=secperc2
--line width
inlw=8
--line color
bgr, bgg, bgb, bga=0.5, 0.5, 0.5, 1

--background ring
circrad=rad
circx=across
circy=down
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.3,0.3,0.3,1)
cairo_set_line_width(cr, inlw)
cairo_stroke (cr)

--line to clock
outer1=bigcircrad
arc=((2*math.pi/360)*135)
txs1=0+outer1*(math.sin(arc))
tys1=0-outer1*(math.cos(arc))
outer1=rad
arc=((2*math.pi/360)*135)
txs2=0+outer1*(math.sin(arc))
tys2=0-outer1*(math.cos(arc))
cairo_move_to (cr, hori+txs1, vert+tys1)
cairo_line_to (cr, across-txs2, down-tys2)
cairo_set_line_width (cr, 13)
cairo_stroke (cr)

--call draw function
draw_ring(0, across, down, rad, inlw, rstart, rend, bgr, bgg, bgb, bga, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 

--central circle
circrad=rad-40
circx=across
circy=down
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.3,0.3,0.3,1)
cairo_fill (cr)

--min indicator
minsecs=(min*60)+sec
cairo_translate (cr, across, down)
outer1=rad+25
text_arc=((2*math.pi/(60*60))*minsecs)
txs=0+outer1*(math.sin(text_arc))
tys=0-outer1*(math.cos(text_arc))
circrad=10
circx=txs
circy=tys
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.4,0.4,0.4,1)
cairo_fill (cr)
cairo_translate (cr, -across, -down)

--hour indicator
hoursecs=(hrs*60*60)+minsecs
cairo_translate (cr, across, down)
outer1=rad+25
text_arc=((2*math.pi/(43200))*hoursecs)
txs=0+outer1*(math.sin(text_arc))
tys=0-outer1*(math.cos(text_arc))
circrad=15
circx=txs
circy=tys
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.5,0.5,0.5,1)
cairo_set_line_width(cr, 4)
cairo_stroke (cr)
cairo_translate (cr, -across, -down)


for i = 1, tonumber(len_t) do
            if t1[i+1]==nil then t1[i+1]=0 end
            t1[i]=t1[i+1]    
            if i==len_t then
                t1[len_t]=tonumber(conky_parse('${cpu}'))
            end
            --circlegraph (inum, text, ival, font, fsize, radi, horiz, verti, tred, tgreen, tblue, var1, var2)
            circlegraph(len_t, t1[i], i, "Mono", 1, 40, hori, vert, 0.5, 0.5, 0.5, 0, 45/2)
      end  

--line connecting cpu to history
outer1=bigcircrad-15
arc=((2*math.pi/360)*45)
txs1=0+outer1*(math.sin(arc))
tys1=0-outer1*(math.cos(arc))
-- position
across=hori+125
down=vert-125
--radius
rad=56
outer1=rad
arc=((2*math.pi/360)*45)
txs2=0+outer1*(math.sin(arc))
tys2=0-outer1*(math.cos(arc))
cairo_move_to (cr, hori+txs1, vert+tys1)
cairo_line_to (cr, across-txs2, down-tys2)
cairo_set_line_width (cr, 1)
cairo_set_source_rgba(cr,0.5,0.5,0.5,1)
cairo_stroke (cr)

end
end

the code isnt pretty and i cant guarantee it will work for anyone else who tries it big_smile

Last edited by mrpeachy (2010-07-21 21:09:52)

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,080

Re: My Conky Config

mrpeachy wrote:

the code isnt pretty and i cant guarantee it will work for anyone else who tries it big_smile

I'm chomping at the bit to have a go at it...

1,081

Re: My Conky Config

Sector11 wrote:

I'm chomping at the bit to have a go at it...

let me know how it goes.  ill be more than glad to help troubleshoot if anything doesn't work

and maybe sometime i'll go through the script, clean it up and make it more accessible!

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,082

Re: My Conky Config

mrpeachy wrote:
Sector11 wrote:

I'm chomping at the bit to have a go at it...

let me know how it goes.  ill be more than glad to help troubleshoot if anything doesn't work

and maybe sometime i'll go through the script, clean it up and make it more accessible!

Weeeeeeeeeelllllllllllllllllllllll!!!!!!!!!

 0 $ conky -c ~/Conky/mrpeachy/newconky
Conky: desktop window (1ad) is root window
Conky: window type - normal
Conky: drawing to created window (0x2200001)
Conky: drawing to single buffer
Conky: llua_do_call: function conky_draw_newconky execution failed: /home/sector11/Conky/mrpeachy/newconky.lua:73: attempt to perform arithmetic on local 'co' (a string value)
Conky: llua_do_call: function conky_draw_newconky execution failed: /home/sector11/Conky/mrpeachy/newconky.lua:73: attempt to perform arithmetic on local 'co' (a nil value)

Line 73

interval=degrads*(start+(deg*(co)))

1,083

Re: My Conky Config

Sector11 wrote:
mrpeachy wrote:
Sector11 wrote:

I'm chomping at the bit to have a go at it...

let me know how it goes.  ill be more than glad to help troubleshoot if anything doesn't work

and maybe sometime i'll go through the script, clean it up and make it more accessible!

Weeeeeeeeeelllllllllllllllllllllll!!!!!!!!!

 0 $ conky -c ~/Conky/mrpeachy/newconky
Conky: desktop window (1ad) is root window
Conky: window type - normal
Conky: drawing to created window (0x2200001)
Conky: drawing to single buffer
Conky: llua_do_call: function conky_draw_newconky execution failed: /home/sector11/Conky/mrpeachy/newconky.lua:73: attempt to perform arithmetic on local 'co' (a string value)
Conky: llua_do_call: function conky_draw_newconky execution failed: /home/sector11/Conky/mrpeachy/newconky.lua:73: attempt to perform arithmetic on local 'co' (a nil value)

Line 73

interval=degrads*(start+(deg*(co)))

yes, it does that with me too... but i assume it gets up and running afterwards?
the script just needs a few cycles to work out the kinks smile

you can get rid of the first error by changing line 73 to this:

interval=degrads*(start+(deg*(tonumber(co))))

but i can't immediately identify the "nil value" error, although i would think it is most likely due to the process of initializing the tables or possibly $cpu variable initialization.

Last edited by mrpeachy (2010-07-22 16:06:38)

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,084

Re: My Conky Config

just a bit of nonsense from me...  with crunchbang going debian... i thought a debian swirl indicator!

http://omploader.org/tNTBnMw

shows cpu usage.

a little basic and easy to do, need some way of making it continuous

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,085

Re: My Conky Config

mrpeachy wrote:
Sector11 wrote:
mrpeachy wrote:

let me know how it goes.  ill be more than glad to help troubleshoot if anything doesn't work

and maybe sometime i'll go through the script, clean it up and make it more accessible!

Weeeeeeeeeelllllllllllllllllllllll!!!!!!!!!

 0 $ conky -c ~/Conky/mrpeachy/newconky
Conky: desktop window (1ad) is root window
Conky: window type - normal
Conky: drawing to created window (0x2200001)
Conky: drawing to single buffer
Conky: llua_do_call: function conky_draw_newconky execution failed: /home/sector11/Conky/mrpeachy/newconky.lua:73: attempt to perform arithmetic on local 'co' (a string value)
Conky: llua_do_call: function conky_draw_newconky execution failed: /home/sector11/Conky/mrpeachy/newconky.lua:73: attempt to perform arithmetic on local 'co' (a nil value)

Line 73

interval=degrads*(start+(deg*(co)))

yes, it does that with me too... but i assume it gets up and running afterwards?
the script just needs a few cycles to work out the kinks smile

you can get rid of the first error by changing line 73 to this:

interval=degrads*(start+(deg*(tonumber(co))))

but i can't immediately identify the "nil value" error, although i would think it is most likely due to the process of initializing the tables or possibly $cpu variable initialization.

I'm guessing CPU - I only have one and I see:

--user variables---
--position
horizontal=250
vertical=250
--bar setup
bar1=conky_parse("${fs_used_perc /}")
bar2=conky_parse("${fs_used_perc /media/5}")
bar3=conky_parse("${cpu}")
bar4=conky_parse("${cpu}")
bar5=conky_parse("${cpu}")
--ring setup
ring1=conky_parse("${cpu}")
--define max upspeed and downspeed (must be in bytes, here i have converted Mbits to bytes)
maxuploadspeed=(2.5*131072)
maxdownloadspeed=(14*131072)
--user variables end---

1,086

Re: My Conky Config

mrpeachy wrote:

just a bit of nonsense from me...  with crunchbang going debian... i thought a debian swirl indicator!

http://omploader.org/tNTBnMw

shows cpu usage.

a little basic and easy to do, need some way of making it continuous

big_smile

1,087

Re: My Conky Config

Sector11 wrote:

I'm guessing CPU - I only have one and I see:

--user variables---
--position
horizontal=250
vertical=250
--bar setup
bar1=conky_parse("${fs_used_perc /}")
bar2=conky_parse("${fs_used_perc /media/5}")
bar3=conky_parse("${cpu}")
bar4=conky_parse("${cpu}")
bar5=conky_parse("${cpu}")
--ring setup
ring1=conky_parse("${cpu}")
--define max upspeed and downspeed (must be in bytes, here i have converted Mbits to bytes)
maxuploadspeed=(2.5*131072)
maxdownloadspeed=(14*131072)
--user variables end---

those multiple calls for the  $cpu object are just because I had 3 spare bars and a ring and nothing to assign them to smile

you can reset any of those bars to whatever conky object you want... battery percent, wireless link quality etc etc (i don't have those things so i just set them all to cpu)

it isn't asking for readings from multiple cpu's just taking the reading from my single cpu and displaying it multiple times.

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,088

Re: My Conky Config

Yo men I'm sorry if I'm in late in this post anyway this is my conky config:

#        This program is free software; you can redistribute it and/or modify
#        it under the terms of the GNU General Public License as published by
#        the Free Software Foundation; either version 2 of the License, or
#        (at your option) any later version.
#       
#        This program is distributed in the hope that it will be useful,
#        but WITHOUT ANY WARRANTY; without even the implied warranty of
#        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#        GNU General Public License for more details.
#       
#        You should have received a copy of the GNU General Public License
#        along with this program; if not, write to the Free Software
#        Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#        MA 02110-1301, USA.

#        coded by sysxash with its mind secureworld.hellospace.net


background yes
use_xft yes
xftfont HandelGotD:size=9
xftalpha 0.5
update_interval 1.0
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 5
maximum_width 220
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color grey
default_shade_color red
default_outline_color green
alignment top_right
gap_x 12
gap_y 48
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no

TEXT
SYSTEM ${hr 2}
$sysname $kernel on $machine

Uptime $alignr $uptime
Load $alignr $loadavg

$processes processes ($running_processes running)

PROCESSORS ${hr 2}
Frequence (in MHz): $freq

CPU $alignr ${cpu cpu0}%
${cpubar cpu0}

${cpugraph log 53baff 00f880}

MEMORY ${hr 2}

MEM $alignc $mem / $memmax $alignr $memperc%
$membar

/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_free_perc /}%
${fs_bar /}

/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%
${fs_bar /home}

swap $alignc $swap / $swapmax $alignr $swapperc%
${swapbar}

TOP PROCESSES ${hr 2}

NAME $alignr PID    CPU
${top name 1} $alignr ${top pid 1} ${top cpu 1}
${top name 2} $alignr ${top pid 2} ${top cpu 2}
${top name 3} $alignr ${top pid 3} ${top cpu 3}
${top name 4} $alignr ${top pid 4} ${top cpu 4}
${top name 5} $alignr ${top pid 5} ${top cpu 5}
${top name 6} $alignr ${top pid 6} ${top cpu 6}
${top name 7} $alignr ${top pid 7} ${top cpu 7}
${top name 8} $alignr ${top pid 8} ${top cpu 8}

I did this 2 days ago when I was bored....

http://i32.tinypic.com/s28mef.jpg

1,089

Re: My Conky Config

I read mrpeachy's signature and went to his blog.

And found his green dot conky and thought ... #! Statler ... Debian.

So this is to honour mrpeachy for his conky and corenominal for "#! Statler"

The clock is a 24 hour clock - Hours 1-12 = Yellow,  13-0 Chartreuse
Non-hours = LightSlateGrey

10pm ->http://omploader.org/tNTFibQ <--> http://omploader.org/tNTFidQ <--> http://omploader.org/tNTFoZg <- 10am

#! font = blockycounterclockwise, and
the main font: xspiralmental


# To use #! in a conky use: ${exec echo '#!'}
background no
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints skip_taskbar,skip_pager
own_window_title DotsBox
double_buffer yes
use_spacer right
override_utf8_locale yes
use_xft yes
font xspiralmental:size=11.5
xftalpha 1
update_interval 0.5
uppercase no
stippled_borders 0
border_inner_margin 0
border_width 0
default_outline_color black
default_shade_color black
draw_borders no
draw_graph_borders no
draw_outline yes
draw_shades yes

default_color 778899
color0 7FFF00
color1 FFFF00

text_buffer_size 2048
no_buffers yes
short_units yes
pad_percents 2

#max_specials 1024
#max_user_text 10000

# Layout
alignment tr
gap_x 10 # left-right
gap_y 10 # up-down

# The clock is a 24 hour clock
# Hours 1-12 = Yellow 13-0 Chartreuse
# Non-hours = LightSlateGrey

TEXT
${font blockycounterclockwise:size=30} ${exec echo '#!'}${font}
${if_match ${time %H} == 1}${color1}${else}${if_match ${time %H} == 13}${color0}${else}${color}${endif}${endif}B${if_match ${time %H} == 2}${color1}${else}${if_match ${time %H} == 14}${color0}${else}${color}${endif}${endif}B${if_match ${time %H} == 3}${color1}${else}${if_match ${time %H} == 15}${color0}${else}${color}${endif}${endif}B${goto 56}${if_match ${time %m} == 1}${color0}${else}${color}${endif}B${if_match ${time %m} == 2}${color0}${else}${color}${endif}B${if_match ${time %m} == 3}${color0}${else}${color}${endif}B
${if_match ${time %H} == 4}${color1}${else}${if_match ${time %H} == 16}${color0}${else}${color}${endif}${endif}B${if_match ${time %H} == 5}${color1}${else}${if_match ${time %H} == 17}${color0}${else}${color}${endif}${endif}B${if_match ${time %H} == 6}${color1}${else}${if_match ${time %H} == 18}${color0}${else}${color}${endif}${endif}B ${goto 56}${if_match ${time %m} == 4}${color0}${else}${color}${endif}B${if_match ${time %m} == 5}${color0}${else}${color}${endif}B${if_match ${time %m} == 6}${color0}${else}${color}${endif}B
${if_match ${time %H} == 7}${color1}${else}${if_match ${time %H} == 19}${color0}${else}${color}${endif}${endif}B${if_match ${time %H} == 8}${color1}${else}${if_match ${time %H} == 20}${color0}${else}${color}${endif}${endif}B${if_match ${time %H} == 9}${color1}${else}${if_match ${time %H} == 21}${color0}${else}${color}${endif}${endif}B ${goto 56}${if_match ${time %m} == 7}${color0}${else}${color}${endif}B${if_match ${time %m} == 8}${color0}${else}${color}${endif}B${if_match ${time %m} == 9}${color0}${else}${color}${endif}B
${if_match ${time %H} == 10}${color1}${else}${if_match ${time %H} == 22}${color0}${else}${color}${endif}${endif}B${if_match ${time %H} == 11}${color1}${else}${if_match ${time %H} == 23}${color0}${else}${color}${endif}${endif}B${if_match ${time %H} == 12}${color1}${else}${if_match ${time %H} == 0}${color0}${else}${color}${endif}${endif}B  ${goto 56}${if_match ${time %m} == 10}${color0}${else}${color}${endif}B${if_match ${time %m} == 11}${color0}${else}${color}${endif}B${if_match ${time %m} == 12}${color0}${else}${color}${endif}B

${if_match ${time %M} == 10}${color0}${else}${color}${if_match ${time %M} == 11}${color0}${else}${color}${if_match ${time %M} == 12}${color0}${else}${color}${if_match ${time %M} == 13}${color0}${else}${color}${if_match ${time %M} == 14}${color0}${else}${color}${if_match ${time %M} == 15}${color0}${else}${color}${if_match ${time %M} == 16}${color0}${else}${color}${if_match ${time %M} == 17}${color0}${else}${color}${if_match ${time %M} == 18}${color0}${else}${color}${if_match ${time %M} == 19}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 20}${color0}${else}${color}${if_match ${time %M} == 21}${color0}${else}${color}${if_match ${time %M} == 22}${color0}${else}${color}${if_match ${time %M} == 23}${color0}${else}${color}${if_match ${time %M} == 24}${color0}${else}${color}${if_match ${time %M} == 25}${color0}${else}${color}${if_match ${time %M} == 26}${color0}${else}${color}${if_match ${time %M} == 27}${color0}${else}${color}${if_match ${time %M} == 28}${color0}${else}${color}${if_match ${time %M} == 29}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 30}${color0}${else}${color}${if_match ${time %M} == 31}${color0}${else}${color}${if_match ${time %M} == 32}${color0}${else}${color}${if_match ${time %M} == 33}${color0}${else}${color}${if_match ${time %M} == 34}${color0}${else}${color}${if_match ${time %M} == 35}${color0}${else}${color}${if_match ${time %M} == 36}${color0}${else}${color}${if_match ${time %M} == 37}${color0}${else}${color}${if_match ${time %M} == 38}${color0}${else}${color}${if_match ${time %M} == 39}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}B  ${goto 56}${if_match ${time %d} == 10}${color0}${else}${color}${if_match ${time %d} == 11}${color0}${else}${color}${if_match ${time %d} == 12}${color0}${else}${color}${if_match ${time %d} == 13}${color0}${else}${color}${if_match ${time %d} == 14}${color0}${else}${color}${if_match ${time %d} == 15}${color0}${else}${color}${if_match ${time %d} == 16}${color0}${else}${color}${if_match ${time %d} == 17}${color0}${else}${color}${if_match ${time %d} == 18}${color0}${else}${color}${if_match ${time %d} == 19}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %d} == 20}${color0}${else}${color}${if_match ${time %d} == 21}${color0}${else}${color}${if_match ${time %d} == 22}${color0}${else}${color}${if_match ${time %d} == 23}${color0}${else}${color}${if_match ${time %d} == 24}${color0}${else}${color}${if_match ${time %d} == 25}${color0}${else}${color}${if_match ${time %d} == 26}${color0}${else}${color}${if_match ${time %d} == 27}${color0}${else}${color}${if_match ${time %d} == 28}${color0}${else}${color}${if_match ${time %d} == 29}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %d} == 30}${color0}${else}${color}${if_match ${time %d} == 31}${color0}${else}${color}${if_match ${time %d} == 32}${color0}${else}${color}${if_match ${time %d} == 33}${color0}${else}${color}${if_match ${time %d} == 34}${color0}${else}${color}${if_match ${time %d} == 35}${color0}${else}${color}${if_match ${time %d} == 36}${color0}${else}${color}${if_match ${time %d} == 37}${color0}${else}${color}${if_match ${time %d} == 38}${color0}${else}${color}${if_match ${time %d} == 39}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}B
${if_match ${time %M} == 40}${color0}${else}${color}${if_match ${time %M} == 41}${color0}${else}${color}${if_match ${time %M} == 42}${color0}${else}${color}${if_match ${time %M} == 43}${color0}${else}${color}${if_match ${time %M} == 44}${color0}${else}${color}${if_match ${time %M} == 45}${color0}${else}${color}${if_match ${time %M} == 46}${color0}${else}${color}${if_match ${time %M} == 47}${color0}${else}${color}${if_match ${time %M} == 48}${color0}${else}${color}${if_match ${time %M} == 49}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 50}${color0}${else}${color}${if_match ${time %M} == 51}${color0}${else}${color}${if_match ${time %M} == 52}${color0}${else}${color}${if_match ${time %M} == 53}${color0}${else}${color}${if_match ${time %M} == 54}${color0}${else}${color}${if_match ${time %M} == 55}${color0}${else}${color}${if_match ${time %M} == 56}${color0}${else}${color}${if_match ${time %M} == 57}${color0}${else}${color}${if_match ${time %M} == 58}${color0}${else}${color}${if_match ${time %M} == 59}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}B${color}B

${if_match ${time %M} == 01}${color0}${else}${color}${if_match ${time %M} == 11}${color0}${else}${color}${if_match ${time %M} == 21}${color0}${else}${color}${if_match ${time %M} == 31}${color0}${else}${color}${if_match ${time %M} == 41}${color0}${else}${color}${if_match ${time %M} == 51}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 02}${color0}${else}${color}${if_match ${time %M} == 12}${color0}${else}${color}${if_match ${time %M} == 22}${color0}${else}${color}${if_match ${time %M} == 32}${color0}${else}${color}${if_match ${time %M} == 42}${color0}${else}${color}${if_match ${time %M} == 52}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 03}${color0}${else}${color}${if_match ${time %M} == 13}${color0}${else}${color}${if_match ${time %M} == 23}${color0}${else}${color}${if_match ${time %M} == 33}${color0}${else}${color}${if_match ${time %M} == 43}${color0}${else}${color}${if_match ${time %M} == 53}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B  ${goto 56}${if_match ${time %d} == 01}${color0}${else}${color}${if_match ${time %d} == 11}${color0}${else}${color}${if_match ${time %d} == 21}${color0}${else}${color}${if_match ${time %d} == 31}${color0}${else}${color}${if_match ${time %d} == 41}${color0}${else}${color}${if_match ${time %d} == 51}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %d} == 02}${color0}${else}${color}${if_match ${time %d} == 12}${color0}${else}${color}${if_match ${time %d} == 22}${color0}${else}${color}${if_match ${time %d} == 32}${color0}${else}${color}${if_match ${time %d} == 42}${color0}${else}${color}${if_match ${time %d} == 52}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %d} == 03}${color0}${else}${color}${if_match ${time %d} == 13}${color0}${else}${color}${if_match ${time %d} == 23}${color0}${else}${color}${if_match ${time %d} == 33}${color0}${else}${color}${if_match ${time %d} == 43}${color0}${else}${color}${if_match ${time %d} == 53}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B
${if_match ${time %M} == 04}${color0}${else}${color}${if_match ${time %M} == 14}${color0}${else}${color}${if_match ${time %M} == 24}${color0}${else}${color}${if_match ${time %M} == 34}${color0}${else}${color}${if_match ${time %M} == 44}${color0}${else}${color}${if_match ${time %M} == 54}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 05}${color0}${else}${color}${if_match ${time %M} == 15}${color0}${else}${color}${if_match ${time %M} == 25}${color0}${else}${color}${if_match ${time %M} == 35}${color0}${else}${color}${if_match ${time %M} == 45}${color0}${else}${color}${if_match ${time %M} == 55}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 06}${color0}${else}${color}${if_match ${time %M} == 16}${color0}${else}${color}${if_match ${time %M} == 26}${color0}${else}${color}${if_match ${time %M} == 36}${color0}${else}${color}${if_match ${time %M} == 46}${color0}${else}${color}${if_match ${time %M} == 56}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${goto 56}${if_match ${time %d} == 04}${color0}${else}${color}${if_match ${time %d} == 14}${color0}${else}${color}${if_match ${time %d} == 24}${color0}${else}${color}${if_match ${time %d} == 34}${color0}${else}${color}${if_match ${time %d} == 44}${color0}${else}${color}${if_match ${time %d} == 54}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %d} == 05}${color0}${else}${color}${if_match ${time %d} == 15}${color0}${else}${color}${if_match ${time %d} == 25}${color0}${else}${color}${if_match ${time %d} == 35}${color0}${else}${color}${if_match ${time %d} == 45}${color0}${else}${color}${if_match ${time %d} == 55}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %d} == 06}${color0}${else}${color}${if_match ${time %d} == 16}${color0}${else}${color}${if_match ${time %d} == 26}${color0}${else}${color}${if_match ${time %d} == 36}${color0}${else}${color}${if_match ${time %d} == 46}${color0}${else}${color}${if_match ${time %d} == 56}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B
${if_match ${time %M} == 07}${color0}${else}${color}${if_match ${time %M} == 17}${color0}${else}${color}${if_match ${time %M} == 27}${color0}${else}${color}${if_match ${time %M} == 37}${color0}${else}${color}${if_match ${time %M} == 47}${color0}${else}${color}${if_match ${time %M} == 57}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 08}${color0}${else}${color}${if_match ${time %M} == 18}${color0}${else}${color}${if_match ${time %M} == 28}${color0}${else}${color}${if_match ${time %M} == 38}${color0}${else}${color}${if_match ${time %M} == 48}${color0}${else}${color}${if_match ${time %M} == 58}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %M} == 09}${color0}${else}${color}${if_match ${time %M} == 19}${color0}${else}${color}${if_match ${time %M} == 29}${color0}${else}${color}${if_match ${time %M} == 39}${color0}${else}${color}${if_match ${time %M} == 49}${color0}${else}${color}${if_match ${time %M} == 59}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${goto 56}${if_match ${time %d} == 07}${color0}${else}${color}${if_match ${time %d} == 17}${color0}${else}${color}${if_match ${time %d} == 27}${color0}${else}${color}${if_match ${time %d} == 37}${color0}${else}${color}${if_match ${time %d} == 47}${color0}${else}${color}${if_match ${time %d} == 57}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %d} == 08}${color0}${else}${color}${if_match ${time %d} == 18}${color0}${else}${color}${if_match ${time %d} == 28}${color0}${else}${color}${if_match ${time %d} == 38}${color0}${else}${color}${if_match ${time %d} == 48}${color0}${else}${color}${if_match ${time %d} == 58}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B${if_match ${time %d} == 09}${color0}${else}${color}${if_match ${time %d} == 19}${color0}${else}${color}${if_match ${time %d} == 29}${color0}${else}${color}${if_match ${time %d} == 39}${color0}${else}${color}${if_match ${time %d} == 49}${color0}${else}${color}${if_match ${time %d} == 59}${color0}${else}${color}${endif}${endif}${endif}${endif}${endif}${endif}B

${font xspiralmental:size=9}${if_match ${cpu cpu1} >0}${color0}${else}${color1}${endif}B${if_match ${cpu cpu1} >10}${color0}${else}${color}${endif}B${if_match ${cpu cpu1} >20}${color0}${else}${color}${endif}B${if_match ${cpu cpu1} >30}${color0}${else}${color}${endif}B${if_match ${cpu cpu1} >40}${color0}${else}${color}${endif}B${if_match ${cpu cpu1} >50}${color0}${else}${color}${endif}B${if_match ${cpu cpu1} >60}${color0}${else}${color}${endif}B${if_match ${cpu cpu1} >70}${color0}${else}${color}${endif}B${if_match ${cpu cpu1} >80}${color0}${else}${color}${endif}B${if_match ${cpu cpu1} >90}${color0}${else}${color}${endif}B
${if_match ${memperc} >0}${color0}${else}${color}${endif}B${if_match ${memperc} >10}${color0}${else}${color}${endif}B${if_match ${memperc} >20}${color0}${else}${color}${endif}B${if_match ${memperc} >30}${color0}${else}${color}${endif}B${if_match ${memperc} >40}${color0}${else}${color}${endif}B${if_match ${memperc} >50}${color0}${else}${color}${endif}B${if_match ${memperc} >60}${color0}${else}${color}${endif}B${if_match ${memperc} >70}${color0}${else}${color}${endif}B${if_match ${memperc} >80}${color0}${else}${color}${endif}B${if_match ${memperc} >90}${color0}${else}${color}${endif}B

Enjoy

Last edited by Sector11 (2010-09-09 21:07:54)

1,090

Re: My Conky Config

Sector11 wrote:

I read mrpeachy's signature and went to his blog.

And found his green dot conky and thought ... #! Statler ... Debian.

So this is to honour mrpeachy for his conky and corenominal for "#! Statler"

The clock is a 24 hour clock - Hours 1-12 = Yellow,  13-0 Chartreuse
Non-hours = LightSlateGrey

http://omploader.org/tNTFibQ <--> http://omploader.org/tNTFidQ

ah yes... so very long ago *eyes go misty with reminiscence*

just think... i could take the swirl indicator i posted earlier, shrink it down and have every one of those swirls above active, and changing color so that the clock/calendar/bars would also be active...

add in some time delay to get a sweeping effect across the display...

...a cpu bar made up of tiny cpu indicators ... where would such madness end?? big_smile

Last edited by mrpeachy (2010-07-25 02:24:17)

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,091

Re: My Conky Config

mrpeachy wrote:

ah yes... so very long ago *eyes go misty with reminiscence*

Loved that one from the first time I saw it.

mrpeachy wrote:

just think... i could take the swirl indicator i posted earlier, shrink it down and have every one of those swirls above active, and changing color so that the clock/calendar/bars would also be active...

yes...

mrpeachy wrote:

add in some time delay to get a sweeping effect across the display...

Oh Yes!!!

mrpeachy wrote:

...a cpu bar made up of tiny cpu indicators ...

OH YEA!  So have you finished it yet?  lol lol

mrpeachy wrote:

where would such madness end?? big_smile

It would never end conky is a never ending process!

Here is it with 13 hours between them: 21:00 and 10:00

http://omploader.org/tNTFibQ<--9pm --- 10am-->http://omploader.org/tNTFoZg
Wht 24hrs?  Because I could  big_smile

Last edited by Sector11 (2010-07-25 14:28:28)

1,092

Re: My Conky Config

OK, a new conky!

mrpeachy is doing his thing with LUA so I decided to something with images - because I can't write LUA.  And it seems since LUA came on the scene people basically forget about images.  Unless they use conkyForecast.

Images are FUN!

And lets face, it there are a million images, OK and exaggeration, just waiting to be used on your computer that people just don't think about - your icons!  These red ones I grabbed off the Internet, they were .svg files I converted to .png files.  I also had this conky done using: ~/.icons/ACYL_Icon_Theme_0.8.2/scalable/stock - the brasero disk set - but I like dark themes and my wife lighter ones so I had to come up with something for both. 

It's a one liner ... and I mean one really Super LONG one line - right after TEXT! big_smile

http://omploader.org/tNTJvdQ <<--->> http://omploader.org/tNTJwNg

If there is no activity you see the white 0 in the centre.  Other than that the arrow moves at 5% increments and at 100% the arrow is straight up.  For DOWN the increment is 20 up to 400, if you need something higher you'll need to edit that.

Here's what the section for CPU: looks liked while I was creating/editing it:

${if_match ${cpu} <=4}${image ~/Conky/image_disks/RW-00.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=9}${image ~/Conky/image_disks/RW-05.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=14}${image ~/Conky/image_disks/RW-10.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=19}${image ~/Conky/image_disks/RW-15.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=24}${image ~/Conky/image_disks/RW-20.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=29}${image ~/Conky/image_disks/RW-25.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=34}${image ~/Conky/image_disks/RW-30.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=39}${image ~/Conky/image_disks/RW-35.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=44}${image ~/Conky/image_disks/RW-40.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=49}${image ~/Conky/image_disks/RW-45.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=54}${image ~/Conky/image_disks/RW-50.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=59}${image ~/Conky/image_disks/RW-55.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=64}${image ~/Conky/image_disks/RW-60.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=69}${image ~/Conky/image_disks/RW-65.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=74}${image ~/Conky/image_disks/RW-70.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=79}${image ~/Conky/image_disks/RW-75.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=84}${image ~/Conky/image_disks/RW-80.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=89}${image ~/Conky/image_disks/RW-85.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=94}${image ~/Conky/image_disks/RW-90.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} <=99}${image ~/Conky/image_disks/RW-95.png -p 48,0 -s 24x24}${else}
${if_match ${cpu} ==100}${image ~/Conky/image_disks/RW-100.png -p 48,0 -s 24x24}
${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}${endif}

Re: My Conky Config

Got bored earlier today so I decided to tweak my conky. The new clock is again based on code from tawan at the Arch forums. Other than that, the changes are minimal.

http://a.imageshack.us/img708/3395/2010072912804466451280x.png

conkyrc:

background no
update_interval 1.0
double_buffer yes
no_buffers yes
cpu_avg_samples 2
net_avg_samples 2
text_buffer_size 2048
imlib_cache_size 0
override_utf8_locale yes

#mpd
mpd_host filosofem
mpd_port 6600

# +++++ Window +++++
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 1280 800
maximum_width 1280

alignment bottom_middle
gap_x 0
gap_y 0


# +++++ Styles +++++
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes


# +++++ Colors +++++
default_shade_color 101010
default_color FFFFFF
color2 2ab53e
color3 1994d1
color4 aa0000

lua_load ~/.conky/desktopconky.lua

# +++++ LUA +++++
lua_draw_hook_pre ring_stats


# +++++ Font +++++
use_xft yes
xftfont DejaVu Sans: size=7
xftalpha 0.2
uppercase no


TEXT


















${color2}${font Trebuchet MS:size=24}${alignc}${time %H}${color3}${time %M}${color4}${time %S}
${color}${font Trebuchet MS:bold:size=12}${alignc}${time %A %d %B %G}









${if_mpd_playing}${font DejaVu Sans:size=7}${alignc}${mpd_title 100}
${alignc}$mpd_artist
${alignc}$mpd_album
${alignc}$mpd_elapsed/$mpd_length
${alignc}${mpd_bar 5,180}
${endif}

desktopconky.lua:

--[[
Ring Meters by londonali1010 (2009)
 
This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
 
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.
 
To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
    lua_load ~/scripts/rings-v1.2.1.lua
    lua_draw_hook_pre ring_stats
 
Changelog:
+ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
conky_background_color = 0x151515
conky_background_alpha = 0

ring_background_color = 0x424242
ring_background_alpha = 0.25
ring_foreground_color = 0x2ab53e
ring_foreground_color2 = 0x1994d1
ring_foreground_color3 = 0xaa0000
ring_foreground_alpha = 0.35
 
settings_table = {
--    {
        -- Edit this table to customise your rings.
        -- You can create more rings simply by adding more elements to settings_table.
        -- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
--        name='time',
        -- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
--        arg='%I.%M',
        -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
--        max=12,
        -- "bg_colour" is the colour of the base ring.
--        bg_colour=ring_background_color,
        -- "bg_alpha" is the alpha value of the base ring.
--        bg_alpha=ring_background_alpha,
        -- "fg_colour" is the colour of the indicator part of the ring.
--        fg_colour=ring_foreground_color,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
--        fg_alpha=ring_foreground_alpha,
        -- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
--        x=26, y=25,
        -- "radius" is the radius of the ring.
--        radius=10,
        -- "thickness" is the thickness of the ring, centred around the radius.
--        thickness=6,
        -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
--        start_angle=0,
        -- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle.
--        end_angle=360
--    },
 {
     name='time',
     arg='%S',
    max=60,
     bg_colour=ring_background_color,
     bg_alpha=ring_background_alpha,
     fg_colour=ring_foreground_color3,
     fg_alpha=ring_foreground_alpha,
     x=640, y=375,
     radius=125,
     thickness=12,
     start_angle=0,
     end_angle=360
 },
 {
     name='time',
     arg='%H.%M',
     max=24,
     bg_colour=ring_background_color,
     bg_alpha=ring_background_alpha,
     fg_colour=ring_foreground_color,
     fg_alpha=ring_foreground_alpha,
     x=640, y=375,
     radius=140,
     thickness=8,
     start_angle=-160,
     end_angle=-20
 },
 {
     name='time',
     arg='%M.%S',
     max=60,
     bg_colour=ring_background_color,
     bg_alpha=ring_background_alpha,
     fg_colour=ring_foreground_color2,
     fg_alpha=ring_foreground_alpha,
     x=640, y=375,
     radius=140,
     thickness=8,
     start_angle=20,
     end_angle=160
 },
 {
        name='cpu',
        arg='cpu1',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=675, y=360,
        radius=625,
        thickness=66,
        start_angle=-130,
        end_angle=-60
    },
    {
        name='cpu',
        arg='cpu2',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=605, y=360,
        radius=625,
        thickness=66,
        start_angle=60,
        end_angle=130
    },
    {
        name='fs_used_perc',
        arg='/media/data',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=610, y=360,
        radius=550,
        thickness=40,
        start_angle=60,
        end_angle=130
    },
    {
        name='fs_used_perc',
        arg='/',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=675, y=360,
        radius=550,
        thickness=40,
        start_angle=-130,
        end_angle=-60
    },
    {
        name='swapperc',
        arg='',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=610, y=360,
        radius=495,
        thickness=26,
        start_angle=60,
        end_angle=130
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=675, y=360,
        radius=495,
        thickness=26,
        start_angle=-130,
        end_angle=-60
    }, 
    {
        name='upspeedf',
        arg='wlan0',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color,
        fg_alpha=ring_foreground_alpha,
        x=610, y=360,
        radius=450,
        thickness=20,
        start_angle=60,
        end_angle=130
    },
    {
        name='downspeedf',
        arg='wlan0',
        max=100,
        bg_colour=ring_background_color,
        bg_alpha=ring_background_alpha,
        fg_colour=ring_foreground_color2,
        fg_alpha=ring_foreground_alpha,
        x=675, y=360,
        radius=450,
        thickness=20,
        start_angle=-130,
        end_angle=-60
    },    
}
require 'cairo'
 
function rgb_to_r_g_b(colour,alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function conky_round_rect(cr, x0, y0, w, h, r)
    if (w == 0) or (h == 0) then return end
    local x1 = x0 + w
    local y1 = y0 + h
    if w/2 < r then
        if h/2 < r then
            cairo_move_to  (cr, x0, (y0 + y1)/2)
            cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2)
            cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2)
        else
            cairo_move_to  (cr, x0, y0 + r)
            cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + r)
            cairo_line_to (cr, x1 , y1 - r)
            cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- r)
        end
    else
        if h/2 < r then
            cairo_move_to  (cr, x0, (y0 + y1)/2)
            cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + r, y0)
            cairo_line_to (cr, x1 - r, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2)
            cairo_curve_to (cr, x1, y1, x1, y1, x1 - r, y1)
            cairo_line_to (cr, x0 + r, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2)
        else
            cairo_move_to  (cr, x0, y0 + r)
            cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + r, y0)
            cairo_line_to (cr, x1 - r, y0)
            cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + r)
            cairo_line_to (cr, x1 , y1 - r)
            cairo_curve_to (cr, x1, y1, x1, y1, x1 - r, y1)
            cairo_line_to (cr, x0 + r, y1)
            cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- r)
        end
    end
    cairo_close_path (cr)
end

 
function draw_ring(cr,t,pt)
    local w,h=conky_window.width,conky_window.height
 
    local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
 
    local angle_0=sa*(2*math.pi/360)-math.pi/2
    local angle_f=ea*(2*math.pi/360)-math.pi/2
    local t_arc=t*(angle_f-angle_0)
 
    -- Draw background ring
 
    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
    cairo_set_line_width(cr,ring_w)
    cairo_stroke(cr)
 
    -- Draw indicator ring
 
    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
    cairo_stroke(cr)        
end
 
cs, cr = nil -- initialize our cairo surface and context to nil
function conky_ring_stats()
    local function setup_rings(cr,pt)
        local str=''
        local value=0
 
        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)
 
        value=tonumber(str)
        if value == nil then value = 0 end
        pct=value/pt['max']
 
        draw_ring(cr,pct,pt)
    end
 
    if conky_window==nil then return 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)

    if cs == nil or cairo_xlib_surface_get_width(cs) ~= conky_window.width or cairo_xlib_surface_get_height(cs) ~= conky_window.height then
        if cs then cairo_surface_destroy(cs) end
        cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    end
    if cr then cairo_destroy(cr) end
    cr = cairo_create(cs)

 
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
 
    if update_num>5 then
        conky_round_rect(cr, 3, 0, conky_window.width-6, conky_window.height-3, 15)
        cairo_set_source_rgba(cr, rgb_to_r_g_b(conky_background_color, conky_background_alpha))
        cairo_fill(cr)
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
    cairo_destroy(cr)
    cr = nil
end

function conky_cairo_cleanup()
    cairo_surface_destroy(cs)
    cs = nil
end

1,094

Re: My Conky Config

@cedrusdeodara: What do I need to install besides conky ro run this lua stuff??

"You bow to NOone..."

1,095

Re: My Conky Config

steen wrote:

@cedrusdeodara: What do I need to install besides conky ro run this lua stuff??

Check out the new Conky Wiki:  Conky and Lua  >>  http://conky.wikia.com/wiki/Conky_and_Lua

DeviantART.com also, has a great Conky Artists Group  >>  http://conky-artists-group.deviantart.com/

I do use Conky but not Lua . . . but, there are some great Conky Devs are in the DeviantART Group.
I find it fascinating the things people are doing with Conkly and Lua

Last edited by vrkalak (2010-07-30 05:10:35)

Registered Linux User: #497030
LinuxMint Forum | DeviantART page | Lost-in-the-Box Forum  |  Ask.Debian
#!Crunchbang 'Statler' (Openbox) -- LinuxMint-Debian-Fluxbox Edition

1,096

Re: My Conky Config

@vrkalak: Your link to the Conky Wiki doesn't really give anything - there should be a new wiki, but the link is broken. And when I google I can't find it sad

"You bow to NOone..."

1,097

Re: My Conky Config

steen wrote:

@vrkalak: Your link to the Conky Wiki doesn't really give anything - there should be a new wiki, but the link is broken. And when I google I can't find it sad

You are correct ... when I open the Conky Wiki link, I do to "that" page, but it won't open anything else.  Weird? It's new ... I left a message for their Admin about this.

Did you check in the Main Conky Site  >>  http://conky.sourceforge.net/

or in Conky Hardcore  >>  http://conky.linux-hardcore.com/

The Arch/Linux Forums have a great Conly section  >>  https://bbs.archlinux.org/  (search there there, maybe)

as I am one of the Admins to the DeviantArt Conky Artists Group . . . I'd go with them, as some of the Conky Developers are there.  There is a chat and Forum in DeviantArt for Linux and Coinky.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Full list of Conky settings  > http://conky.sourceforge.net/config_settings.html
Conky Variables > http://conky.sourceforge.net/variables.html

Last edited by vrkalak (2010-07-30 14:19:18)

Registered Linux User: #497030
LinuxMint Forum | DeviantART page | Lost-in-the-Box Forum  |  Ask.Debian
#!Crunchbang 'Statler' (Openbox) -- LinuxMint-Debian-Fluxbox Edition

1,098

Re: My Conky Config

vrkalak wrote:
steen wrote:

@vrkalak: Your link to the Conky Wiki doesn't really give anything - there should be a new wiki, but the link is broken. And when I google I can't find it sad

You are correct ... when I open the Conky Wiki link, I do to "that" page, but it won't open anything else.  Weird? It's new ... I left a message for their Admin about this.

Did you check in the Main Conky Site  >>  http://conky.sourceforge.net/

or in Conky Hardcore  >>  http://conky.linux-hardcore.com/

The Arch/Linux Forums have a great Conly section  >>  https://bbs.archlinux.org/  (search there there, maybe)

as I am one of the Admins to the DeviantArt Conky Artists Group . . . I'd go with them, as some of the Conky Developers are there.  There is a chat and Forum in DeviantArt for Linux and Coinky.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Full list of Conky settings  > http://conky.sourceforge.net/config_settings.html
Conky Variables > http://conky.sourceforge.net/variables.html

I found this: http://wiki.conky.be/index.php?title=Conky_Wiki <<---- it's the link you wanted.

1,099

Re: My Conky Config

i had an idea for a sun position figure, but it turns out that calculating the position of the sun and the relative positions of the horizon aren't exactly straight forward.  Who knew astronomical mathematics would be so complicated? big_smile

anyway here is a simplified version which i think does a decent job.

i've written a bash script using curl grep and awk to extract sun position and time info from the wunderground website and then used lua to display the output

http://omploader.org/tNTNlbA

the horizontal grey line is the horizon,  the vertical grey line is south and the white dot is sun's current position

it doesn't look like much... maybe a revisit some time soon will improve things

Last edited by mrpeachy (2010-07-30 23:51:05)

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.

1,100

Re: My Conky Config

i figured out the pertinent math parts and figured out how to do the calculations in lua
and now my sun position figure is much improved (in accuracy at least smile )

it now calculates the azimuth and angular altitude of the sun at any given time
and tells you if it is sunrise, solar noon, or sunset  (sunrise and sunset are indicated when sun altitude is + or - 2 degrees of 0, solar noon is +- 1 degree)

http://omploader.org/tNTNudw

here is the bash script that generates the numbers for the calculations:

#!/bin/bash
#!/bin/bash

{
curl "http://www.wunderground.com/US/MO/Saint_Louis.html?MR=0&extendedsun=sunon"
}>/tmp/sundata.html

{
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Actual Time</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Civil Twilight</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Altitude</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Azimuth</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Sun Declination</td>"
}>/tmp/sundata.txt

{
#real time sunrise - hours and minutes
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 1p | awk -F'AM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's| ||g'
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 1p | awk -F'AM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's| ||g'
#real time solar noon - hours, minutes, am or pm
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 2p | awk -F'CDT' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's|[ AMPM]||g'
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 2p | awk -F'CDT' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's|[ AMPM]||g'
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 2p | awk -F'CDT' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's|[0-9 ]||g'
#real time sunset - hours and minutes
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 3p | awk -F'PM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's| ||g'
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 3p | awk -F'PM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's| ||g'
#civil twilight- sunrise - hours and minutes
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 4p | awk -F'AM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's| ||g'
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 4p | awk -F'AM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's| ||g'
#civil twilight- sunset - hours and minutes
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 5p | awk -F'PM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's| ||g'
cat /tmp/sundata.txt |  grep -n 'CDT' | sed -n 5p | awk -F'PM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's| ||g'
#altitude at sunrise
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 1p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#altitude at solar noon
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 2p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#altitude at sunset
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 3p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#azimuth at sunrise
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 4p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#azimuth at solar noon
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 5p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#azimuth at sunset
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 6p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#declination at sunrise
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 7p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#declination at solar noon
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 8p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#declination at sunset
cat /tmp/sundata.txt |  grep -n '&deg;</td>' | sed -n 9p | awk -F'&deg;</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'

}>/tmp/sundata2.txt

{
sed 's/$/:/' /tmp/sundata2.txt | tr -d '\n'
}>/tmp/sundata3.txt

cat /tmp/sundata3.txt

and here is the lua script which does the calculations and displays the figure

--sun position lua script by mrpeachy 2010

require 'cairo'

function addzero10(num)
if tonumber(num) < 10 then
return "0" .. num
else
return num
end
end

function round(val, decimal)
  if (decimal) then
    return math.floor( (val * 10^decimal) + 0.5) / (10^decimal)
  else
    return math.floor(val+0.5)
  end
end

function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end

function conky_draw_newconky()
if conky_window == nil then 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)
local updates=tonumber(conky_parse('${updates}'))

if updates > 10 then

timer=(updates % 60)+1
if timer==1 then
test=(conky_parse('${exec /home/mcdowall/sundata.sh}'))
end
test2=string.split(test, ":")

sunrisehours=test2[1]
sunrisemins=test2[2]
sunsethours=(test2[6])+12
sunsetmins=test2[7]
--time at sunrise and sunset in minutes
sun1=(test2[1]*60)+test2[2]
sun2=((test2[6]+12)*60)+test2[7]
sunlength=sun2-sun1

if test2[5]=="PM" then
sunhighhrs=(test2[3])+12
else
sunhighhrs=test2[3]
end
--time at solar noon in mins
sun3=(sunhighhrs*60)+(test2[4])
--calculate current time
hrs=os.date("%H")
min=os.date("%M")

--hrs=13
--min=07

current=(hrs*60)+min
total=(24*60)
--calculate oiffset to make solar noon at top
sundiff=(12*60)-sun3
--civil twilight for sunrise
ctr=(test2[8]*60)+test2[9]
--civil twilight for sunset
cts=((test2[10]+12)*60)+test2[11]
--sunrise altitude
ralt=test2[12]
--solar noon altitude
snalt=test2[13]
--sunset altitude
salt=test2[14]
--sunrize azimuth
rz=test2[15]
--solar noon azimuth
na=test2[16]
--sunset azimuth
sz=test2[17]
--sun declination (average of rise, noon and set)
sdec=(test2[18]+test2[19]+test2[20])/3
--input latitude
latitude=38.63

--sin(Alt) = cos(Lat) cos(Decl) cos(HAngle) + sin(Lat) sin(Dec)
--calculate altitude at solar noon
current=sun3
sha=(current-sun3)*(15/60)
cossha=math.cos(math.rad(sha))
cossundec=math.cos(math.rad(sdec))
coslat=math.cos(math.rad(latitude))
cosmath=cossha*cossundec*coslat
sinsundec=math.sin(math.rad(sdec))
sinlat=math.sin(math.rad(latitude))
sinmath=sinsundec*sinlat
sinelevation=cosmath+sinmath
elevation=math.deg(math.asin(sinelevation))
snalt=elevation

--calculate altitude at solar midnight
current=sun3+(12*60)
sha=(current-sun3)*(15/60)
cossha=math.cos(math.rad(sha))
cossundec=math.cos(math.rad(sdec))
coslat=math.cos(math.rad(latitude))
cosmath=cossha*cossundec*coslat
sinsundec=math.sin(math.rad(sdec))
sinlat=math.sin(math.rad(latitude))
sinmath=sinsundec*sinlat
sinelevation=cosmath+sinmath
elevation=math.deg(math.asin(sinelevation))
smalt=elevation*-1

--calculate sha when altitude=0
--sin(Alt) = cos(Lat) cos(Decl) cos(HAngle) + sin(Lat) sin(Dec)

sinalt0=math.sin(math.rad(0))
alt0math1=sinalt0-(sinlat*sinsundec)
alt0math2=alt0math1/coslat
alt0cossha=alt0math2/cossundec
shaalt0=math.deg(math.acos(alt0cossha))
alt0time1=shaalt0/(15/60)
alt0time=(alt0time1+sun3)

--calculate current solar altitude
current=(hrs*60)+min
sha=(current-sun3)*(15/60)
cossha=math.cos(math.rad(sha))
cossundec=math.cos(math.rad(sdec))
coslat=math.cos(math.rad(latitude))
cosmath=cossha*cossundec*coslat
sinsundec=math.sin(math.rad(sdec))
sinlat=math.sin(math.rad(latitude))
sinmath=sinsundec*sinlat
sinelevation=cosmath+sinmath
elevation=math.deg(math.asin(sinelevation))
curaltlong=elevation
curalt=round(curaltlong,2)

--calculate current azimuth
azmath1=(cossha*cossundec*sinlat)-(sinsundec*coslat)
azmath2=math.cos(math.rad(elevation))
cosaz=azmath1/azmath2
azi1=math.deg(math.acos(cosaz))
azi2=round(azi1, 2)

if sha>0 then
azi=azi2+180
else
azi=(azi2-180)*-1
end

--setup position
horizontal=200
vertical=200
radius=(snalt+(smalt))/2
raddiff=(snalt-smalt)/2

across=horizontal
down=vertical-raddiff

--draws orbit circle
circx=across
circy=down
circrad=radius
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.4,0.4,0.4,1)
cairo_set_line_width (cr, 1)
cairo_stroke (cr)

--draw south
outer1=radius
text_arc=((2*math.pi/(total))*(total))
txs3=0-outer1*(math.sin(text_arc))
tys3=0+outer1*(math.cos(text_arc))

outer1=radius
text_arc=((2*math.pi/(total))*(total/2))
txs4=0-outer1*(math.sin(text_arc))
tys4=0+outer1*(math.cos(text_arc))

cairo_move_to (cr, across+txs3, down+tys3)
cairo_line_to (cr, across+txs4, down+tys4)
cairo_set_source_rgba(cr,0.5,0.5,0.5,1)
cairo_set_line_width (cr, 1)
cairo_stroke (cr)

--draws horizon stationary
outer1=radius
text_arc=((2*math.pi/(total))*(alt0time))+((2*math.pi/(total))*(sundiff))
txs=0-outer1*(math.sin(text_arc))
tys=0+outer1*(math.cos(text_arc))

outer1=radius
text_arc=(2*math.pi/(total))*((24*60)-alt0time)-((2*math.pi/(total))*(sundiff))
txs2=0-outer1*(math.sin(text_arc))
tys2=0+outer1*(math.cos(text_arc))

cairo_move_to (cr, horizontal-100, down+((tys+tys2)/2))
cairo_rel_line_to (cr, 200, 0)
cairo_set_source_rgba(cr,0.5,0.5,0.5,1)
cairo_set_line_width (cr, 1)
cairo_stroke (cr)

--draws current sun position
outer1=radius
text_arc=((2*math.pi/(total))*(current))+((2*math.pi/(total))*(sundiff))
txs=0-outer1*(math.sin(text_arc))
tys=0+outer1*(math.cos(text_arc))
circrad=1.6
circx=txs+across
circy=tys+down
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_fill (cr)


--draws text label
if sha<0 then
outer1=radius-15
else
outer1=radius+15
end
text_arc=((2*math.pi/(total))*(current))+((2*math.pi/(total))*(sundiff))
txs=0-outer1*(math.sin(text_arc))
tys=0+outer1*(math.cos(text_arc))
cairo_select_font_face (cr, "Mono", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10);
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_move_to (cr, across-100, down-radius-40)
cairo_show_text (cr, "Time " .. addzero10(hrs) .. ":" .. min)
cairo_move_to (cr, across-100, down-radius-30)
cairo_show_text (cr, "Azimuth " .. azi .. "°")
cairo_move_to (cr, across-100, down-radius-20)
cairo_show_text (cr, "Altitude " .. curalt .. "°")

if curalt>-2 and curalt<2 and sha<0 then
cairo_move_to (cr, across-100, down-radius-10)
cairo_show_text (cr, "Sunrise")
else if curalt<2 and curalt>-2 and sha>0 then
cairo_move_to (cr, across-100, down-radius-10)
cairo_show_text (cr, "Sunset")
else if sha>-1 and sha<1 then
cairo_move_to (cr, across-100, down-radius-10)
cairo_show_text (cr, "Solar Noon")
end
end
end

end
end

EDIT - ive been tweaking a little to put more info up on the screen:
http://omploader.org/tNTNxbQ

if anyone is interested in the updated code then i can update it above smile

Last edited by mrpeachy (2010-07-31 18:46:42)

It's hard to find something if you don't know what you're looking for.
I have a blog, it's mostly about conky and lua stuff... go here.