--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 