SEARCH

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

You are not logged in.

#4326 2012-12-12 21:05:59

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,214
Website

Re: Conky v1.9 Thread

mrpeachy wrote:

you are welcome
and thanks, this clock is one of my personal favorites also... and topical big_smile

I've always liked it as well.  And yes, the French will be a bit different to program than English:

version5.18.11 is wonderful!
adoxGVXh.jpg

And yes, so topical these days.....
abm4p0Wn.jpg
I'll be retiring that wallpaper and conky (the centre one that does the countdowns)

The other two of course I'll have for a long time.  Both your work mrpeachy.  The calendar has changes somewhat, since this version.  big_smile

TEXT
${lua luacal {x=10,y=25,tf="bitwise",tfs=24,tc=0x49D0C9,ta=1,bf="bitwise",bfs=26,bc=0x49D0C9,ba=1,hf="bitwise",hfs=26,hc=0xFF0000,ha=1,sp="0",gh=45,gt=35,gv=30,sd=0,hstyle=1,tdf="bitwise",tdfs=28,tdc=0xff0000,tda=1}}

Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

Be excellent to each other!

#4327 2012-12-13 09:09:40

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: Conky v1.9 Thread

Sector11 wrote:
mrpeachy wrote:

you are welcome
and thanks, this clock is one of my personal favorites also... and topical big_smile

I've always liked it as well.  And yes, the French will be a bit different to program than English:

version5.18.11 is wonderful!
http://t.imgbox.com/adoxGVXh.jpg

And yes, so topical these days.....
http://t.imgbox.com/abm4p0Wn.jpg
I'll be retiring that wallpaper and conky (the centre one that does the countdowns)

The other two of course I'll have for a long time.  Both your work mrpeachy.  The calendar has changes somewhat, since this version.  big_smile

TEXT
${lua luacal {x=10,y=25,tf="bitwise",tfs=24,tc=0x49D0C9,ta=1,bf="bitwise",bfs=26,bc=0x49D0C9,ba=1,hf="bitwise",hfs=26,hc=0xFF0000,ha=1,sp="0",gh=45,gt=35,gv=30,sd=0,hstyle=1,tdf="bitwise",tdfs=28,tdc=0xff0000,tda=1}}

Love that second wallpaper! Fantastic job as usual buddy

Offline

#4328 2012-12-13 09:10:40

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: Conky v1.9 Thread

Something new Im working on

tZ29iOQ

tZ29iZQ

Last edited by lwfitz (2012-12-13 09:12:22)

Offline

#4329 2012-12-13 13:23:59

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

Re: Conky v1.9 Thread

@Mr Peachy
I'm triyng to use differents scripts in the mayan conky, and I got problems to launch the "draw-bg"script.
When it's launched with the mayan script I've got :

┌─( climatix ) - ( 3.2.0-34-generic ) - ( ~ )
└─> 
Conky: desktop window (ae) is root window
Conky: window type - override
Conky: drawing to created window (0x1a00001)
Conky: drawing to double buffer
	version = v4.9
	web = http://www.accuweather.com/fr/ch/horgen/316407/current-weather/316407
	Pévision Nb jours = 5
	Pévision Matin = oui
	Pévision Après Midi = oui
	Pévision Soirée = oui
	Pévision Nuit = oui
	Prévision sur 8 heures = oui
	Délais = 900
	Chemin de travail = /tmp
	Palier = 20
	Chemin de sauvegarde = /home/climatix/.conky/conky38/meteo
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/.conky/conky38/draw-bg.lua:79: attempt to perform arithmetic on local 'colour' (a table value)
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/.conky/conky38/draw-bg.lua:79: attempt to perform arithmetic on local 'colour' (a table value)
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/.conky/conky38/draw-bg.lua:79: attempt to perform arithmetic on local 'colour' (a table value)

without draw-bg:
without
with draw-bg:
with

Last edited by ragamatrix (2012-12-13 13:28:07)

Offline

#4330 2012-12-13 16:10:28

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,214
Website

Re: Conky v1.9 Thread

lwfitz wrote:

Love that second wallpaper! Fantastic job as usual buddy

The wall paper by itself isn't much ... I should have made ALL the text by conky.

adtlYeBP.jpg monkey
And the conky is a simple use of K's apps:

TEXT

${font bitwise:size=25}${alignc}${voffset 490}${color0}in ${exec /media/5/Conky/scripts/conkyDateDiff.py 20121221}${color}
${goto 245}${voffset 15}${color2}${exec /media/5/Conky/scripts/conkyDaysDiff.py 20121221}${color}
${goto 135}${voffset 34}${color2}${exec /media/5/Conky/scripts/conkyDaysDiff.py 20121222}${color7} days!

maybe I'll do that  ... then on 22 Dec I make one that says The Mayan's were wrong!  big_smile


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#4331 2012-12-13 16:13:57

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,214
Website

Re: Conky v1.9 Thread

lwfitz wrote:

Beautiful ... share the code????


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#4332 2012-12-13 16:41:00

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

Re: Conky v1.9 Thread

ragamatrix wrote:

@Mr Peachy
I'm triyng to use differents scripts in the mayan conky, and I got problems to launch the "draw-bg"script.
When it's launched with the mayan script I've got :

Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/.conky/conky38/draw-bg.lua:79: attempt to perform arithmetic on local 'colour' (a table value)
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/.conky/conky38/draw-bg.lua:79: attempt to perform arithmetic on local 'colour' (a table value)
Conky: llua_do_call: function conky_draw_fig execution failed: /home/climatix/.conky/conky38/draw-bg.lua:79: attempt to perform arithmetic on local 'colour' (a table value)

