SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#6951 2014-01-25 22:20:23

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

here is the code
its in the form of a wun weather template, but the functions and calls could be easily moved elsewhere
sizable and positionable
might have to fiddle with the functions to get a different font to work

function grec(gtab)--#################################################################################
local function color(col,alp)
return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
local function sub_draw(sdtab)
cdsx={}
cdsy={}
dr={}
limit=#sdtab
    for i=1,limit do
        local d=sdtab[i].d
        if d=="start" then        
        table.insert(dr,"cairo_move_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
        table.insert(cdsx,sdtab[i].x)
        table.insert(cdsy,sdtab[i].y)
        end
        if d=="line" then
        table.insert(dr,"cairo_line_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
        table.insert(cdsx,sdtab[i].x)
        table.insert(cdsy,sdtab[i].y)
        end
        if d=="rline" then
        table.insert(dr,"cairo_rel_line_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
        table.insert(cdsx,cdsx[i-1]+sdtab[i].x)
        table.insert(cdsy,cdsy[i-1]+sdtab[i].y)
        end
	if d=="aline" then
	--pt(px,py,prad,pdeg)
	local alx,aly=pt(cdsx[i-1],cdsy[i-1],sdtab[i].l,sdtab[i].a)
	table.insert(dr,"cairo_line_to(cr,"..tostring(alx)..","..tostring(aly)..");")
       	table.insert(cdsx,alx)
        table.insert(cdsy,aly)
	end
        if d=="arc" then
        local ang1=(math.pi/180)*((sdtab[i].a1)-90)
        local ang2=(math.pi/180)*((sdtab[i].a2)-90)
        local rad=sdtab[i].r
        local x=sdtab[i].x
        local y=sdtab[i].y
        table.insert(dr,"cairo_arc(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
        local ang2=(math.pi/180)*(sdtab[i].a2)    
        local ax=0+rad*(math.sin(ang2))
        local ay=0-rad*(math.cos(ang2))
        table.insert(cdsx,x+ax)
        table.insert(cdsy,y+ay)
        end
        if d=="arc_c" then
        local q=sdtab[i].q
        local rad=sdtab[i].r
            if q==4 then
            ang1=(math.pi/180)*(270-90)
            x=cdsx[i-1]+rad
            y=cdsy[i-1]
            elseif q==1 then
            ang1=(math.pi/180)*(360-90)
            x=cdsx[i-1]
            y=cdsy[i-1]+rad
            elseif q==2 then
            ang1=(math.pi/180)*(90-90)
            x=cdsx[i-1]-rad
            y=cdsy[i-1]
            elseif q==3 then
            ang1=(math.pi/180)*(180-90)
            x=cdsx[i-1]
            y=cdsy[i-1]-rad
            end
        local ang2=ang1+((math.pi/180)*(sdtab[i].degs))
        table.insert(dr,"cairo_arc(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
        local ang2=ang2+((math.pi/180)*90)
        local ax=0+rad*(math.sin(ang2))
        local ay=0-rad*(math.cos(ang2))
        table.insert(cdsx,x+ax)
        table.insert(cdsy,y+ay)
        end
        if d=="arc_a" then
        local q=sdtab[i].q
        local rad=sdtab[i].r
            if q==4 then
            ang1=(math.pi/180)*(360-90)
            x=cdsx[i-1]
            y=cdsy[i-1]+rad
            elseif q==1 then
            ang1=(math.pi/180)*(90-90)
            x=cdsx[i-1]-rad
            y=cdsy[i-1]
            elseif q==2 then
            ang1=(math.pi/180)*(180-90)
            x=cdsx[i-1]
            y=cdsy[i-1]-rad
            elseif q==3 then
            ang1=(math.pi/180)*(270-90)
            x=cdsx[i-1]+rad
            y=cdsy[i-1]
            end
        local ang2=ang1-(math.pi/180)*(sdtab[i].degs)
        table.insert(dr,"cairo_arc_negative(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
        local ang2=ang2+((math.pi/180)*90)
        local ax=0+rad*(math.sin(ang2))
        local ay=0-rad*(math.cos(ang2))
        table.insert(cdsx,x+ax)
        table.insert(cdsy,y+ay)
        end
    end
return table.concat(dr)
end--of local function sub_draw
local g=gtab.g		or 1
local x=gtab.x		or 0
local y=gtab.y		or 0
local w=gtab.w		or 50
local h=gtab.h		or 50
local r=gtab.r		or 50
local rgx=gtab.rgx	or x
local rgy=gtab.rgy	or y
local grad=gtab.grad	or {{c=0xffffff}}
local gan=gtab.gan	or 45
local lw=gtab.lw	or 1
local sub=gtab.sub	or 0
local db=gtab.db	or 0
local subtab=gtab.subtab
if db==1 and g~=6 then
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,1)
cairo_rectangle (cr,x,y,w,h)
cairo_stroke (cr)
elseif db==1 and g==6 then
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,1)
cairo_arc (cr,x,y,r,0,2*math.pi)
cairo_stroke (cr)
end
--##########################################
if g==1 or g==2 or g==5 or g==6 then --rectangular gradients
	if g==1 then
	pat = cairo_pattern_create_linear (0,y,0,y+h);
	elseif g==2 then
	pat = cairo_pattern_create_linear (x,0,x+w,0);
	elseif g==5 then
	--calculate hypotenuse across middle of rectange
	local hyp=math.sqrt((w^2)+(h^2))
	local rad=hyp/2
	--center point of rectangle
	local crx=x+(w/2)
	local cry=y+(h/2)
	--calculate point 1
	local point=(math.pi/180)*gan
	local x1=crx+rad*(math.sin(point))
	local y1=cry-rad*(math.cos(point))
	--calculate point 2
	local point=(math.pi/180)*(gan+180)
	local x2=crx+rad*(math.sin(point))
	local y2=cry-rad*(math.cos(point))
	--gradient
	pat = cairo_pattern_create_linear (x1,y1,x2,y2);
	elseif g==6 then
	pat = cairo_pattern_create_radial (rgx, rgy, 0, x,  y, r);
	end
local gnum=#grad
for i=1,gnum do
cairo_pattern_add_color_stop_rgba (pat,grad[i].p,color(grad[i].c,grad[i].a));
end--for loop
    if sub==1 then
    cairo_save (cr)
    cairo_clip(cr)
    cairo_new_sub_path(cr)
    local drawstring=sub_draw(subtab)
    loadstring(drawstring)()
    cairo_restore (cr)    
    end
cairo_set_source (cr, pat); 
cairo_fill(cr);
cairo_pattern_destroy (pat);
--###########################################
elseif g==0 and sub==1 then --non gradient
    local drawstring=sub_draw(subtab)
    loadstring(drawstring)()
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_fill(cr)
elseif g==3 and sub==1 then
    local drawstring=sub_draw(subtab)
    loadstring(drawstring)()
    cairo_set_line_width(cr,lw)
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_close_path (cr)
    cairo_stroke(cr);
elseif g==4 and sub==1 then
    local drawstring=sub_draw(subtab)
    loadstring(drawstring)()
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_fill_preserve(cr);
    cairo_set_line_width(cr,lw)
    cairo_set_source_rgba (cr,color(grad[2].c,grad[2].a));
    cairo_close_path (cr)
    cairo_stroke(cr);        
elseif g==0 and sub~=1 then
    cairo_rectangle (cr,x,y,w,h)
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_fill(cr);
elseif g==3 and sub~=1 then
    cairo_rectangle (cr,x,y,w,h)
    cairo_set_line_width(cr,lw)
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_close_path (cr)
    cairo_stroke(cr);
elseif g==4 and sub~=1 then
    cairo_rectangle (cr,x,y,w,h)
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_fill_preserve(cr);
    cairo_set_line_width(cr,lw)
    cairo_set_source_rgba (cr,color(grad[2].c,grad[2].a));
    cairo_close_path (cr)
    cairo_stroke(cr);
--radial gradients
elseif g==6 then
	pat = cairo_pattern_create_radial (cx, cy, crad-(clw/2)-2,--
                                   cx,  cy, crad+(clw/2)+4);
	cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0, 1);
	cairo_pattern_add_color_stop_rgba (pat, 0.5, 0, 0, 0, 0);
	cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);

cairo_set_source (cr, pat);
cairo_arc (cr, cx, cy, crad+(clw/2), 0, 2*math.pi);
cairo_fill (cr);
cairo_pattern_destroy (pat);
end--of g type
end--of function grec
--END MAIN GTAB FUNCTION################################################--]]
function glassyboxtop(tlx,tly,cra,sw,sh,bg)
sho=sh
sw=sw-cra-cra
sh=sh-cra-cra
--BIG FILLED IN RECTANGLE
if bg~=1 then
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh+cra},
{d="rline",x=-sw-cra-cra,y=0},
{d="rline",x=0,y=-sh-cra},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0x606060,a=0.3,p=0},{c=0x101010,a=0.3,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--[HIGHLIGHT TOP RECTANGLE
if bg~=1 and bg~=2 then
shh=((80/150)*sho)-cra-cra
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=shh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-shh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=shh+cra+cra,
grad={{c=0xffffff,a=0.5,p=0},{c=0xffffff,a=0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--OUTLINE
lt=1 --BOARDER WIDTH
tlx,tly=tlx-lt,tly-lt
cra1=cra+lt
subtab={
{d="start",x=tlx+cra1,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra1,degs=90},
{d="rline",x=0,y=sh+cra1},
--{d="arc_c",q=2,r=cra1,degs=90},
{d="rline",x=-sw-cra1-cra1,y=0},
--{d="arc_c",q=3,r=cra1,degs=90},
{d="rline",x=0,y=-sh-cra1},
{d="arc_c",q=4,r=cra1,degs=90},
{d="rline",x=sw,y=0},
{d="rline",x=0,y=lt},
{d="rline",x=-sw,y=0},
{d="arc_a",q=4,r=cra,degs=90},
{d="rline",x=0,y=sh+cra},
--{d="arc_a",q=3,r=cra,degs=90},
{d="rline",x=sw+cra+cra,y=0},
--{d="arc_a",q=2,r=cra,degs=90},
{d="rline",x=0,y=-sh-cra},
{d="arc_a",q=1,r=cra,degs=90},
{d="rline",x=-sw,y=0},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0x808080,a=1,p=0},{c=0x202020,a=1,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})--]]
end
function glassyboxbot(tlx,tly,cra,sw,sh,bg)
sho=sh
sw=sw-cra-cra
sh=sh-cra-cra
--BIG FILLED IN RECTANGLE
if bg~=1 then
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw+cra,y=0},
--{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh+cra},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh-cra},
--{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0x606060,a=0.3,p=0},{c=0x101010,a=0.3,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--[HIGHLIGHT TOP RECTANGLE
if bg~=1 and bg~=2 then
shh=((80/150)*sho)-cra-cra
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw+cra,y=0},
--{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=shh+cra},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-shh-cra},
--{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=shh+cra+cra,
grad={{c=0xffffff,a=0.5,p=0},{c=0xffffff,a=0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--OUTLINE
lt=1 --BOARDER WIDTH
tlx,tly=tlx-lt,tly-lt
cra1=cra+lt
subtab={
{d="start",x=tlx+cra+lt,y=tly},
{d="rline",x=sw+cra1,y=0},
--{d="arc_c",q=1,r=cra1,degs=90},
{d="rline",x=0,y=sh+cra1},
{d="arc_c",q=2,r=cra1,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra1,degs=90},
{d="rline",x=0,y=-sh-cra1},
--{d="arc_c",q=4,r=cra1,degs=90},
{d="rline",x=sw+cra1,y=0},
{d="rline",x=0,y=lt},
{d="rline",x=-sw-cra,y=0},
--{d="arc_a",q=4,r=cra,degs=90},
{d="rline",x=0,y=sh+cra},
{d="arc_a",q=3,r=cra,degs=90},
{d="rline",x=sw,y=0},
{d="arc_a",q=2,r=cra,degs=90},
{d="rline",x=0,y=-sh-cra},
--{d="arc_a",q=1,r=cra,degs=90},
{d="rline",x=-sw,y=0},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0x808080,a=1,p=0},{c=0x202020,a=1,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})--]]
end
function flip_digit(tlx,tly,cra,sw,dig)
sh=(sw+cra+cra)*(120/80)
fs=(180/160)*sh
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh-cra-cra},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh+cra+cra},
{d="arc_c",q=4,r=cra,degs=90},
}grec({g=1,x=tlx,y=tly,w=sw+cra+cra,h=sh+cra+cra,grad={{c=0x202020,a=1,p=0}},lw=1,sub=1,db=0,subtab=subtab})
tin=(sw+cra+cra)/8
tup=(sh)/12
out({x=tlx+tin,y=tly+sh-tup,fs=fs,txt=dig})
glassyboxtop(tlx,tly,cra,sw+cra+cra,sh/2,0)
glassyboxbot(tlx,tly+(sh/2),cra,sw+cra+cra,sh/2,0)
cairo_move_to(cr,tlx-1,tly+(sh/2))
cairo_rel_line_to(cr,sw+cra+cra+2,0)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_set_line_width(cr,2)
cairo_stroke(cr)
end
--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION--DISPLAY FUNCTION-
_G.weather_script = function(update,time,now,text_forecast,day,hour)--#### DO NOT EDIT THIS LINE ##############
--#######################################################################
--these tables hold the coordinates for each repeat do not edit #########
top_left_xcoordinate={}--################################################
top_left_ycoordinate={}--################################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="mono"--font must be in quotes
default_font_size=12
default_face="normal"
default_color=0xffffff
default_alpha=1--fully opaque
default_image_width=50
default_image_height=50
--END OF DEFAULTS #######################################################
--HOURS
--hours
--first digit
hrs=time.hour_24_pad
dig=hrs:sub(1,1)
h2=hrs:sub(2,2)
tlx=50
tly=50
cra=10
sw=30
flip_digit(tlx,tly,cra,sw,dig)
--second digit
dig=hrs:sub(2,2)
tlx=105
tly=50
cra=10
sw=30
flip_digit(tlx,tly,cra,sw,dig)
--minutes
--first digit
min=tostring(time.min_pad)
dig=min:sub(1,1)
tlx=170
tly=50
cra=10
sw=20
flip_digit(tlx,tly,cra,sw,dig)
--second digit
dig=min:sub(2,2)
tlx=215
tly=50
cra=10
sw=20
flip_digit(tlx,tly,cra,sw,dig)
--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--########################################################################################]]
end--of weather_display function do not edit this line ##################
--#######################################################################

Offline

Be excellent to each other!

#6952 2014-01-26 02:59:58

EmeraldBot
New Member
Registered: 2013-05-06
Posts: 7

Re: Conky v1.9 Thread

Sorry for replying late! (forgot to follow the thread)

# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
# http://crunchbanglinux.org/forums/topic/2047/conky-help/
#
# Enjoy! :)
##############################################
# Settings
##############################################
background yes
use_xft yes
xftfont Liberation Sans:size=9
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
#own_window_argb_visual yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 200
maximum_width 240
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color 656667
default_shade_color 000000
default_outline_color 828282
alignment top_right
gap_x 12
gap_y 56
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no
##############################################
#  Output
##############################################
TEXT
S Y S T E M    I N F O
${hr}
Host:$alignr$nodename
Uptime:$alignr$uptime
RAM:$alignr$mem/$memmax
Swap usage:$alignr$swap/$swapmax
Disk usage:$alignr${fs_used /dev/mapper/Minerva-home}/${fs_size /dev/mapper/Minerva-home}
CPU usage:$alignr${cpu cpu0}%


S H O R T C U T    K E Y S
${hr}
Alt+F2$alignr Run Dialog
Alt+F3$alignr Alt Menu
Super+Space$alignr Main Menu
Super+Tab$alignr Client Menu
Super+t$alignr Terminal
Super+f$alignr File Manager
Super+e$alignr Editor
Super+m$alignr Media Player
Super+w$alignr Web Browser
Super+h$alignr Task Manager
Super+l$alignr Lock Screen
Super+v$alignr Volume Control
Super+x$alignr Logout
PrtSc$alignr Screenshot

As you can see, it's exactly the same as stock, except that I changed the location for fs_free and fs_used in an attempt to get it to show the size better.

Offline

#6953 2014-01-26 14:22:28

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

mrpeachy wrote:

here is the code
its in the form of a wun weather template, but the functions and calls could be easily moved elsewhere
sizable and positionable
might have to fiddle with the functions to get a different font to work

OK it works great as a WUN template ... but it's calling wunderground chewing up api calls unnecessarily ...

Looks really good though: LUA Clock ... the font is: LED_Mono

So try as I might I get tripped up with "easily moved elsewhere" - I'm missing something and can't see it.

I used wunrc renamed wun_fclk.conky and the code above became:

lua_load /media/5/wun/templates/flip-clock_template.lua

In the code above there is no "function conky_" which I know to look for to get the function to use in conky lua_draw_hook_pre or lua_draw_hook_post

Any help for a novice appreciated.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6954 2014-01-26 18:26:35

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

Very nice work Mr Peachy as usual wink
Did you explain that this clock can work in a "own one" conky , just the clock and not the weather ?
A little lua code for a little conky smile
I"ll see it when I got bit more time
thanks for the flip flap idea !

Offline

#6955 2014-01-26 18:36:12

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

yes, i did leave that one a little vague

1. here is a blank lua script

--a blank lua script for conky
--load script in conky config with lua_load /path/to/script/name.lua
--##SETUP############################################################################################
require 'cairo'
--require 'imlib2'--needed for using images
--###################################################################################################
--##ADDITIONAL FUNCTIONS#############################################################################
--alternatively you can move the additional functions below the main conky function

--###################################################################################################
--##MAIN FUNCTION TO BE CALLED IN CONKY CONFIG#######################################################
function conky_main()--run with lua_draw_hook_pre main
--## SETUP CONKY WINDOW #############################################################################
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)
--###################################################################################################
--all the stuff you want this script to do goes in here
--including calling any functions that were setup above


--###################################################################################################
end--of main function--##############################################################################
--###################################################################################################

for the clock i posted above these are the additional functions that are called in the main function