can you post the version of draw-bg.lua you are using

Offline

#4333 2012-12-13 16:52:57

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

Re: Conky v1.9 Thread

@Mr Peachy
Yes there's:

--[[Background originally by londonali1010 (2009)
    ability to set any size for background mrpeachy 2011
    ability to set variables for bg in conkyrc dk75

  the change is that if you set width and/or height to 0
  then it assumes the width and/or height of the conky window

so:

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.4}

OR Both above TEXT (no composite manager required - no blinking!)

 lua_load ~/wea_conky/draw_bg.lua
 lua_draw_hook_pre draw_bg 10 0 0 0 0 0x000000 0.5
 TEXT

Note
${lua conky_draw_bg 20 0 0 0 0 0x000000 0.4}
  See below:        1  2 3 4 5 6        7

${lua conky_draw_bg corner_radius x_position y_position width height color alpha}

covers the whole window and will change if you change the minimum_size setting

1 = 20             corner_radius
2 = 0             x_position
3 = 0             y_position
3 = 0             width
5 = 0             height
6 = 0x000000      color
7 = 0.4           alpha

######### calendar function ##################################################

then to use it, you activate the calendar function BELOW TEXT like this

${lua luacal {settings}}

#${lua luacal {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gh=,gt=,gv=,sd=}}
#    x=x position top left
#    y=y position top left
#    tf=title font, eg "mono" must be in quotes
#    tfs=title font size
#    tc=title color
#    ta=title alpha
#    bf=body font, eg "mono" must be in quotes
#    bfs=body font size
#    bc=body color
#    ba=body alpha
#    hf=highlight font, eg "mono" must be in quotes
#    hfs=highlight font size
#    hc=highlight color
#    ha=highlight alpha
#    sp=spacer, eg " " or sp="0"... 0,1 or 2 spaces can help with positioning of non-monospaced fonts

#    gt=gap from title to body
#    gh=gap horizontal between columns
#    gv=gap vertical between rows
#    sd=start day, 0=Sun, 1=Mon

#    hstyle = heading style, 0=just days, 1=date insert
#    tdf=title date font, eg "mono" must be in quotes
#    tdfs=title date font size
#    tdc=title date color
#    tda=title date alpha

# test line
-- ${lua luacal {x=10,y=100,tf="Purisa",tfs=24,tc=0xf67e16,ta=1,bf="First Order",bfs=26,bc=0xecd32a,ba=1,hf="Purisa",hfs=18,hc=0xf67e16,ha=1,sp=" ",gh=40,gt=25,gv=20,sd=0,hstyle=1,tdf="First Order",tdfs=28,tdc=0xff0000,tda=1}}
]]