function grec(gtab)--by mrpeachy###########################################################################
local function color(col,alp)
return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
local function sub_draw(sdtab)
cdsx={}
cdsy={}
dr={}
limit=#sdtab
    for i=1,limit do
        local d=sdtab[i].d
        if d=="start" then        
        table.insert(dr,"cairo_move_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
        table.insert(cdsx,sdtab[i].x)
        table.insert(cdsy,sdtab[i].y)
        end
        if d=="line" then
        table.insert(dr,"cairo_line_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
        table.insert(cdsx,sdtab[i].x)
        table.insert(cdsy,sdtab[i].y)
        end
        if d=="rline" then
        table.insert(dr,"cairo_rel_line_to(cr,"..tostring(sdtab[i].x)..","..tostring(sdtab[i].y)..");")
        table.insert(cdsx,cdsx[i-1]+sdtab[i].x)
        table.insert(cdsy,cdsy[i-1]+sdtab[i].y)
        end
	if d=="aline" then
	--pt(px,py,prad,pdeg)
	local alx,aly=pt(cdsx[i-1],cdsy[i-1],sdtab[i].l,sdtab[i].a)
	table.insert(dr,"cairo_line_to(cr,"..tostring(alx)..","..tostring(aly)..");")
       	table.insert(cdsx,alx)
        table.insert(cdsy,aly)
	end
        if d=="arc" then
        local ang1=(math.pi/180)*((sdtab[i].a1)-90)
        local ang2=(math.pi/180)*((sdtab[i].a2)-90)
        local rad=sdtab[i].r
        local x=sdtab[i].x
        local y=sdtab[i].y
        table.insert(dr,"cairo_arc(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
        local ang2=(math.pi/180)*(sdtab[i].a2)    
        local ax=0+rad*(math.sin(ang2))
        local ay=0-rad*(math.cos(ang2))
        table.insert(cdsx,x+ax)
        table.insert(cdsy,y+ay)
        end
        if d=="arc_c" then
        local q=sdtab[i].q
        local rad=sdtab[i].r
            if q==4 then
            ang1=(math.pi/180)*(270-90)
            x=cdsx[i-1]+rad
            y=cdsy[i-1]
            elseif q==1 then
            ang1=(math.pi/180)*(360-90)
            x=cdsx[i-1]
            y=cdsy[i-1]+rad
            elseif q==2 then
            ang1=(math.pi/180)*(90-90)
            x=cdsx[i-1]-rad
            y=cdsy[i-1]
            elseif q==3 then
            ang1=(math.pi/180)*(180-90)
            x=cdsx[i-1]
            y=cdsy[i-1]-rad
            end
        local ang2=ang1+((math.pi/180)*(sdtab[i].degs))
        table.insert(dr,"cairo_arc(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
        local ang2=ang2+((math.pi/180)*90)
        local ax=0+rad*(math.sin(ang2))
        local ay=0-rad*(math.cos(ang2))
        table.insert(cdsx,x+ax)
        table.insert(cdsy,y+ay)
        end
        if d=="arc_a" then
        local q=sdtab[i].q
        local rad=sdtab[i].r
            if q==4 then
            ang1=(math.pi/180)*(360-90)
            x=cdsx[i-1]
            y=cdsy[i-1]+rad
            elseif q==1 then
            ang1=(math.pi/180)*(90-90)
            x=cdsx[i-1]-rad
            y=cdsy[i-1]
            elseif q==2 then
            ang1=(math.pi/180)*(180-90)
            x=cdsx[i-1]
            y=cdsy[i-1]-rad
            elseif q==3 then
            ang1=(math.pi/180)*(270-90)
            x=cdsx[i-1]+rad
            y=cdsy[i-1]
            end
        local ang2=ang1-(math.pi/180)*(sdtab[i].degs)
        table.insert(dr,"cairo_arc_negative(cr,"..tostring(x)..","..tostring(y)..","..tostring(rad)..","..tostring(ang1)..","..tostring(ang2)..");")
        local ang2=ang2+((math.pi/180)*90)
        local ax=0+rad*(math.sin(ang2))
        local ay=0-rad*(math.cos(ang2))
        table.insert(cdsx,x+ax)
        table.insert(cdsy,y+ay)
        end
    end
return table.concat(dr)
end--of local function sub_draw
local g=gtab.g		or 1
local x=gtab.x		or 0
local y=gtab.y		or 0
local w=gtab.w		or 50
local h=gtab.h		or 50
local r=gtab.r		or 50
local rgx=gtab.rgx	or x
local rgy=gtab.rgy	or y
local grad=gtab.grad	or {{c=0xffffff}}
local gan=gtab.gan	or 45
local lw=gtab.lw	or 1
local sub=gtab.sub	or 0
local db=gtab.db	or 0
local subtab=gtab.subtab
if db==1 and g~=6 then
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,1)
cairo_rectangle (cr,x,y,w,h)
cairo_stroke (cr)
elseif db==1 and g==6 then
cairo_set_source_rgba (cr,1,1,1,1)
cairo_set_line_width (cr,1)
cairo_arc (cr,x,y,r,0,2*math.pi)
cairo_stroke (cr)
end
--##########################################
if g==1 or g==2 or g==5 or g==6 then --rectangular gradients
	if g==1 then
	pat = cairo_pattern_create_linear (0,y,0,y+h);
	elseif g==2 then
	pat = cairo_pattern_create_linear (x,0,x+w,0);
	elseif g==5 then
	--calculate hypotenuse across middle of rectange
	local hyp=math.sqrt((w^2)+(h^2))
	local rad=hyp/2
	--center point of rectangle
	local crx=x+(w/2)
	local cry=y+(h/2)
	--calculate point 1
	local point=(math.pi/180)*gan
	local x1=crx+rad*(math.sin(point))
	local y1=cry-rad*(math.cos(point))
	--calculate point 2
	local point=(math.pi/180)*(gan+180)
	local x2=crx+rad*(math.sin(point))
	local y2=cry-rad*(math.cos(point))
	--gradient
	pat = cairo_pattern_create_linear (x1,y1,x2,y2);
	elseif g==6 then
	pat = cairo_pattern_create_radial (rgx, rgy, 0, x,  y, r);
	end
local gnum=#grad
for i=1,gnum do
cairo_pattern_add_color_stop_rgba (pat,grad[i].p,color(grad[i].c,grad[i].a));
end--for loop
    if sub==1 then
    cairo_save (cr)
    cairo_clip(cr)
    cairo_new_sub_path(cr)
    local drawstring=sub_draw(subtab)
    loadstring(drawstring)()
    cairo_restore (cr)    
    end
cairo_set_source (cr, pat); 
cairo_fill(cr);
cairo_pattern_destroy (pat);
--###########################################
elseif g==0 and sub==1 then --non gradient
    local drawstring=sub_draw(subtab)
    loadstring(drawstring)()
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_fill(cr)
elseif g==3 and sub==1 then
    local drawstring=sub_draw(subtab)
    loadstring(drawstring)()
    cairo_set_line_width(cr,lw)
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_close_path (cr)
    cairo_stroke(cr);
elseif g==4 and sub==1 then
    local drawstring=sub_draw(subtab)
    loadstring(drawstring)()
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_fill_preserve(cr);
    cairo_set_line_width(cr,lw)
    cairo_set_source_rgba (cr,color(grad[2].c,grad[2].a));
    cairo_close_path (cr)
    cairo_stroke(cr);        
elseif g==0 and sub~=1 then
    cairo_rectangle (cr,x,y,w,h)
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_fill(cr);
elseif g==3 and sub~=1 then
    cairo_rectangle (cr,x,y,w,h)
    cairo_set_line_width(cr,lw)
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_close_path (cr)
    cairo_stroke(cr);
elseif g==4 and sub~=1 then
    cairo_rectangle (cr,x,y,w,h)
    cairo_set_source_rgba (cr,color(grad[1].c,grad[1].a));
    cairo_fill_preserve(cr);
    cairo_set_line_width(cr,lw)
    cairo_set_source_rgba (cr,color(grad[2].c,grad[2].a));
    cairo_close_path (cr)
    cairo_stroke(cr);
--radial gradients
elseif g==6 then
	pat = cairo_pattern_create_radial (cx, cy, crad-(clw/2)-2,--
                                   cx,  cy, crad+(clw/2)+4);
	cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0, 1);
	cairo_pattern_add_color_stop_rgba (pat, 0.5, 0, 0, 0, 0);
	cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1);

cairo_set_source (cr, pat);
cairo_arc (cr, cx, cy, crad+(clw/2), 0, 2*math.pi);
cairo_fill (cr);
cairo_pattern_destroy (pat);
end--of g type
end--of function grec
--END MAIN GTAB FUNCTION################################################--]]
function glassyboxtop(tlx,tly,cra,sw,sh,bg)
sho=sh
sw=sw-cra-cra
sh=sh-cra-cra
--BIG FILLED IN RECTANGLE
if bg~=1 then
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh+cra},
{d="rline",x=-sw-cra-cra,y=0},
{d="rline",x=0,y=-sh-cra},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0x606060,a=0.3,p=0},{c=0x101010,a=0.3,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--[HIGHLIGHT TOP RECTANGLE
if bg~=1 and bg~=2 then
shh=((80/150)*sho)-cra-cra
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=shh},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-shh},
{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=shh+cra+cra,
grad={{c=0xffffff,a=0.5,p=0},{c=0xffffff,a=0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--OUTLINE
lt=1 --BOARDER WIDTH
tlx,tly=tlx-lt,tly-lt
cra1=cra+lt
subtab={
{d="start",x=tlx+cra1,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra1,degs=90},
{d="rline",x=0,y=sh+cra1},
--{d="arc_c",q=2,r=cra1,degs=90},
{d="rline",x=-sw-cra1-cra1,y=0},
--{d="arc_c",q=3,r=cra1,degs=90},
{d="rline",x=0,y=-sh-cra1},
{d="arc_c",q=4,r=cra1,degs=90},
{d="rline",x=sw,y=0},
{d="rline",x=0,y=lt},
{d="rline",x=-sw,y=0},
{d="arc_a",q=4,r=cra,degs=90},
{d="rline",x=0,y=sh+cra},
--{d="arc_a",q=3,r=cra,degs=90},
{d="rline",x=sw+cra+cra,y=0},
--{d="arc_a",q=2,r=cra,degs=90},
{d="rline",x=0,y=-sh-cra},
{d="arc_a",q=1,r=cra,degs=90},
{d="rline",x=-sw,y=0},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0x808080,a=1,p=0},{c=0x202020,a=1,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})--]]
end
function glassyboxbot(tlx,tly,cra,sw,sh,bg)
sho=sh
sw=sw-cra-cra
sh=sh-cra-cra
--BIG FILLED IN RECTANGLE
if bg~=1 then
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw+cra,y=0},
--{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh+cra},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh-cra},
--{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0x606060,a=0.3,p=0},{c=0x101010,a=0.3,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--[HIGHLIGHT TOP RECTANGLE
if bg~=1 and bg~=2 then
shh=((80/150)*sho)-cra-cra
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw+cra,y=0},
--{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=shh+cra},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-shh-cra},
--{d="arc_c",q=4,r=cra,degs=90},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=shh+cra+cra,
grad={{c=0xffffff,a=0.5,p=0},{c=0xffffff,a=0,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})
end
--OUTLINE
lt=1 --BOARDER WIDTH
tlx,tly=tlx-lt,tly-lt
cra1=cra+lt
subtab={
{d="start",x=tlx+cra+lt,y=tly},
{d="rline",x=sw+cra1,y=0},
--{d="arc_c",q=1,r=cra1,degs=90},
{d="rline",x=0,y=sh+cra1},
{d="arc_c",q=2,r=cra1,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra1,degs=90},
{d="rline",x=0,y=-sh-cra1},
--{d="arc_c",q=4,r=cra1,degs=90},
{d="rline",x=sw+cra1,y=0},
{d="rline",x=0,y=lt},
{d="rline",x=-sw-cra,y=0},
--{d="arc_a",q=4,r=cra,degs=90},
{d="rline",x=0,y=sh+cra},
{d="arc_a",q=3,r=cra,degs=90},
{d="rline",x=sw,y=0},
{d="arc_a",q=2,r=cra,degs=90},
{d="rline",x=0,y=-sh-cra},
--{d="arc_a",q=1,r=cra,degs=90},
{d="rline",x=-sw,y=0},
}
grec({
g=1,
x=tlx,
y=tly,
w=sw+cra+cra,
h=sh+cra+cra,
grad={{c=0x808080,a=1,p=0},{c=0x202020,a=1,p=1}},
lw=1,
sub=1,
db=0,
subtab=subtab})--]]
end
function flip_digit(tlx,tly,cra,sw,dig)
sh=(sw+cra+cra)*(120/80)
fs=(180/160)*sh
subtab={
{d="start",x=tlx+cra,y=tly},
{d="rline",x=sw,y=0},
{d="arc_c",q=1,r=cra,degs=90},
{d="rline",x=0,y=sh-cra-cra},
{d="arc_c",q=2,r=cra,degs=90},
{d="rline",x=-sw,y=0},
{d="arc_c",q=3,r=cra,degs=90},
{d="rline",x=0,y=-sh+cra+cra},
{d="arc_c",q=4,r=cra,degs=90},
}grec({g=1,x=tlx,y=tly,w=sw+cra+cra,h=sh+cra+cra,grad={{c=0x202020,a=1,p=0}},lw=1,sub=1,db=0,subtab=subtab})
tin=(sw+cra+cra)/8
tup=(sh)/12
out({x=tlx+tin,y=tly+sh-tup,fs=fs,txt=dig})
glassyboxtop(tlx,tly,cra,sw+cra+cra,sh/2,0)
glassyboxbot(tlx,tly+(sh/2),cra,sw+cra+cra,sh/2,0)
cairo_move_to(cr,tlx-1,tly+(sh/2))
cairo_rel_line_to(cr,sw+cra+cra+2,0)
cairo_set_source_rgba(cr,0,0,0,1)
cairo_set_line_width(cr,2)
cairo_stroke(cr)
end

and this is the code in the main function that is run every conky cycle, calling the additional functions

--HOURS
--hours
--first digit
hrs=time.hour_24_pad
dig=hrs:sub(1,1)
h2=hrs:sub(2,2)
tlx=50
tly=50
cra=10
sw=30
flip_digit(tlx,tly,cra,sw,dig)
--second digit
dig=hrs:sub(2,2)
tlx=105
tly=50
cra=10
sw=30
flip_digit(tlx,tly,cra,sw,dig)
--minutes
--first digit
min=tostring(time.min_pad)
dig=min:sub(1,1)
tlx=170
tly=50
cra=10
sw=20
flip_digit(tlx,tly,cra,sw,dig)
--second digit
dig=min:sub(2,2)
tlx=215
tly=50
cra=10
sw=20
flip_digit(tlx,tly,cra,sw,dig)

i just remembered that you will need another additional function, the out function from wun.lua
put it in first in the additional functions section:

function out(txj)--by mrpeachy--c,a,f,fs,face,x,y,txt,hj,vj,ro,sxo,syo,sfs,sface,sc,sa #########################################################
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
local function color(col,alp)
return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local function justify(jtxt,x,hj,y,vj,f,face,fs)
	if face=="normal" then
	face={f,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL}
	elseif face=="bold" then
	face={f,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD}
	elseif face=="italic" then
	face={f,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL}
	elseif face=="bolditalic" then
	face={f,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD}
	else
	print ('face not set correctly - "normal","bold","italic","bolditalic"')
	end
	cairo_select_font_face (cr,face[1],face[2],face[3])
	cairo_set_font_size(cr,fs)
	cairo_text_extents(cr,jtxt,extents)
	local wx=extents.x_advance
	local wd=extents.width
	local hy=extents.height
	local bx=extents.x_bearing
	local by=extents.y_bearing+hy
	local tx=x
	local ty=y
	--set horizontal alignment - l, c, r
	if hj=="l" then
	x=x-bx
	rad=0
	nx=tx+wx
	elseif hj=="c" then
	x=x-((wx-bx)/2)-bx
	rad=(wx-bx)/2
	nx=tx+(wx/2)
	elseif hj=="r" then
	x=x-wx
	rad=wx-bx
	nx=tx
	else
	print ("hj not set correctly - l, c, r")
	end
	--vj. n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
	if vj=="n" then
	y=y
	rad2=0
	ry=by
	elseif vj=="nb" then
	y=y-by
	rad2=-by
	ry=by
	elseif vj=="m" then
	y=y+((hy-by)/2)
	rad2=((hy-by)/2)
	ry=((hy-by)/2)-by
	elseif vj=="mb" then
	y=y+(hy/2)-by
	rad2=(hy/2)-by
	ry=((hy-by)/2)-by
	elseif vj=="t" then
	y=y+hy-by
	rad2=hy-by
	ry=0+by
	else
	print ("vj not set correctly - n, nb, m, mb, t")
	end
return face,fs,x,y,rad,rad2,tx,ty
end--justify local function #########################################################
--set variables
local c=txj.c 			or default_color		or 0xffffff
local a=txj.a 			or default_alpha		or 1
local f=txj.f 			or default_font			or "mono"
local fs=txj.fs 		or default_font_size		or 12
local x=txj.x 			or 100
local y=txj.y 			or 100
local txt=txj.txt 		or "set txt"
local hj=txj.hj 		or default_hj			or "l"
local vj=txj.vj 		or default_vj			or "n"
local ro=txj.ro			or defaukt_ro			or 0
local face=txj.face		or default_face			or "normal"
local wl=txj.wrap_len		or 0
local wrap_gap=txj.wrap_gap	or 15
--shadow
local shadow=txj.shadow 	or 0
local sxo=txj.sxo 		or default_sxo		or 2
local syo=txj.syo 		or default_syo 		or 2
local sc=txj.sc 		or defualt_sc		or 0x000000
local sa=txj.sa 		or default_sa		or 0.8
local sface=txj.sface		or default_sface	or face
local sfs=txj.sfs		or default_sfs		or fs
--print text ##################################################################
if wl>0 then--do wrap
	local tt={}
	local s=txt:gsub(" $","|"):gsub("  ","| "):gsub("  ","| ")
	for i in string.gmatch(s, "%S+") do --Where "%S+" is the string pattern.
	table.insert(tt,i)
	end
	local tl=#tt
	local sl=string.len(s)
	lines={}
	if sl<=wl or tl==1 then
	table.insert(lines,s)
	else
	--get longest entry in table
		longest=0
		for i=1,tl do
		local l=string.len(tt[i])
			if l>longest then
			longest=l
			end
		end
		if wl<longest then wl=longest+1 end
		while sl>wl and tl>1 do
		local ll=0
		local lt={}
			while ll+string.len(tt[1])<wl or string.len(tt[1])>wl do
			table.insert(lt,tt[1])
			table.remove(tt,1)
			line=table.concat(lt," ")
			ll=string.len(line)
			tl=#tt
			end--while
		table.insert(lines,line)
		lastline=table.concat(tt," ")
		sl=string.len(lastline)
		end--while
	table.insert(lines,lastline)
	end
end--if wrap
--rotation
if ro~=0 and wl==0 then	
	if shadow==1 then
		local face,fs,x,y,rad,rad2,tx,ty=justify(txt,x+sxo,hj,y+syo,vj,f,sface,sfs)	
		local point2=(math.pi/180)*(ro-180)
		local x2=tx+rad2*(math.sin(point2))
		local y2=ty-rad2*(math.cos(point2))
		local point=(math.pi/180)*(ro-90)
		local x1=x2+rad*(math.sin(point))
		local y1=y2-rad*(math.cos(point))
		cairo_save (cr)
		cairo_translate (cr,x1,y1)
		cairo_rotate(cr,(math.pi/180)*ro)
		cairo_select_font_face (cr,face[1],face[2],face[3])
		cairo_set_font_size(cr,fs)
		cairo_set_source_rgba (cr,color(sc,sa))
		cairo_show_text (cr,txt)
		cairo_stroke (cr)
		cairo_restore (cr)
	end--if shadow
	local face,fs,x,y,rad,rad2,tx,ty=justify(txt,x,hj,y,vj,f,face,sfs)
	local point2=(math.pi/180)*(ro-180)
	local x2=tx+rad2*(math.sin(point2))
	local y2=ty-rad2*(math.cos(point2))
	local point=(math.pi/180)*(ro-90)
	local x1=x2+rad*(math.sin(point))
	local y1=y2-rad*(math.cos(point))
	cairo_save (cr)
	cairo_translate (cr,x1,y1)
	cairo_rotate(cr,(math.pi/180)*ro)
	cairo_select_font_face (cr,face[1],face[2],face[3])
	cairo_set_font_size(cr,fs)
	cairo_set_source_rgba (cr,color(c,a))
	cairo_show_text (cr,txt)
	cairo_stroke (cr)
	cairo_restore (cr)
	return nx,ny