require 'cairo'
local    cs, cr = nil
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function conky_draw_bg(r,x,y,w,h,color,alpha)
if conky_window == nil then return end
if cs == nil then cairo_surface_destroy(cs) end
if cr == nil then cairo_destroy(cr) end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
w=w
h=h
if w=="0" then w=tonumber(conky_window.width) end
if h=="0" then h=tonumber(conky_window.height) end
cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
--top left mid circle
local xtl=x+r
local ytl=y+r
--top right mid circle
local xtr=(x+r)+((w)-(2*r))
local ytr=y+r
--bottom right mid circle
local xbr=(x+r)+((w)-(2*r))
local ybr=(y+r)+((h)-(2*r))
--bottom right mid circle
local xbl=(x+r)
local ybl=(y+r)+((h)-(2*r))
-----------------------------
cairo_move_to (cr,xtl,ytl-r)
cairo_line_to (cr,xtr,ytr-r)
cairo_arc(cr,xtr,ytr,r,((2*math.pi/4)*3),((2*math.pi/4)*4))
cairo_line_to (cr,xbr+r,ybr)
cairo_arc(cr,xbr,ybr,r,((2*math.pi/4)*4),((2*math.pi/4)*1))
cairo_line_to (cr,xbl,ybl+r)
cairo_arc(cr,xbl,ybl,r,((2*math.pi/4)*1),((2*math.pi/4)*2))
cairo_line_to (cr,xtl-r,ytl)
cairo_arc(cr,xtl,ytl,r,((2*math.pi/4)*2),((2*math.pi/4)*3))
cairo_close_path(cr)
cairo_fill (cr)
------------------------------------------------------------
cairo_surface_destroy(cs)
cairo_destroy(cr)
return ""
end
-- ###### calendar function ##################################################
function conky_luacal(caltab) -- {x=,y=,tf="",tfs=,tc=,ta=,bf="",bfs=,bc=,ba=,hf="",hfs=,hc=,ha=,sp="",gt=,gh=,gv=,sd=,hstyle=,tdf=,tdfs=,tdc=,tda=}
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
local cr = cairo_create(cs)
--############################################################################
if caltab.x==nil then
caltab=loadstring("return" .. caltab)()
end
local cal_x=caltab.x
local cal_y=caltab.y
local tfont=caltab.tf        or "mono"
local tfontsize=caltab.tfs    or 12
local tc=caltab.tc        or 0xffffff
local ta=caltab.ta        or 1
local bfont=caltab.bf        or "mono"
local bfontsize=caltab.bfs    or 12
local bc=caltab.bc        or 0xffffff
local ba=caltab.ba        or 1
local hfont=caltab.hf        or "mono"
local hfontsize=caltab.hfs    or 12
local hc=caltab.hc        or 0xff0000
local ha=caltab.ha        or 1
local spacer=caltab.sp        or " "
local gaph=caltab.gh        or 20
local gapt=caltab.gt        or 15
local gapl=caltab.gv        or 15
local sday=caltab.sd        or 0
local hstyle=caltab.hstyle    or 0
--convert colors
--local font=string.gsub(font,"_"," ")
local tred,tgreen,tblue,talpha=rgb_to_r_g_b(tc,ta)
--main body text color
local bred,bgreen,bblue,balpha=rgb_to_r_g_b(bc,ba)
--highlight text color
local hred,hgreen,hblue,halpha=rgb_to_r_g_b(hc,ha)
--############################################################################
--calendar calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time( {    year=year,month=03,day=01,hour=00,min=0,sec=0} );
local t2 = os.time( {    year=year,month=02,day=01,hour=00,min=0,sec=0} );
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={ 31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local day=tonumber(os.date("%w"))+1-sday
local day_num = today
local remainder=day_num % 7
local start_day=day-(day_num % 7)
if start_day<0 then start_day=7+start_day end
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
local x=mdays+start_day
local dnum={}
local dnumh={}
if mdays+start_day<36 then
dlen=35
plen=29
else
dlen=42
plen=36
end
for i=1,dlen do
    if i<=start_day then
    dnum[i]="  "
    else
    dn=i-start_day
        if dn=="nil" then dn=0 end
        if dn<=9 then dn=(spacer .. dn) end
        if i>x then dn="" end
        dnum[i]=dn
        dnumh[i]=dn
        if dn==(spacer .. today) or dn==today then
        dnum[i]=""
        end
        if dn==(spacer .. today) or dn==today then
        dnumh[i]=dn
        place=i
        else dnumh[i]="  "
        end
    end
end--for
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
if hstyle==0 then
    if tonumber(sday)==0 then
    dys={"SU","MO","TU","WE","TH","FR","SA"}
    else
    dys={"MO","TU","WE","TH","FR","SA","SU"}
    end
    --draw calendar titles
elseif hstyle==1 then
    if tonumber(sday)==0 then
    dys={"SU","MO"," ","  ","  ","FR","SA"}
    cairo_text_extents(cr,"MO",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    else
    dys={"MO","TU"," ","  ","  ","SA","SU"}
    cairo_text_extents(cr,"TU",extents)
    local s=extents.x_advance+gaph
    local f=gaph*5
    local tdfont=caltab.tdf        or "mono"
    local tdfontsize=caltab.tdfs    or 12
    local tdc=caltab.tdc        or 0xffffff
    local tda=caltab.tda        or 1
    cairo_select_font_face (cr, tdfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
    cairo_set_font_size (cr, tdfontsize);
    local tdred,tdgreen,tdblue,tdalpha=rgb_to_r_g_b(tdc,tda)
    cairo_set_source_rgba (cr,tdred,tdgreen,tdblue,tdalpha)
    local insert=os.date("%b %y")
    cairo_text_extents(cr,insert,extents)
    local w=extents.x_advance
    cairo_move_to (cr, cal_x+((s+f)/2)-(w/2), cal_y)
    cairo_show_text (cr,insert)
    cairo_stroke (cr)
    end
end
--draw calendar titles
for i=1,7 do
cairo_select_font_face (cr, tfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, tfontsize);
cairo_set_source_rgba (cr,tred,tgreen,tblue,talpha)
cairo_move_to (cr, cal_x+(gaph*(i-1)), cal_y)
cairo_show_text (cr, dys[i])
cairo_stroke (cr)
end
--draw calendar body
cairo_select_font_face (cr, bfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, bfontsize);
cairo_set_source_rgba (cr,bred,bgreen,bblue,balpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnum[i])
    cairo_stroke (cr)
    end
end
--highlight
cairo_select_font_face (cr, hfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, hfontsize);
cairo_set_source_rgba (cr,hred,hgreen,hblue,halpha)
for i=1,plen,7 do
local fn=i
    for i=fn,fn+6 do
    cairo_move_to (cr, cal_x+(gaph*(i-fn)),cal_y+gapt+(gapl*((fn-1)/7)))
    cairo_show_text (cr, dnumh[i])
    cairo_stroke (cr)
    end
end
--############################################################################
caltab=nil
dlen=nil
plen=nil
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end-- end main function#######################################################

Offline

#4334 2012-12-13 18:05:23

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

Re: Conky v1.9 Thread

the problem is the rgb_to_r_g_b function
the calendar and the bg script are using 2 different versions

try this
in the mayan calendar script do a search and replace

replace every instance of

rgb_to_r_g_b

with

rgb_to_r_g_b_cal

Offline

#4335 2012-12-13 18:23:32

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

Re: Conky v1.9 Thread

have some code
Screenshot_at_2012_12_13_12_19_23.jpg

--chronograph mrpeachy 12/13/12 - i blame sector11 for starting the whole chronograph thing!
require 'cairo'
extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
function conky_main()
if conky_window == nil then return end
local updates=tonumber(conky_parse("${updates}"))
if updates<=3 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)
--#########################################################################################################
--defaults
default_font_name="White Rabbit"
default_font_size=22
default_font_face="n"
default_hex_color=0xffffff
default_alpha=1
default_red=1
default_green=1
default_blue=1
default_horizontal_justify="l"	--"l"=left, "r"=right, "c"=center
default_vertical_justify="n" 	--"n"=normal, "nb"=normal-ybearing, "m"=middle, "mb"=middle-ybearing, "t"=top
default_rotation="0"
--font({f="name",fs=size,ff="face"}) face="n" or "b" or "i" or "bi"
--hexcolor({c=hexcolor,a=alpha})
--rgbcolor({r=,g=,b=,a=})
--text({x=x,y=y,t="text",hj=horizontal_justify,vj=vertical_justify,r=rotation})
--set center coordinates
centx,centy=200,200
--########################################################################################
--background circle
hexcolor({c=0x212121})
cairo_arc(cr,centx,centy,118,0,2*math.pi)
cairo_fill(cr)
--background circle
hexcolor({c=0x3c3c3c})
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_fill(cr)
--setup font and color
font({})
hexcolor({c=0xccaa7a})
--draw numbers and dots around main circle
for i=1,12 do
	if i==12 or i==4 or i==8 then
	x,y=pt(centx,centy,84,((360/12)*i))	
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
	if i==2 or i==6 or i==10 then
	hexcolor({c=0xdac09b})
	x,y=pt(centx,centy,98,((360/12)*i))
	cairo_arc(cr,x,y,6,0,2*math.pi)
	cairo_fill(cr)
	else
	hexcolor({c=0xccaa7a})
	x,y=pt(centx,centy,98,((360/12)*i))
	cairo_arc(cr,x,y,4,0,2*math.pi)
	cairo_fill(cr)
	end
end--for
--draw inbetween marks
cairo_set_line_width(cr,1)
for i=1,60 do
	if string.find(i/5,"%.")~=nil then
	x,y=pt(centx,centy,108,((360/60)*i))
	cairo_move_to(cr,x,y)
	x,y=pt(centx,centy,98,((360/60)*i))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
	end
end--for
--outer circle
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_stroke(cr)
--########################################################################################
--hours of day at 2 position
dcx,dcy=pt(centx,centy,98,60)
font({fs=8})
--numbers
for i=0,24,3 do
x,y=pt(dcx,dcy,68,180+((120/24)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--marks
for i=0,24 do
	if string.find(i/3,"%.")~=nil and i~=0 then
	x,y=pt(dcx,dcy,60,180+((120/24)*i))
	cairo_move_to(cr,x,y)
	x,y=pt(dcx,dcy,56,180+((120/24)*i))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
	else
	x,y=pt(dcx,dcy,58,180+((120/24)*i))
	cairo_arc(cr,x,y,1.5,0,2*math.pi)
	cairo_fill(cr)
	end
end
--day name
font({fs=22})
dtx,dty=pt(dcx,dcy,30,180+60)
text({x=dtx,y=dty,t=string.upper(os.date("%a")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xdac09b})
hour=tonumber(os.date("%H"))
dpx,dpy=pt(dcx,dcy,54,180+(120*(hour/24)))
cairo_move_to(cr,dcx,dcy)
cairo_line_to(cr,dpx,dpy)
cairo_stroke(cr)
--########################################################################################
--days of month at 6 position
font({fs=8})
hexcolor({c=0xccaa7a})
cairo_set_line_width(cr,1)
mcx,mcy=pt(centx,centy,98,180)
--date calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time({year=year,month=03,day=01,hour=00,min=0,sec=0});
local t2 = os.time({year=year,month=02,day=01,hour=00,min=0,sec=0});
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={31,feb,31,30,31,30,31,31,30,31,30,31} 
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
--marks
for i=1,mdays do
	if string.find((i-1)/3,"%.")~=nil then
	x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
	cairo_move_to(cr,x,y)
	x,y=pt(mcx,mcy,56,300+((120/mdays)*i))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
	else
	x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
	cairo_move_to(cr,x,y)
	x,y=pt(mcx,mcy,54,300+((120/mdays)*i))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
	end
end--for
--numbers
for i=1,mdays,3 do
x,y=pt(mcx,mcy,68,300+((120/mdays)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--month name
font({fs=22})
text({x=mcx,y=mcy-30,t=string.upper(os.date("%b")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xdac09b})
day=tonumber(os.date("%e"))
mpx,mpy=pt(mcx,mcy,52,300+(120*(day/mdays)))
cairo_move_to(cr,mcx,mcy)
cairo_line_to(cr,mpx,mpy)
cairo_stroke(cr)
--########################################################################################
--months of year at 10 position
font({fs=8})
hexcolor({c=0xccaa7a})
cairo_set_line_width(cr,1)
ycx,ycy=pt(centx,centy,98,5*60)
--date calculations
td=0
for i=1,12 do
td=td+monthdays[i]
end
angle={}
ang=0
for i=1,12 do
ang=((monthdays[i]/td)*120)+ang
angle[i]=ang
end
months={"J","F","M","A","M","J","J","A","S","O","N","D"}
--arc line
cairo_arc(cr,ycx,ycy,60,adeg(60),adeg(60+ang))
cairo_stroke(cr)
--arc marks
for i=0,12 do
	x,y=pt(ycx,ycy,60,60+((angle[i] or 0)))
	cairo_move_to(cr,x,y)
	x,y=pt(ycx,ycy,56,60+((angle[i] or 0)))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
end
--month letters
for i=1,12 do
x,y=pt(ycx,ycy,68,60+((120/12)*i)-(120/24))
text({y=y,x=x,t=months[i],hj="c",vj="m"})
end--for
--year text
font({fs=22})
ytx,yty=pt(ycx,ycy,30,60+60)
text({x=ytx,y=yty,t=string.upper(os.date("%y")),hj="c",vj="m"})
font({fs=12})
text({x=ytx-4,y=yty-10,t="20",hj="c",vj="n"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xdac09b})
today=tonumber(os.date("%j"))-1
ypx,ypy=pt(ycx,ycy,55,60+(120*(today/td)))
cairo_move_to(cr,ycx,ycy)
cairo_line_to(cr,ypx,ypy)
cairo_stroke(cr)
--center circle
hexcolor({c=0xdac09b,a=1})
cairo_arc(cr,centx,centy,5,0,2*math.pi)
cairo_stroke(cr)
--hand calculations #######################################################
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*12))
--call hand drawing function
--hexcolor({c=0xccaa7a,a=0.8})
hexcolor({c=0xdac09b,a=0.8})
cairo_set_line_width(cr,2)
hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs,--string or value for hand degrees
70,--string or value for hand length (radius)
3,--set hand center width in pixels
10,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs+180,--string or value for hand degrees
30,--string or value for hand length (radius)
6,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--MINUTES HAND
--hexcolor({c=0xdac09b,a=0.8})
hands(
200,--string or coodinate for clock center x
200,--string or coodinate for clock center y
360*((m_to_s+seconds)/(60*60)),--string or value for hand degrees
90,--string or value for hand length (radius)
3,--set hand center width in pixels
8,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
200,--string or coodinate for clock center x
200,--string or coodinate for clock center y
180+(360*((m_to_s+seconds)/(60*60))),--string or value for hand degrees
30,--string or value for hand length (radius)
4,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--#########################################################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function

--this function draws hands
function hands(clock_centerx,clock_centery,degrees,length,hand_center_width,hand_mid_width,hand_end_width,distance_to_mid)
--draw_middle
--calc start point
xs,ys=pt(clock_centerx,clock_centery,hand_center_width,degrees-90)
cairo_move_to(cr,xs,ys)
x1,y1=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees-(hand_mid_width/2))
cairo_line_to (cr,x1,y1)
x2,y2=pt(clock_centerx,clock_centery,length,degrees)
cairo_arc(cr,x2,y2,hand_end_width,(degrees+180)*(math.pi/180),(degrees)*(math.pi/180))
--cairo_line_to (cr,x2,y2)
x3,y3=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees+(hand_mid_width/2))
cairo_line_to (cr,x3,y3)
--calc end point
xe,ye=pt(clock_centerx,clock_centery,hand_center_width,degrees+90)
cairo_line_to (cr,xe,ye)
cairo_arc(cr,clock_centerx,clock_centery,hand_center_width,(degrees)*(math.pi/180),(degrees+180)*(math.pi/180))
cairo_fill(cr)
end

function adeg(deg)
return(math.pi/180)*(deg-90)
end

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

function font(fontt)
local name=fontt.f	or default_font_name	or "mono"
local size=fontt.fs	or default_font_size	or 12
local face=fontt.ff	or default_font_face	or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end

function hexcolor(hexcolort)
local col=hexcolort.c	or default_hex_color	or 0xffffff
local a=hexcolort.a	or default_alpha	or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end

function rgbcolor(rgbcolort)
local r=rgbcolort.r		or default_red			or 1
local g=rgbcolort.g		or default_green		or 1
local b=rgbcolort.b		or default_blue			or 1
local a=rgbcolort.a		or default_alpha		or 1
cairo_set_source_rgba(cr,r,g,b,a)
end

function text(textt)
local x=textt.x 		or 100
local y=textt.y 		or 100
local t=textt.t 		or "set txt"
local hj=textt.hj 		or default_horizontal_justify		or "l"
local vj=textt.vj 		or default_vertical_justify		or "n"
local r=textt.r			or default_rotation			or 0
cairo_text_extents(cr,t,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
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text ###################################################################

Offline

#4336 2012-12-14 00:03:30

ansem_of_nexus
#! CrunchBanger
Registered: 2012-09-19
Posts: 234

Re: Conky v1.9 Thread

So here is my latest conky. I made this as a joke. So for all of my fellow conky addicts I thought if you were going experiment on new designs that you might want the right equipment to work with as a reference.

2012_12_13_1355442970_611x610_scrot.jpg

Last edited by ansem_of_nexus (2012-12-14 00:04:18)


You can find my work here

Make everything ok button

Offline

#4337 2012-12-14 00:26:35

VastOne
#! Ranger
From: V-Ger
Registered: 2011-04-26
Posts: 10,165
Website

Re: Conky v1.9 Thread

^ Wow ansem, that is freaking awesome!

Nice job!   cool


VSIDO | Words That Build Or Destroy

I dev VSIDO

Offline

#4338 2012-12-14 00:29:35

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: Conky v1.9 Thread

Sector11 wrote:
lwfitz wrote:

Love that second wallpaper! Fantastic job as usual buddy

The wall paper by itself isn't much ... I should have made ALL the text by conky.

http://t.imgbox.com/adtlYeBP.jpg monkey
And the conky is a simple use of K's apps:

TEXT

${font bitwise:size=25}${alignc}${voffset 490}${color0}in ${exec /media/5/Conky/scripts/conkyDateDiff.py 20121221}${color}
${goto 245}${voffset 15}${color2}${exec /media/5/Conky/scripts/conkyDaysDiff.py 20121221}${color}
${goto 135}${voffset 34}${color2}${exec /media/5/Conky/scripts/conkyDaysDiff.py 20121222}${color7} days!

maybe I'll do that  ... then on 22 Dec I make one that says The Mayan's were wrong!  big_smile


THATS A GREAT IDEA! I hope Im here to see it  big_smile

The wallpaper is kinda what Ive been looking for......... sort of an earth exploding/burning theme

Offline

#4339 2012-12-14 00:31:17

lwfitz
#! Die Hard
From: Monrovia, CA
Registered: 2012-01-19
Posts: 886
Website

Re: Conky v1.9 Thread

Sector11 wrote:
lwfitz wrote:

Beautiful ... share the code????


Absolutely I will. Hoping to finish it up tonight so Ill get it posted tonight or tomorrow morning.

Offline

#4340 2012-12-14 08:46:52

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

Re: Conky v1.9 Thread

In the same idea you can use this screensaver with xplanetFX if you have enough ram and cpu...
xplode
What a scorcher !  cool

Last edited by ragamatrix (2012-12-14 08:50:44)

Offline

#4341 2012-12-14 09:54:34

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

Re: Conky v1.9 Thread

mrpeachy wrote:

the problem is the rgb_to_r_g_b function
the calendar and the bg script are using 2 different versions

try this
in the mayan calendar script do a search and replace

replace every instance of

rgb_to_r_g_b

with

rgb_to_r_g_b_cal

Thanks a lot Mr Peachy !
I made the change and it's working with draw_bg.
Maya_bg

Offline

#4342 2012-12-14 10:36:21

lionhead
#! Junkie
From: Dagobah / Germany
Registered: 2011-01-22
Posts: 459

Re: Conky v1.9 Thread

is it possible to display the current radar of germany (not the usa)?

i wish my screen resolution would be bigger smile

vZ290aA

Offline

#4343 2012-12-14 10:46:31

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

Re: Conky v1.9 Thread

mrpeachy wrote:

have some code
http://s10.postimage.org/pkmong3h1/Screenshot_at_2012_12_13_12_19_23.jpg

--chronograph mrpeachy 12/13/12 - i blame sector11 for starting the whole chronograph thing!
require 'cairo'
extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
function conky_main()
if conky_window == nil then return end
local updates=tonumber(conky_parse("${updates}"))
if updates<=3 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)
--#########################################################################################################
--defaults
default_font_name="White Rabbit"
default_font_size=22
default_font_face="n"
default_hex_color=0xffffff
default_alpha=1
default_red=1
default_green=1
default_blue=1
default_horizontal_justify="l"	--"l"=left, "r"=right, "c"=center
default_vertical_justify="n" 	--"n"=normal, "nb"=normal-ybearing, "m"=middle, "mb"=middle-ybearing, "t"=top
default_rotation="0"
--font({f="name",fs=size,ff="face"}) face="n" or "b" or "i" or "bi"
--hexcolor({c=hexcolor,a=alpha})
--rgbcolor({r=,g=,b=,a=})
--text({x=x,y=y,t="text",hj=horizontal_justify,vj=vertical_justify,r=rotation})
--set center coordinates
centx,centy=200,200
--########################################################################################
--background circle
hexcolor({c=0x212121})
cairo_arc(cr,centx,centy,118,0,2*math.pi)
cairo_fill(cr)
--background circle
hexcolor({c=0x3c3c3c})
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_fill(cr)
--setup font and color
font({})
hexcolor({c=0xccaa7a})
--draw numbers and dots around main circle
for i=1,12 do
	if i==12 or i==4 or i==8 then
	x,y=pt(centx,centy,84,((360/12)*i))	
	text({y=y,x=x,t=i,hj="c",vj="m"})
	end
	if i==2 or i==6 or i==10 then
	hexcolor({c=0xdac09b})
	x,y=pt(centx,centy,98,((360/12)*i))
	cairo_arc(cr,x,y,6,0,2*math.pi)
	cairo_fill(cr)
	else
	hexcolor({c=0xccaa7a})
	x,y=pt(centx,centy,98,((360/12)*i))
	cairo_arc(cr,x,y,4,0,2*math.pi)
	cairo_fill(cr)
	end
end--for
--draw inbetween marks
cairo_set_line_width(cr,1)
for i=1,60 do
	if string.find(i/5,"%.")~=nil then
	x,y=pt(centx,centy,108,((360/60)*i))
	cairo_move_to(cr,x,y)
	x,y=pt(centx,centy,98,((360/60)*i))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
	end
end--for
--outer circle
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_stroke(cr)
--########################################################################################
--hours of day at 2 position
dcx,dcy=pt(centx,centy,98,60)
font({fs=8})
--numbers
for i=0,24,3 do
x,y=pt(dcx,dcy,68,180+((120/24)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--marks
for i=0,24 do
	if string.find(i/3,"%.")~=nil and i~=0 then
	x,y=pt(dcx,dcy,60,180+((120/24)*i))
	cairo_move_to(cr,x,y)
	x,y=pt(dcx,dcy,56,180+((120/24)*i))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
	else
	x,y=pt(dcx,dcy,58,180+((120/24)*i))
	cairo_arc(cr,x,y,1.5,0,2*math.pi)
	cairo_fill(cr)
	end
end
--day name
font({fs=22})
dtx,dty=pt(dcx,dcy,30,180+60)
text({x=dtx,y=dty,t=string.upper(os.date("%a")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xdac09b})
hour=tonumber(os.date("%H"))
dpx,dpy=pt(dcx,dcy,54,180+(120*(hour/24)))
cairo_move_to(cr,dcx,dcy)
cairo_line_to(cr,dpx,dpy)
cairo_stroke(cr)
--########################################################################################
--days of month at 6 position
font({fs=8})
hexcolor({c=0xccaa7a})
cairo_set_line_width(cr,1)
mcx,mcy=pt(centx,centy,98,180)
--date calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time({year=year,month=03,day=01,hour=00,min=0,sec=0});
local t2 = os.time({year=year,month=02,day=01,hour=00,min=0,sec=0});
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={31,feb,31,30,31,30,31,31,30,31,30,31} 
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
--marks
for i=1,mdays do
	if string.find((i-1)/3,"%.")~=nil then
	x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
	cairo_move_to(cr,x,y)
	x,y=pt(mcx,mcy,56,300+((120/mdays)*i))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
	else
	x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
	cairo_move_to(cr,x,y)
	x,y=pt(mcx,mcy,54,300+((120/mdays)*i))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
	end
end--for
--numbers
for i=1,mdays,3 do
x,y=pt(mcx,mcy,68,300+((120/mdays)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--month name
font({fs=22})
text({x=mcx,y=mcy-30,t=string.upper(os.date("%b")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xdac09b})
day=tonumber(os.date("%e"))
mpx,mpy=pt(mcx,mcy,52,300+(120*(day/mdays)))
cairo_move_to(cr,mcx,mcy)
cairo_line_to(cr,mpx,mpy)
cairo_stroke(cr)
--########################################################################################
--months of year at 10 position
font({fs=8})
hexcolor({c=0xccaa7a})
cairo_set_line_width(cr,1)
ycx,ycy=pt(centx,centy,98,5*60)
--date calculations
td=0
for i=1,12 do
td=td+monthdays[i]
end
angle={}
ang=0
for i=1,12 do
ang=((monthdays[i]/td)*120)+ang
angle[i]=ang
end
months={"J","F","M","A","M","J","J","A","S","O","N","D"}
--arc line
cairo_arc(cr,ycx,ycy,60,adeg(60),adeg(60+ang))
cairo_stroke(cr)
--arc marks
for i=0,12 do
	x,y=pt(ycx,ycy,60,60+((angle[i] or 0)))
	cairo_move_to(cr,x,y)
	x,y=pt(ycx,ycy,56,60+((angle[i] or 0)))
	cairo_line_to(cr,x,y)
	cairo_stroke(cr)
end
--month letters
for i=1,12 do
x,y=pt(ycx,ycy,68,60+((120/12)*i)-(120/24))
text({y=y,x=x,t=months[i],hj="c",vj="m"})
end--for
--year text
font({fs=22})
ytx,yty=pt(ycx,ycy,30,60+60)
text({x=ytx,y=yty,t=string.upper(os.date("%y")),hj="c",vj="m"})
font({fs=12})
text({x=ytx-4,y=yty-10,t="20",hj="c",vj="n"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xdac09b})
today=tonumber(os.date("%j"))-1
ypx,ypy=pt(ycx,ycy,55,60+(120*(today/td)))
cairo_move_to(cr,ycx,ycy)
cairo_line_to(cr,ypx,ypy)
cairo_stroke(cr)
--center circle
hexcolor({c=0xdac09b,a=1})
cairo_arc(cr,centx,centy,5,0,2*math.pi)
cairo_stroke(cr)
--hand calculations #######################################################
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*12))
--call hand drawing function
--hexcolor({c=0xccaa7a,a=0.8})
hexcolor({c=0xdac09b,a=0.8})
cairo_set_line_width(cr,2)
hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs,--string or value for hand degrees
70,--string or value for hand length (radius)
3,--set hand center width in pixels
10,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs+180,--string or value for hand degrees
30,--string or value for hand length (radius)
6,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--MINUTES HAND
--hexcolor({c=0xdac09b,a=0.8})
hands(
200,--string or coodinate for clock center x
200,--string or coodinate for clock center y
360*((m_to_s+seconds)/(60*60)),--string or value for hand degrees
90,--string or value for hand length (radius)
3,--set hand center width in pixels
8,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
200,--string or coodinate for clock center x
200,--string or coodinate for clock center y
180+(360*((m_to_s+seconds)/(60*60))),--string or value for hand degrees
30,--string or value for hand length (radius)
4,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--#########################################################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function

--this function draws hands
function hands(clock_centerx,clock_centery,degrees,length,hand_center_width,hand_mid_width,hand_end_width,distance_to_mid)
--draw_middle
--calc start point
xs,ys=pt(clock_centerx,clock_centery,hand_center_width,degrees-90)
cairo_move_to(cr,xs,ys)
x1,y1=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees-(hand_mid_width/2))
cairo_line_to (cr,x1,y1)
x2,y2=pt(clock_centerx,clock_centery,length,degrees)
cairo_arc(cr,x2,y2,hand_end_width,(degrees+180)*(math.pi/180),(degrees)*(math.pi/180))
--cairo_line_to (cr,x2,y2)
x3,y3=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees+(hand_mid_width/2))
cairo_line_to (cr,x3,y3)
--calc end point
xe,ye=pt(clock_centerx,clock_centery,hand_center_width,degrees+90)
cairo_line_to (cr,xe,ye)
cairo_arc(cr,clock_centerx,clock_centery,hand_center_width,(degrees)*(math.pi/180),(degrees+180)*(math.pi/180))
cairo_fill(cr)
end

function adeg(deg)
return(math.pi/180)*(deg-90)
end

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

function font(fontt)
local name=fontt.f	or default_font_name	or "mono"
local size=fontt.fs	or default_font_size	or 12
local face=fontt.ff	or default_font_face	or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end

function hexcolor(hexcolort)
local col=hexcolort.c	or default_hex_color	or 0xffffff
local a=hexcolort.a	or default_alpha	or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end

function rgbcolor(rgbcolort)
local r=rgbcolort.r		or default_red			or 1
local g=rgbcolort.g		or default_green		or 1
local b=rgbcolort.b		or default_blue			or 1
local a=rgbcolort.a		or default_alpha		or 1
cairo_set_source_rgba(cr,r,g,b,a)
end

function text(textt)
local x=textt.x 		or 100
local y=textt.y 		or 100
local t=textt.t 		or "set txt"
local hj=textt.hj 		or default_horizontal_justify		or "l"
local vj=textt.vj 		or default_vertical_justify		or "n"
local r=textt.r			or default_rotation			or 0
cairo_text_extents(cr,t,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
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text ###################################################################

Thanks again for this code !
I called it Breitling.lua... big_smile

Offline

#4344 2012-12-14 10:52:33

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

Re: Conky v1.9 Thread

lionhead wrote:

is it possible to display the current radar of germany (not the usa)?

i wish my screen resolution would be bigger smile

http://ompldr.org/vZ290aA

Hi Lionhead;
I made an archive for a french conky wich display the radar EU. You can use this script to display EU mapsat in your conky.
here's:
image
PackConkyGWS_EU

Offline

#4345 2012-12-14 12:52:56

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,214
Website

Re: Conky v1.9 Thread

hahahahahahahaha:

--chronograph mrpeachy 12/13/12 - i blame sector11 for starting the whole chronograph thing!

Yea, right ... and I made the 4-clocks.lua too - the base for all this.  big_smile

Well OK, I graciously accept all blame involved IF you accept the accolades for the code ... all I did was change the layout.  And you even had to push me over the edge with a bit of code for the months and days that made me think.

Thanks for this new one mrpeachy ...


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#4346 2012-12-14 13:01:39

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,214
Website

Re: Conky v1.9 Thread

ansem_of_nexus wrote:

So here is my latest conky. I made this as a joke. So for all of my fellow conky addicts I thought if you were going experiment on new designs that you might want the right equipment to work with as a reference.

http://s5.postimage.org/hyevcobdf/2012_12_13_1355442970_611x610_scrot.jpg

WoW!  That's great ... that's the newest conky-ohmmeter right out of a 1940's Vincent Price movie

I like it ...   cool


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#4347 2012-12-14 13:29:00

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,214
Website

Re: Conky v1.9 Thread

lwfitz wrote:
Sector11 wrote:

maybe I'll do that  ... then on 22 Dec I make one that says The Mayan's were wrong!  big_smile


THATS A GREAT IDEA! I hope Im here to see it  big_smile

The wallpaper is kinda what Ive been looking for......... sort of an earth exploding/burning theme

Well I did it ... but didn't put it up as I turned the computer off because we were told there would be a power outage ... it never happened.  Since the 5th we've had 6 days with power outages ranging from 5 hours to three days solid.  Yeasterday they tell is it coming at 21:00 intil 09:00 or 10:00 this morning ... it never happened.  GRRRRRRRRRRRRRRRRRRRRRRRRRRR!

Gotta love that Mayan Rock|Clock|Calendar by mrprachy!

So anyway here's what I did:
abniQlS6.jpg

Soon the third and 4th lines will read:

That was x days ago!
Next coffee meet in 364 days on 21 Dec 2013

PS:  I had the same problem using draw-bk.lua with it, thanks for the fix mrpeachy.

How about this: Red Giant Earth 7 Billion years from now

acgD87WB.jpg


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#4348 2012-12-14 13:30:46

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,214
Website

Re: Conky v1.9 Thread

ragamatrix wrote:

In the same idea you can use this screensaver with xplanetFX if you have enough ram and cpu...
http://pix.toile-libre.org/upload/img/1355474687.png
What a scorcher !  cool

And I thought I was warm.   big_smile


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

#4349 2012-12-14 13:33:48

Sector11
Leonardo da Conci
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,214
Website

Re: Conky v1.9 Thread

lionhead wrote:

is it possible to display the current radar of germany (not the usa)?

i wish my screen resolution would be bigger smile

http://ompldr.org/vZ290aA

You will have to search for that at the weather site.


Q&As for Conky v1.9 & v1.10 | Conky Archives | All Conky Threads
.deb file editor | Debian Jessie: BunsenLabs subAlpha & Wally-jr
BL Forum Moderator | LinuxBBQ

Offline

Help fund CrunchBang, donate to the project!

#4350 2012-12-14 14:00:25

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

Re: Conky v1.9 Thread

Sector11 wrote:

Red Giant Earth 7 Billion years from now

We are going to "ConkyAstroPhysic"
Impressive and beautifull, I think I'll be too old to have a coffee at this time...

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.

Debian Logo