elseif wl>0 then
	for i=1,#lines do
		local txt=string.gsub(lines[i],"|"," ")
		if shadow==1 then
			local face,fs,x,y=justify(txt,x+sxo,hj,y+syo,vj,f,sface,sfs)
			cairo_select_font_face (cr,face[1],face[2],face[3])
			cairo_set_font_size(cr,fs)
			cairo_move_to (cr,x,y+(wrap_gap*(i-1)))
			cairo_set_source_rgba (cr,color(sc,sa))
			cairo_show_text (cr,txt)
			cairo_stroke (cr)
		end--if shadow
		local face,fs,x,y=justify(txt,x,hj,y,vj,f,face,fs)
		cairo_select_font_face (cr,face[1],face[2],face[3])
		cairo_set_font_size(cr,fs)
		cairo_move_to (cr,x,y+(wrap_gap*(i-1)))
		cairo_set_source_rgba (cr,color(c,a))
		cairo_show_text (cr,txt)
		cairo_stroke (cr)
	end--for i=1,#lines
	return #lines*wrap_gap
elseif ro==0 and wl==0 then
	--draw shadow first
	if shadow==1 then
		local face,fs,x,y=justify(txt,x+sxo,hj,y+syo,vj,f,sface,sfs)
		cairo_select_font_face (cr,face[1],face[2],face[3])
		cairo_set_font_size(cr,fs)
		cairo_move_to (cr,x,y)
		cairo_set_source_rgba (cr,color(sc,sa))
		cairo_show_text (cr,txt)
		cairo_stroke (cr)
	end--if shadow
	local face,fs,x,y=justify(txt,x,hj,y,vj,f,face,fs)
	cairo_select_font_face (cr,face[1],face[2],face[3])
	cairo_set_font_size(cr,fs)
	cairo_move_to (cr,x,y)
	cairo_set_source_rgba (cr,color(c,a))
	cairo_show_text (cr,txt)
	cairo_stroke (cr)
	return nx
end--if ro
end--function out

yes, that is a lot of code for a clock!  big_smile   big_smile

Offline

#6956 2014-01-26 19:51:23

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

well...well...well... Thank-you very much Mr Peachy  8)  yikes  8)
<-EDIT->
I've done a beautiful soup with lua codes and it doesn't work naturly, but I've founded really nice code you made and use this one until I'll find help in French to make the flip-flap code works. Understand and make your codes working is always an esthetic success...alaska2.jpg

Last edited by ragamatrix (2014-01-27 13:52:40)

Offline

#6957 2014-01-28 18:16:56

mikaere66
New Member
Registered: 2014-01-28
Posts: 4

Re: Conky v1.9 Thread

Dobbie03 wrote:
Sector11 wrote:

TEXT
${lua conky_draw_bg}${execi 300 curl -s "http://weathe... ... ...

Are you able to tell me the weather URLs for NZ please


There are only 10 types of people in this world: those who understand binary & those who don't!

Offline

#6958 2014-01-28 19:03:33

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

mikaere66 wrote:
Dobbie03 wrote:
Sector11 wrote:

TEXT
${lua conky_draw_bg}${execi 300 curl -s "http://weathe... ... ...

Are you able to tell me the weather URLs for NZ please

For what weather script?  And which weather site?

And where in NZ?

From the start of that code you posted it looks like it might be one of Teo's Scripts using weather.com

Christchurch, NZ is: http://www.weather.com/weather/today/NZXX0006:1

Type in the name of the city you are looking for.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6959 2014-01-29 12:50:21

Snap
#! Die Hard
Registered: 2013-10-22
Posts: 567

Re: Conky v1.9 Thread

... the font is: LED_Mono

Where? I cannot find it in the usual free fonts sites.

Offline

#6960 2014-01-29 15:40:39

ragamatrix
#! Junkie
From: Earth
Registered: 2012-12-05
Posts: 286

Re: Conky v1.9 Thread

Mr Peachy Thanks again for your .lua clock which works fine alone now ! Due of great competencies of Didier-T.
Your code is now modified from here
flip_flap.jpg
Enjoy !

Offline

#6961 2014-01-29 22:48:04

Snap
#! Die Hard
Registered: 2013-10-22
Posts: 567

Re: Conky v1.9 Thread

Sector11 wrote:

Had to take this last night as we were next for the big 10 second countdown, according to the conky that is:
http://s20.postimg.org/o275elo95/2013_12_31_20_04_57_1920x1080_Sector11.jpg

and for the Jan 2014 thread ... this is me this morning ... nothing much changed:
http://s20.postimg.org/72y6zcd1l/2014_01_01_08_40_17_1920x1080_Sector11.jpg

Have a great 2014 everyone!!!

Have you shared the code for this conky somewhere? I know it's based on ragamatrix's Conky-Sat-Map, but this one is just stunning.

Offline

#6962 2014-01-29 23:37:23

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Snap wrote:
Sector11 wrote:

Had to take this last night as we were next for the big 10 second countdown, according to the conky that is:

Have you shared the code for this conky somewhere? I know it's based on ragamatrix's Conky-Sat-Map, but this one is just stunning.

Say what, me share code?  Never!
I give it away! wink

Not based on ragamatrix's Conky-Sat-Map although I did steal an idea from him, as well as an idea from Habitual and then I talked Teo into the script that gets the data ... I just put it all together.  big_smile

Now if it is posted I can't find it.
The conky:

# killall conky && conky -c /media/5/Conky/S11_WTD.conky &
# Idea stolen from: ragamatrix and Habitual
#script by TeoBigusGeekus
# --------------------------------
# Daylight map.
# Written by John Jones / Habitual)
# 09/10/2010 07:37:21 AM
# Conky 1.8.0
# Remote image(s) is/are updated twice an hour on http://static.die.net and there are only 4 available.
# http://static.die.net/earth/mercator/640.jpg is 640x355
# http://static.die.net/earth/mercator/800.jpg is 800x444
# http://static.die.net/earth/mercator/1024.jpg is 1024x568
# http://static.die.net/earth/mercator/1280 .jpg 1280px × 710px (scaled to 1148px × 637px)

# Use ~/bin/daylight.sh to retrieve the remote image of your choice/size.

# Completely (re)written by John Jones on 09/01/2010
# from other people's code, but it's MY layout, so there.
# ---------------------------------
###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
#own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_hints below,skip_taskbar,skip_pager
own_window_class Conky
own_window_title World Time Date & Forecast - CCCC: S11, ragamatrix, Habitual & Teo
own_window_colour gray

# Use the Xdbe extension? (eliminates flicker)
# It is highly recommended to use own window with this one
# so double buffer won't be so big.
double_buffer yes

### ARGB can be used for real transparency
### NOTE that a composite manager is required for real transparency.
### This option will not work as desired (in most cases) in conjunction with
### own_window_type normal
# own_window_argb_visual yes

### When ARGB visuals are enabled, this use this to modify the alpha value
### Use: own_window_type normal
### Use: own_window_transparent no
### Valid range is 0-255, where 0 is 0% opacity, and 255 is 100% opacity.
# own_window_argb_value 0 #255

minimum_size 1600 887	### w|h
maximum_width 1600	### w

gap_x 0	### l|r
gap_y 0	### u|d

# Aligned position on screen: tl, tr, tm, bl, br, bm, ml, mr
alignment mm
##################################left#################  End Window Settings  ###
###  Font Settings  #########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont Liberation Sans:size=15
xftfont monofur:bold:size=12

# Alpha of Xft font. Must be a value at or between 1 and 0 ###
xftalpha 1
# Force UTF8? requires XFT ###
override_utf8_locale yes

##############################################################################

uppercase no

######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades yes #no # amplifies text if yes
default_shade_color 000000

draw_outline no # amplifies text if yes
default_outline_color 000000

#default_color B0E0E6 #176 224 230 PowderBlue
#default_color C0C0C0 #192 192 192 Silver
# =====
#default_color DCDCDC #220 220 220	Gainsboro
#default_color 8FBC8F #143 188 143	DarkSeaGreen
#default_color 778899 #119 136 153	LightSlateGray
#default_color D8BFD8 #216 191 216	Thistle
#default_color 9ACD32 #154 205  50	YellowGreen
#default_color FFA07A #255 160 122	LightSalmon
#default_color 00BFFF #  0 191 255	DeepSkyBlue
#default_color 5F9EA0 # 95 158 160	CadetBlue
#default_color BDB76B #189 183 107	DarkKhaki
#default_color CD5C5C #205  92  92	IndianRed
#default_color 228B22 # 34 139  34 ForestGreen

# =====
default_color FFDEAD #255 222 173	NavajoWhite
color0 8FBC8F #143 188 143	DarkSeaGreen
color1 778899 #119 136 153	LightSlateGray
color2 D8BFD8 #216 191 216	Thistle
color3 9ACD32 #154 205  50	YellowGreen
color4 FFA07A #255 160 122	LightSalmon
color5 FFDEAD #255 222 173	NavajoWhite
color6 00BFFF #  0 191 255	DeepSkyBlue
color7 5F9EA0 # 95 158 160	CadetBlue
color8 BDB76B #189 183 107	DarkKhaki
color9 FFD700 #255 215   0 Gold		FF1493 #255  20 147 DeepPink		FF69B4 #255 105 180 HotPink		FFB6C1 #255 182 193 LightPink		FFC0CB #255 192 203 Pink		F08080 #240 128 128	LightCoral		FA8072 #250 128 114	Salmon
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes
#default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

# Adds spaces around certain objects to stop them from moving other things
# around, this only helps if you are u3sing a mono font
# Options: right, left or none
use_spacer none

# Default and Minimum size is 256 - needs more for single commands that
# "call" a lot of text IE: bash scripts
## text_buffer_size 1028 # required for the horiz-cal

# Subtract (file system) buffers from used memory?
no_buffers yes

# change GiB to G and MiB to M
short_units yes

# Like it says, ot pads the decimals on % values
# doesn't seem to work since v1.7.1
pad_percents 2

#   Maximum size of user text buffer, i.e. layout below TEXT line in config file
#  (default is 16384 bytes)
# max_user_text 16384

# Desired output unit of all objects displaying a temperature. Parameters are
# either "fahrenheit" or "celsius". The default unit is degree Celsius.
# temperature_unit Fahrenheit

## Imlib2 image cache size, in bytes. Defaults to 4MiB. Increase this value
## if you use $image lots.		Set to 0 to disable the image cache.
imlib_cache_size 0

#top_name_width 15
##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## Above and After TEXT - requires a composite manager or it blinks.
##
# lua_load ~/wea_conky/draw_bg.lua
## TEXT
## ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.2}
## ${lua conky_draw_bg corner_radius x_position y_position width height color alpha}
##
##
## OR Both above TEXT (No composite manager required - no blinking!)
##
 lua_load /media/5/Conky/LUA/draw-bg.lua
 lua_draw_hook_pre draw_bg 0 5 6 1601 888 0x000000 0.3
#
# TEXT
#

## Once working change this to 15
update_interval 1

# ${image /media/5/Conky/images/Sector11.png -p 15,30 -s 199x81}\
# ${image /home/sector11/conky/images/logo.png -p 20,25 -s 170x88}\

## lua_load /media/5/Conky/LUA/draw-bg.lua

##TEXT  NOTE  During development run majorcities manually via thunar!
##${execi 1800 ~/bin/daylight.sh}${texeci 1800 bash /media/5/Conky/scripts/WTD/majorcities}${image /media/5/Conky/images/world_1600.jpg}

TEXT
${execi ~/bin/daylight.sh}\
${texeci 86400 bash /media/5/Conky/scripts/WTD/majorcities}\
${image /media/5/Conky/images/world_1600.jpg}
${alignc}${tztime America/Anchorage %a %d %b %Y} «--${color1}|${color6}--» ${tztime NZ %a %d %b %Y}${color}









${goto 925}+ ${if_match ${tztime Europe/Moscow %d} == ${tztime NZ %d}}${color6}Moskva ${tztime Europe/Moscow %R}${color}${else}Moskva ${tztime Europe/Moscow %R}${endif}
${goto 925}${color6}${execpi 1800 sed -n '218p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '219p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '220p' /media/5/Conky/scripts/WTD/MC_data}${color}
${goto 760}+ ${if_match ${tztime Europe/London %d} == ${tztime NZ %d}}${color6}London ${tztime Europe/London %R}${color}${else}London ${tztime Europe/London %R}${endif}
${goto 760}${color6}${execpi 1800 sed -n '206p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '207p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '208p' /media/5/Conky/scripts/WTD/MC_data}${color}\
${goto 85}${voffset 5}${if_match ${tztime Canada/Pacific %d} == ${tztime NZ %d}}${color6}Vancouver ${tztime Canada/Pacific %R} +${color}${else}Vancouver ${tztime Canada/Pacific %R} +${endif}${voffset -5}\
${goto 322}${if_match ${tztime America/Winnipeg %d} == ${tztime NZ %d}}${color6}+ Winnipeg ${tztime America/Winnipeg %R}${color}${else}+ Winnipeg ${tztime America/Winnipeg %R}${endif}
${goto 85}${voffset 5}${color6}${execpi 1800 sed -n '355p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '356p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '357p' /media/5/Conky/scripts/WTD/MC_data}${color}${voffset -5}\
${goto 322}${color6}${execpi 1800 sed -n '363p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '364p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '365p' /media/5/Conky/scripts/WTD/MC_data}${color}
${goto 440}${if_match ${tztime America/New_York %d} == ${tztime NZ %d}}${color6}+ New York ${tztime America/New_York %R}${color}${else}+ New York ${tztime America/New_York %R}${endif}\
${goto 816}+ ${if_match ${tztime Europe/Rome %d} == ${tztime NZ %d}}${color6}Rome ${tztime Europe/Rome %R}${color}${else}Rome ${tztime Europe/Rome %R}${endif}
${goto 440}${color6}${execpi 1800 sed -n '323p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '324p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '325p' /media/5/Conky/scripts/WTD/MC_data}${color}\
${goto 628}${voffset -3}${if_match ${tztime Europe/Madrid %d} == ${tztime NZ %d}}${color6}Madrid ${tztime Europe/Madrid %R}${color}${else}Madrid ${tztime Europe/Madrid %R}${endif} +${voffset 3}\
${goto 816}${color6}${execpi 1800 sed -n '234p' /media/5/Conky/scripts/WTD/MC_data} ${color9}${execpi 1800 sed -n '235p' /media/5/Conky/scripts/WTD/MC_data}${color4} ${execpi 1800 sed -n '236p' /media/5/Conky/scripts/WTD/MC_data}${color}\
${voffset -4}${goto 1162}${if_match ${tztime Asia/Shanghai %d} == ${tztime NZ %d}}${color6}Beijing ${tztime Asia/Shanghai %R}${color}${else}Beijing ${tztime Asia/Shanghai %R}${endif} +${voffset 4}
${goto 628}${voffset -3}${color6}${execpi 1800 sed -n '210p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '211p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '212p' /media/5/Conky/scripts/WTD/MC_data}${voffset 3}\
${voffset -4}${goto 1162}${color6}${execpi 1800 sed -n '15p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '16p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '17p' /media/5/Conky/scripts/WTD/MC_data}${color}${voffset 4}\
${goto 1380}+ ${if_match ${tztime Asia/Tokyo %d} == ${tztime NZ %d}}${color6}Tokyo ${tztime Asia/Tokyo %R}${color}${else}Tokyo ${tztime Asia/Tokyo %R}${endif}
${goto 1380}${color6}${execpi 1800 sed -n '99p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '100p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '101p' /media/5/Conky/scripts/WTD/MC_data}${color}
${voffset -4}${goto 895}+ ${if_match ${tztime Africa/Cairo %d} == ${tztime NZ %d}}${color6}Cairo ${tztime Africa/Cairo %R}${color}${else}Cairo ${tztime Africa/Cairo %R}${endif}${voffset 4}\
${goto 1100}+ ${if_match ${tztime GMT-5:30 %d} == ${tztime NZ %d}}${color6}New Delhi ${tztime GMT-5:30 %R}${color}${else}New Delhi ${tztime GMT-5:30 %R}${endif}
${goto 400}${if_match ${tztime US/Eastern %d} == ${tztime NZ %d}}${color6}+ Miami ${tztime US/Eastern %R}${color}${else}+ Miami ${tztime US/Eastern %R}${endif}\
${voffset -4}${goto 895}${color6}${execpi 1800 sed -n '116p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '117p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '118p' /media/5/Conky/scripts/WTD/MC_data}${voffset 4}${color}\
${goto 1100}${color6}${execpi 1800 sed -n '71p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '72p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '73p' /media/5/Conky/scripts/WTD/MC_data}${color}
${goto 400}${color6}${execpi 1800 sed -n '311p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '312p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '313p' /media/5/Conky/scripts/WTD/MC_data}${color}
${goto 213}${voffset -7}${if_match ${tztime America/Mexico_City %d} == ${tztime NZ %d}}${color6}Mexico ${tztime America/Mexico_City %R} +${color}${else}Mexico ${tztime America/Mexico_City %R} +${endif}${voffset 7}${color}
${goto 213}${voffset -7}${color6}${execpi 1800 sed -n '307p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '308p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '309p' /media/5/Conky/scripts/WTD/MC_data}${voffset 7}${color}









${goto 1320}${if_match ${tztime Australia/Brisbane %d} == ${tztime NZ %d}}${color6}Brisbane ${tztime Australia/Brisbane %R}${color}${else}Brisbane ${tztime Australia/Brisbane %R}${endif} +
${goto 1320}${color6}${execpi 1800 sed -n '133p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '134p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '135p' /media/5/Conky/scripts/WTD/MC_data}${color}
${goto 320}${voffset -3}${if_match ${tztime Chile/Continental %d} == ${tztime NZ %d}}${color6}Santiago ${tztime Chile/Continental %R}${color}${else}Santiago ${tztime Chile/Continental %R}${endif} +${voffset 3}\
${goto 500}+ ${if_match ${tztime America/Buenos_Aires %d} == ${tztime NZ %d}}${color6}Buenos Aires ${tztime America/Buenos_Aires %R}${color}${else}Buenos Aires ${tztime America/Buenos_Aires %R}${endif}\
${goto 845}${if_match ${tztime Africa/Johannesburg %d} == ${tztime NZ %d}}${color6}+ Cape Town ${tztime Africa/Johannesburg %R}${color}${else}+ Cape Town ${tztime Africa/Johannesburg %R}${endif}
${goto 320}${voffset -3}${color6}${execpi 1800 sed -n '388p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '389p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '390p' /media/5/Conky/scripts/WTD/MC_data}${voffset 3}${color}\
${goto 500}${color6}${execpi 1800 sed -n '372p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '373p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '374p' /media/5/Conky/scripts/WTD/MC_data}${color}\
${goto 845}${color6}${execpi 1800 sed -n '120p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '121p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '122p' /media/5/Conky/scripts/WTD/MC_data}\
${goto 1272}${if_match ${tztime Australia/Melbourne %d} == ${tztime NZ %d}}${color6}Melbourne ${tztime Australia/Melbourne %R}${color}${else}Melbourne ${tztime Australia/Melbourne %R}${endif} +\
${goto 1415}${voffset -5}${color6}Auckland ${tztime Pacific/Auckland %R} ${color}+${voffset 5}
${goto 1272}${color6}${execpi 1800 sed -n '145p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '146p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '147p' /media/5/Conky/scripts/WTD/MC_data}${color}\
${goto 1415}${voffset -5}${color6}${execpi 1800 sed -n '129p' /media/5/Conky/scripts/WTD/MC_data} ${color4}${execpi 1800 sed -n '130p' /media/5/Conky/scripts/WTD/MC_data}${color9} ${execpi 1800 sed -n '131p' /media/5/Conky/scripts/WTD/MC_data}${color}${voffset 5}

~/bin/daylight.sh by Habitual

#!/bin/bash

rm -f /media/5/Conky/images/world_1600.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_640.jpg http://static.die.net/earth/mercator/640.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_800.jpg http://static.die.net/earth/mercator/800.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_1024.jpg http://static.die.net/earth/mercator/1024.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_1280.jpg http://static.die.net/earth/mercator/1280.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_1600.jpg http://static.die.net/earth/mercator/1600.jpg

wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_1600.jpg http://static.die.net/earth/mercator/1600.jpg
# or # wget -U Mozilla/5.0 http://static.die.net/earth/mercator/640.jpg
## kill -HUP `ps axu | grep conky | grep daylight | grep -v grep | awk '{print $2}'` >/dev/null 2>&1
# killall -HUP conky

/media/5/Conky/scripts/WTD/majorcities by TEO

#!/bin/bash
# TeoBigusGeekus - 20130915
# for use with Map_Time_Weather.conky
kill -STOP $(pidof conky)
killall wget

wget -O /media/5/Conky/scripts/WTD/MC_data http://www.hko.gov.hk/wxinfo/worldwx/majorcities.htm

sed -i -e 's/^.*font\x27>//g' -e 's/^.*99;\x27>//g' -e 's/^.*D70000;\x27>//g' -e 's/^.*000000;\x27>//g' /media/5/Conky/scripts/WTD/MC_data
sed -i -e '/Updated/s/<\/span>.*$//g' -e 's/^.*<strong>//g' -e 's/<\/strong>.*$//g' -e 's/<\/span>.*$//g' -e '/<\|>\|{\|\r\|\*/d' /media/5/Conky/scripts/WTD/MC_data
#sed -i '2,4d' /media/5/Conky/ragamatrix_Map/MC_data

kill -CONT $(pidof conky)

In the conky this:

#own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_hints below,skip_taskbar,skip_pager

Opens the conky in a box! (window - but not THAT one)
2014_01_29_20_19_49_1920x1080_Sector11.jpg


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6963 2014-01-30 07:54:54

Snap
#! Die Hard
Registered: 2013-10-22
Posts: 567

Re: Conky v1.9 Thread

Thanks!  Nice bits of code.

What's that MC_data file? Is it the majorcities by Teo script posted above?

Actually... what amazes me more is how you guys manage to find those websites to grab the info and data!  tongue

Last edited by Snap (2014-01-30 08:02:13)

Offline

#6964 2014-01-30 11:53:21

boisei0
#! CrunchBanger
From: Gaanderen, Netherlands
Registered: 2013-07-16
Posts: 193

Re: Conky v1.9 Thread

Snap wrote:

Thanks!  Nice bits of code.

What's that MC_data file? Is it the majorcities by Teo script posted above?

Actually... what amazes me more is how you guys manage to find those websites to grab the info and data!  tongue

When looking at the code, I saw this line in Teo's script:

wget -O /media/5/Conky/scripts/WTD/MC_data http://www.hko.gov.hk/wxinfo/worldwx/majorcities.htm

The -O option of wget saves a downloaded url to the location passed with the option. So yes, the MC_data file is this majorcities.html page.

Last edited by boisei0 (2014-01-30 11:53:35)


YAWS (cli weather script with conkyForecast syntax) | Bitbucket | Github | Blog
Member of the Unofficial #! Emergency Tinfoil Hat Distribution Center
Emergency Tinfoil Hat Conky Alert System development team

Offline

#6965 2014-01-30 16:21:18

tmq
#! Member
Registered: 2012-05-30
Posts: 84

Re: Conky v1.9 Thread

I somehow have two identical instances of Conky running at once. I guess Conky is getting auto-started twice (in XFCE)? SOLVED -  see post #6972!

Last edited by tmq (2014-01-31 03:26:14)

Offline

#6966 2014-01-30 16:49:21

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

tmq wrote:

I somehow have two identical instances of Conky running at once. I guess Conky is getting auto-started twice?

Are they the default ~/.conkyrc or some conky started with:

conky -c /path/to/conky

Are you using OpenBox?
What does ~/.config/openbox/autostart say for conky?

How do you normally start your conky?

Last edited by Sector11 (2014-01-30 16:49:56)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6967 2014-01-30 17:26:02

mikaere66
New Member
Registered: 2014-01-28
Posts: 4

Re: Conky v1.9 Thread

Greetings from New Zealand smile

Last edited by mikaere66 (2014-01-31 00:01:52)


There are only 10 types of people in this world: those who understand binary & those who don't!

Offline

#6968 2014-01-30 17:50:46

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

mikaere66 wrote:

Well done ... I recognize a few of mrpeachy's scripts in there.  big_smile
Greetings from Buenos Aires.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6969 2014-01-30 17:50:53

mikaere66
New Member
Registered: 2014-01-28
Posts: 4

Re: Conky v1.9 Thread

Sector11 wrote:

Type in the name of the city you are looking for.

Thanks I got it working Finally with Auckland weather


There are only 10 types of people in this world: those who understand binary & those who don't!

Offline

#6970 2014-01-30 19:09:17

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

Sector11 wrote:
mikaere66 wrote:

Well done ... I recognize a few of mrpeachy's scripts in there.  big_smile
Greetings from Buenos Aires.

big_smile  i wonder what kind of journey my dial scrip has been through to end up in mikaere66's conky
I like how it looks cool

i was looking for that script recently, but i couldnt find it in my files LOL
it must be somewhere!

Last edited by mrpeachy (2014-01-30 19:09:57)

Offline

#6971 2014-01-30 22:14:46

sjv047
Member
Registered: 2013-11-20
Posts: 23

Re: Conky v1.9 Thread

Hello all.

Just changed my distro from Mint to Crunchbang, and I'm loving it so far... BUT... since I've changed, my conky config is "off" a bit... I am using mounted.lua and I've noticed that my harddrive information is showing up (drawing) as a uuid description instead of a simple sba (or something like that... don't remember) but instead is listed as /dev/disk/by-uuid/..........

Because of this misdirection of this line item, my HDD temp also doesn't work, but I know that with one fix, the other one will probably be good to go...

I realize that the internal workings and directory information has changed from Mint to Crunch, but cannot seem to figure out how to change the pointing to show up (draw) the correct information in my conky setup.

Any ideas? I've attached the conky file.

################################
#       Conky Settings         #
################################
update_interval 1.0
total_run_times 0
cpu_avg_samples 2
net_avg_samples 2

imlib_cache_size 0
double_buffer true
no_buffers true

format_human_readable
background true

################################
#        Text Settings         #
################################
use_xft true
xftfont Liberation Sans:size=8
xftalpha 0.8
text_buffer_size 256
uppercase false
override_utf8_locale true

################################
#      Windows Settings        #
################################
own_window_class Conky
own_window true
own_window_transparent true
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

alignment top_right
gap_x 12
gap_y 15
minimum_size 200 1000
maximum_width 250

default_bar_size 85 5

################################
#      Graphic Settings        #
################################
draw_shades false
draw_outline false
draw_borders false
draw_graph_borders false
stippled_borders 0
border_margin 5
border_width 1
default_color white
own_window_colour white
own_window_argb_visual true
use_spacer none

#########lua script(s)#########
lua_load ~/mounted.lua

TEXT
${lua get_mounted_data 10}
${alignc 10}${font Trebuchet MS:size=14}${time %H:%M}, ${time %y%m%d}${font}
#
########## System Information ##########
${color Blue}SYSTEM INFORMATION${color orange}${hr 2}$color
#
Host:${alignr}${nodename}
User:${alignr}${user_names}
Distro:${alignr}${texeci 99999 cat /etc/issue.net}
CPU: ${alignr}${texeci 99999 cat /proc/cpuinfo | grep 'model name' | sed -e 's/model name.*: //'| uniq | cut -c 1-26}
Kernel:${alignr}${kernel}
Uptime:${alignr}${uptime}
MAC Address:${alignr}${texeci 99999 cat /sys/class/net/eth0/address }
CPU Temp:${alignr}${if_match ${hwmon 0 tempf 1} <= 149}${color green}${hwmon 0 tempf 1}${color}${endif}${if_match ${hwmon 0 tempf 1} >=150}${color red}${hwmon 0 tempf 1}${color}${endif} °F / ${if_match ${hwmon 0 temp 1} <=64}${color green}${hwmon 0 temp 1}${color}${endif}${if_match ${hwmon 0 temp 1} >=65}${color red}${hwmon 0 temp 1}${color}${endif}°C
${stippled_hr 1}
#
CPU:${alignr}${cpu cpu0}% ${if_match ${cpu cpu0} <= 19}${color green}${cpubar 8,100 cpu0}${color}${endif}${if_match ${cpu cpu0} >=20}${if_match ${cpu cpu0} <=49}${color yellow}${cpubar 8,100 cpu0}${color}${endif}${endif}${if_match ${cpu cpu0} >=50}${if_match ${cpu cpu0} <=74}${color orange}${cpubar 8,100 cpu0}${color}${endif}${endif}${if_match ${cpu cpu0} >= 75}${if_match ${cpu cpu0} <=100}${color red}${cpubar 8,100 cpu0}${color}${endif}${endif}
${alignr}${freq_g 0}GHz
#
Power:${alignr}${battery_short}${if_match ${battery_percent BAT0} <= 10}${color red}${battery_bar 8,100 BAT0}${color}${endif}${if_match ${battery_percent BAT0} >= 11}${if_match ${battery_percent BAT0} <=49}${color orange}${battery_bar 8,100 BAT0}${color}${endif}${endif}${if_match ${battery_percent BAT0} >= 50}${if_match ${battery_percent BAT0} <=79}${color yellow}${battery_bar 8,100 BAT0}${color}${endif}${endif}${if_match ${battery_percent BAT0} >= 80}${if_match ${battery_percent BAT0} <=100}${color green}${battery_bar 8,100 BAT0}${color}${endif}${endif}
${alignr}${battery_time}
#
Memory:${alignr}${memperc}% ${if_match ${memperc} <= 24}${color green}${membar 8,100}${color}${endif}${if_match ${memperc} >= 25}${if_match ${memperc} <=49}${color yellow}${membar 8,100}${color}${endif}${endif}${if_match ${memperc} >= 50}${if_match ${memperc} <=74}${color orange}${membar 8,100}${color}${endif}${endif}${if_match ${memperc} >= 80}${if_match ${memperc} <=100}${color red}${membar 8,100}${color}${endif}${endif}
${alignr}${mem} / ${memmax}

########## HDD ##########
${color Blue}DISK(S) INFORMATION${color orange}${hr 2}$color
Total Mounted Drives:${alignr} ${lua mount 1 total}
Disk I/O: ${alignr} ${diskio}
Processes:${alignr}$processes / $running_processes
HDD Temp:${alignr}${if_match ${texec hddtemp /dev/sda -n --unit=F} <= 149}${color green}${exec hddtemp /dev/sda -n --unit=F}${color}${endif}${if_match ${exec hddtemp /dev/sda -n --unit=F} >=150}${color red}${exec hddtemp /dev/sda -n --unit=F}${color}${endif} °F / ${if_match ${exec hddtemp /dev/sda -n --unit=C} <=64}${color green}${exec hddtemp /dev/sda -n --unit=C}${color}${endif}${if_match ${exec hddtemp /dev/sda -n --unit=C} >=65}${color red}${exec hddtemp /dev/sda -n --unit=C}${color}${endif}°C
${stippled_hr 1}
#
########## REMOVABLE DRIVES ##########
${color orange}System Name${goto 100}Size${alignr}Used%$color
${lua mount 1 fsys}${goto 100}${lua mount 1 size}${alignr}${lua mount 1 use%}
${lua mount 2 fsys}${goto 100}${lua mount 2 size}${alignr}${lua mount 2 use%}
${lua mount 3 fsys}${goto 100}${lua mount 3 size}${alignr}${lua mount 3 use%}
${lua mount 4 fsys}${goto 100}${lua mount 4 size}${alignr}${lua mount 4 use%}
#
########## NETWORK INFORMATION ##########
${color Blue}NETWORK INFORMATION${color orange}${hr 2}$color
#${color green}In: ${color white}${tcp_portmon 1 32767 count} ${color green}Out: ${color white}${tcp_portmon 32768 61000 count}${alignr}${color green}Total: ${color white}${tcp_portmon 1 65535 count}

#
########## WIFI CONNECTION INFO ##########
${if_existing /proc/net/route wlan0}WiFi: ${if_match ${wireless_link_qual wlan0} <= 10}${color red}${wireless_link_qual wlan0}%${color}${endif}${if_match ${wireless_link_qual wlan0} >= 11}${if_match ${wireless_link_qual wlan0} <=49}${color orange}${wireless_link_qual wlan0}%${color}${endif}${endif}${if_match ${wireless_link_qual wlan0} >=50}${if_match ${wireless_link_qual wlan0} <=74}${color yellow}${wireless_link_qual wlan0}%${color}${endif}${endif}${if_match ${wireless_link_qual wlan0} >= 75}${if_match ${wireless_link_qual wlan0} <=100}${color green}${wireless_link_qual wlan0}%${color}${endif}${endif} ${alignr}SSID: ${wireless_essid wlan0}
IP address:${alignr}${addr wlan0}
Public IP:${alignr}${texeci 3600 wget -q -O /dev/stdout http://checkip.dyndns.org/ | cut -d : -f 2- | cut -d \< -f -1}
Speed:$alignr${wireless_bitrate wlan0}
Down: ${downspeed wlan0}${alignr} Up: ${upspeed wlan0}
Total: ${totaldown wlan0}${alignr} Total: ${totalup wlan0}
$color${downspeedgraph wlan0 15,100 000000 ff0000} ${alignr}${upspeedgraph wlan0
15,100 000000 00ff00}$color
${endif}
#
########## LAN CONNECTION INFO ##########
${if_existing /proc/net/route eth0}Wired
IP address:${alignr}${addr eth0}
Public IP:${alignr}${execi 3600 wget -q -O /dev/stdout http://checkip.dyndns.org/ | cut -d : -f 2- | cut -d \< -f -1}
Speed:${alignr}${execi 99999 cat /sys/class/net/eth0/speed }Mb/s
Down: ${downspeed eth0}${alignr} Up: ${upspeed eth0}
Total: ${totaldown eth0}${alignr} Total: ${totalup eth0}
$color${downspeedgraph eth0 15,85 000000 ff0000 -lt} ${alignr}${upspeedgraph eth0
15,85 000000 00ff00 -lt}$colorf${endif}
############# SHORTCUT KEYS #############
${font Sans:size=7}
Super+Space$alignr Main Menu
Super+t$alignr Terminal
Super+f$alignr File Manager
Super+e$alignr Editor
Super+w$alignr Web Browser
Super+h$alignr Task Manager
Super+x$alignr Logout
${font}

Offline

#6972 2014-01-30 22:51:32

tmq
#! Member
Registered: 2012-05-30
Posts: 84

Re: Conky v1.9 Thread

Sector11 wrote:

Are they the default ~/.conkyrc or some conky started with:

conky -c /path/to/conky

Are you using OpenBox?
What does ~/.config/openbox/autostart say for conky?

How do you normally start your conky?

I'm presently using xfce w/a fedora base; usually I set conky to autostart using the xfce gui.

EDIT - I seem to have fixed  the redundant conky problem in XFCE -

1)Emptied /etc/conky/ (removed the initial conky layout)
2)Cleared "the saved sessions" - likely the real culprit (found under Session & Startup)
3)Placed my custom .conkyrc in my home folder
4)Added "conky" to autostart (see Session & Startup again), use command > usr/bin/conky
5)Unchecked the "Save Session for Future Logins" box found in the logout dialogue
6)Rebooted the system

Last edited by tmq (2014-01-31 03:27:36)

Offline

#6973 2014-01-30 23:03:47

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

sjv047 wrote:

Hello all.

Just changed my distro from Mint to Crunchbang, and I'm loving it so far... BUT... since I've changed, my conky config is "off" a bit... I am using mounted.lua and I've noticed that my harddrive information is showing up (drawing) as a uuid description instead of a simple sba (or something like that... don't remember) but instead is listed as /dev/disk/by-uuid/..........

Because of this misdirection of this line item, my HDD temp also doesn't work, but I know that with one fix, the other one will probably be good to go...

I realize that the internal workings and directory information has changed from Mint to Crunch, but cannot seem to figure out how to change the pointing to show up (draw) the correct information in my conky setup.

Any ideas? I've attached the conky file.

hi! let me dig out my copy of mounted.lua and see what is possible
mounted lua returns the output of (i believe) df (or some variation of df)

whatever df shows, mounted lua shows

Last edited by mrpeachy (2014-01-30 23:04:23)

Offline

#6974 2014-01-30 23:13:07

sjv047
Member
Registered: 2013-11-20
Posts: 23

Re: Conky v1.9 Thread

mrpeachy,

That's correct. I did df in terminal, and it came up with the same ID as what is showing in conky. Why is this different between the 2 distros then? In Mint it worked fine, yet with Crunch is doesn't?

This is the df output and exactly what is showing up in my conky:
/dev/disk/by-uuid/c4cc56fc-fa37-4182-a503-ac86375ba5ca 149725476 17690100 124429720  13% /

Is there any way to not show the uuid information besides manually entering the information in?

Offline

Be excellent to each other!

#6975 2014-01-30 23:27:25

mrpeachy
20% cooler
From: The Everfree Forest
Registered: 2009-11-08
Posts: 3,460

Re: Conky v1.9 Thread

have a look at this thread and see if anything there helps
http://crunchbang.org/forums/viewtopic.php?id=25901

im using mint, so i wont be able to test any of the suggestions

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo