Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1501 Le 10/11/2012, à 18:54

ragamatrix

Re : [Conky] Alternative à weather.com (2)

tu auras peut-être besoin de cette police, n'hésites pas si tu as des questions.
font_monofur

Dernière modification par ragamatrix (Le 10/11/2012, à 18:54)

Hors ligne

#1502 Le 10/11/2012, à 19:01

Phyllinux

Re : [Conky] Alternative à weather.com (2)

ragamatrix a écrit :

tu auras peut-être besoin de cette police, n'hésites pas si tu as des questions.
font_monofur

J'aurai aussi besoin d'un fichier qui est appelé dans Chronograph_Wea_template.lua :
image({x=5,y=420,w=120,h=2,file="/home/climatix/.conky/conky37/LightSlateGrey_1.png"}) Le LightSlateGrey_1.png me fait défaut, même si je ne sais pas trop à quoi il sert pour le moment...


The ship is sinking normally...

Hors ligne

#1503 Le 10/11/2012, à 20:08

Phyllinux

Re : [Conky] Alternative à weather.com (2)

ragamatrix a écrit :
Phyllinux a écrit :
ragamatrix a écrit :

tu auras peut-être besoin de cette police, n'hésites pas si tu as des questions.
font_monofur

J'aurai aussi besoin d'un fichier qui est appelé dans Chronograph_Wea_template.lua :
image({x=5,y=420,w=120,h=2,file="/home/climatix/.conky/conky37/LightSlateGrey_1.png"}) Le LightSlateGrey_1.png me fait défaut, même si je ne sais pas trop à quoi il sert pour le moment...

OOupps !
Encore une boulette ! tu trouveras c'est le dossier images; on va y arriver lol
Conky_chrono_all

Je crois que tu as un peu de mal ce soir sad
Le lien est faux, car tu mets celui de ta propre machine, et non pas sur le serveur;


The ship is sinking normally...

Hors ligne

#1504 Le 10/11/2012, à 20:13

ragamatrix

Re : [Conky] Alternative à weather.com (2)

@Phyllinux
Toutes mes excuses je ne comprends pas ce qui s'est passé.
chronos_all
J' ai supprimé ce post.Tu as raison ce soir c'est pas la grande forme...J'espère que cette fois c'est bon Marseille est dans la place !!

Dernière modification par ragamatrix (Le 10/11/2012, à 20:18)

Hors ligne

#1505 Le 11/11/2012, à 18:11

Phyllinux

Re : [Conky] Alternative à weather.com (2)

@ ragamatrix :
Merci beaucoup pour les scripts.
Cela tourne, mais le résultat visuel n'est pas complètement correct. Les polices 'Digital' sont tronquées à l'affichage, ce qui rend un effet pas terrible.
Ex : Pour l'affichage des mois, vu que le haut des polices est tronqué, au lieu de voir affiché OCT, j'ai droit à ULI, et pareil pour les jours. Le haut des polices ne passe pas à l'écran.
De plus, j'ai des infos qui se chevauchent dans le cadran du bas. La T° ressentie est à moitié sous le Top utilisation de la RAM. Et là, je ne vois pas dans quel script il faut jouer pour faire varier l'affichage. En tous cas, ce n'est pas dans le conkyrc.
Mais c'est tout de même assez chouette, et laisse plein de possibilités de travail, pour peu que l'on comprenne bien comment sont appelés les différents affichages.
Petites questions annexes :
Pourquoi 2 scripts v9000.lua ?
Comment marche la traduction déclarée dans le fichier de configuration ?


The ship is sinking normally...

Hors ligne

#1506 Le 12/11/2012, à 10:25

ragamatrix

Re : [Conky] Alternative à weather.com (2)

@ Phyllinux
Salut !
Le script Chronograph existe sous plusieurs formes, j'ai navigué sur le forum Anglophone et j'ai utilisé un script modifié par "Mc Lovin" parce-que l'original ne me plaisait pas à cause de l'affichage des heures sur le cadran...
Tu dois avoir dans le dossier: "chronograph.lua" qui est le script original; que tu peux appeler dans conky. Ces scripts sont encore en modification, Sector11 test aussi les meteo-lua avec lequel il rencontre des erreurs...Je suis un peu embarrassé car je n'arrive pas à l' aider:/
Post 21053 (ça fait beaucoup smile)dépanage_meteo-lua

J'en reviens au Chronograph.lua original dans lequel les polices doivent tourner et ne pas se chevaucher, peut-être que tu n'as pas la police "Digital-7"(dans le Chronograph_min.lua) alors  dans ce script celle par default était "CorporateMonoExtraBold". C'est justement un des sujets de modification de ce script (affichage des chiffres dates 1 jour sur 2 pour que celui-ci soit plus lisible;2,4,6,8...etc)Tu peux faire des test avec les polices que tu souhaites.Digita-7(celle-ci me plaisait)"Mono"passe bien....

Dans le conky j'avais mis le Top mem et Top cpu (pour voir s'il y avait des fuites de ram ou cpu en excès) que tu peux commenter pour que cela soit plus lisible.
Il y a deux scripts v9000, l'original et v9002 qui a été modifié pour le chrono.(Je voulais les différencier mais tu peux l'appeler v9000)
Que veux-tu dire par "Comment marche la traduction déclarée dans le fichier de configuration ?" ?

Hors ligne

#1507 Le 12/11/2012, à 10:40

ragamatrix

Re : [Conky] Alternative à weather.com (2)

@Didier-T
Sector11 Meteo-lua test with draw-bg !
meteo-lua_draw-bg
Bug :
bug_test

Je voudrais aider Sector11 à résoudre son problème avec Meteo-Lua, mais je n'y arrive pas...Voudrais-tu nous aider ?
erreurs sector11:
conkyrc_meteo_lua :

 10 Nov 12 | 14:53:23 ~
         $ conky -c /media/5/conky/ragamatrix/conkyrc_meteo_lua &
[1] 7331

 10 Nov 12 | 14:53:48 ~
         $ Conky: can't parse X color 'lightwhite'
Conky: can't parse X color 'lightwhite'
Conky: forked to background, pid is 7336

Conky: desktop window (322) is root window
Conky: window type - desktop
Conky: drawing to created window (0x1800001)
Conky: drawing to double buffer
	version = v4.7
	web = http://www.accuweather.com/fr/ch/horgen/316407/current-weather/316407
	Pévision Nb jours = 2
	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 = 300
	Chemin de travail = /tmp
	Palier = 20
	Chemin de sauvegarde = /media/5/conky/ragamatrix/meteo
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value) 

Apparemment en modifiant les jours de prévisions dans meteo.cfg cela ne fonctionne pas non plus...

Dernière modification par ragamatrix (Le 12/11/2012, à 11:04)

Hors ligne

#1508 Le 12/11/2012, à 11:30

ragamatrix

Re : [Conky] Alternative à weather.com (2)

Modif Script Chronograph_min.lua pour avoir les dates un jour sur deux.

Ligne 184:

 -- CALCULATE CENTRE OF TEXT
local text=i
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle 

Par ligne 184:

 -- CALCULATE CENTRE OF TEXT
--only print even numbers
if math.mod(i, 2) == 0 then
--set text when even
text=string.format("%02d",i) --formats numbers to double digits
else
--set text when odd
text=""
end--odd even matching
local extents=cairo_text_extents_t:create()
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle 

1 sur 2

Dernière modification par ragamatrix (Le 12/11/2012, à 11:32)

Hors ligne

#1509 Le 12/11/2012, à 12:42

Didier-T

Re : [Conky] Alternative à weather.com (2)

ragamatrix a écrit :

@Didier-T
Sector11 Meteo-lua test with draw-bg !
meteo-lua_draw-bg
Bug :
bug_test

Je voudrais aider Sector11 à résoudre son problème avec Meteo-Lua, mais je n'y arrive pas...Voudrais-tu nous aider ?
erreurs sector11:
conkyrc_meteo_lua :

 10 Nov 12 | 14:53:23 ~
         $ conky -c /media/5/conky/ragamatrix/conkyrc_meteo_lua &
[1] 7331

 10 Nov 12 | 14:53:48 ~
         $ Conky: can't parse X color 'lightwhite'
Conky: can't parse X color 'lightwhite'
Conky: forked to background, pid is 7336

Conky: desktop window (322) is root window
Conky: window type - desktop
Conky: drawing to created window (0x1800001)
Conky: drawing to double buffer
	version = v4.7
	web = http://www.accuweather.com/fr/ch/horgen/316407/current-weather/316407
	Pévision Nb jours = 2
	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 = 300
	Chemin de travail = /tmp
	Palier = 20
	Chemin de sauvegarde = /media/5/conky/ragamatrix/meteo
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value) 

Apparemment en modifiant les jours de prévisions dans meteo.cfg cela ne fonctionne pas non plus...

tu pourait lui demander le contenu de son script conky.
j'ai l'impression qu'il ne fait pas de mise a jour en ligne.

Hors ligne

#1510 Le 12/11/2012, à 13:16

ragamatrix

Re : [Conky] Alternative à weather.com (2)

Pour l'intant je n'ai que son meteo.cfg; il a choisi de rajouter un chemin temporaire vers "cache" ?
meteo.cfg:

 # Créé par jpdipsy (forum.ubuntu-fr.org)

#Répertoire de sauvegarde
repsauv=/media/5/conky/ragamatrix/meteo

#Répertoire temporaire
TempShell=/media/5/conky/ragamatrix/cache

#Copier votre adresse Accuweather ici
#web=http://www.accuweather.com/fr/ch/horgen/316407/current-weather/316407
web=http://www.accuweather.com/fr/ar/buenos-aires/7894/current-weather/7894

#Prévision sur n jour (de 1 à 15) moyenne pour la journée
periode=2

#Prévision infos sur la matinée (oui, non)
matinée=oui

#Prévision infos sur la Après Midi (oui, non)
am=oui

#Prévision infos sur la Soirée (oui, non)
soiree=oui

#Prévision infos sur la Nuit (oui, non)
nuit=oui

#Prévision à 8 Heures
Prev8heures=oui

#Palier changement de couleur rose des vents (Km/h)
Palier=20

#Temps entre les mises à jour prévision (secondes)
update=300 

Hors ligne

#1511 Le 12/11/2012, à 13:33

Sector11

Re : [Conky] Alternative à weather.com (2)

Didier-T a écrit :

tu pourait lui demander le contenu de son script conky.
j'ai l'impression qu'il ne fait pas de mise a jour en ligne.

Bonjour Didier-T

Today it works.  I think it was a cache problem.
I still use:

#Répertoire temporaire
TempShell=/media/5/conky/ragamatrix/cache

acwzrBWV.jpg
très agréable

This I love!
adqqVx2o.jpg

	lua_load /media/5/conky/ragamatrix/script/meteo.lua
	lua_load /media/5/conky/ragamatrix/script/images_meteo.lua
	lua_startup_hook init /media/5/conky/ragamatrix/script/meteo.cfg
lua_load /media/5/Conky/LUA/draw-bg.lua
TEXT
${lua conky_draw_bg 0 40 40 100 100 0x000000 0.5}\
${lua conky_draw_bg 80 210 10 160 160 0x000000 0.5}\
${lua conky_draw_bg 80 420 15 160 160 0x000000 0.5}\
#### Lancement du script récupérant les données météo
#${template1 Maj}
#${template1 horsligne}
#${voffset 115}${goto 475}${color DeepSkyBlue}Nuit${goto 510}${color firebrick3}Jour
${template1 Maj}${lua Images_MAJ /media/5/conky/ragamatrix/script/images_meteo.cfg}
##Affichage Vent##
${template4 Rose -5,0 180x180 100}
##Affichage Baro##
${template4 Barometre 200,0 180x180 100}
##Affichage thermorond##
${template4 ThermoRond 400,-10 210x210 1 100 -a=Jour_Temp-1 -b=Nuit_Temp-1}
${template2 IconeM /media/5/conky/ragamatrix/meteo/icones 260,120 66x40}
${voffset -220}

draw-bg-lua

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

Dernière modification par Sector11 (Le 12/11/2012, à 13:56)

Hors ligne

#1512 Le 12/11/2012, à 14:26

ragamatrix

Re : [Conky] Alternative à weather.com (2)

@Todos
Je vous fais passer celui-ci avec les images modifiées (trois quadrants ronds)
-->ConkyGraphBaro

Hors ligne

#1513 Le 12/11/2012, à 14:42

ragamatrix

Re : [Conky] Alternative à weather.com (2)

Didier-T a écrit :
ragamatrix a écrit :

@Didier-T
Sector11 Meteo-lua test with draw-bg !
meteo-lua_draw-bg
Bug :
bug_test

Je voudrais aider Sector11 à résoudre son problème avec Meteo-Lua, mais je n'y arrive pas...Voudrais-tu nous aider ?
erreurs sector11:
conkyrc_meteo_lua :

 10 Nov 12 | 14:53:23 ~
         $ conky -c /media/5/conky/ragamatrix/conkyrc_meteo_lua &
[1] 7331

 10 Nov 12 | 14:53:48 ~
         $ Conky: can't parse X color 'lightwhite'
Conky: can't parse X color 'lightwhite'
Conky: forked to background, pid is 7336

Conky: desktop window (322) is root window
Conky: window type - desktop
Conky: drawing to created window (0x1800001)
Conky: drawing to double buffer
	version = v4.7
	web = http://www.accuweather.com/fr/ch/horgen/316407/current-weather/316407
	Pévision Nb jours = 2
	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 = 300
	Chemin de travail = /tmp
	Palier = 20
	Chemin de sauvegarde = /media/5/conky/ragamatrix/meteo
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: failed to parse compare string '<10'
Conky: compare failed for expression '<10'
Conky: llua_do_call: function conky_Meteo_AM_ProbPrec execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1796: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1468: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1555: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1488: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value)
Conky: llua_do_call: function conky_Meteo_Jour execution failed: /media/5/conky/ragamatrix/script/meteo.lua:1619: attempt to index field '?' (a nil value) 

Apparemment en modifiant les jours de prévisions dans meteo.cfg cela ne fonctionne pas non plus...

tu pourait lui demander le contenu de son script conky.
j'ai l'impression qu'il ne fait pas de mise a jour en ligne.

Quelqu'un a vu passer Sector11...........Je crois qu'il a passé le mur du son........Too fast !! lol

Hors ligne

#1514 Le 12/11/2012, à 17:00

Sector11

Re : [Conky] Alternative à weather.com (2)

Didier-T - They have a new home on my Desktop 3, thank you!
abbF7MgL.jpg

I share this with you from my Desktop 1:
adjLhBMx.jpg

S11_Chronograph_Full_2.conky

# killall conky && conky -c /media/5/Conky/S11_Chronograph_Full_2.conky &
#
# Thank you:
# Chronograph LUA - mrpeachy (originally 4 clocks - tweaked by Sector11)
# v9000 LUA weather - mrpeachy
# background - londonali1010, mrpeachy, dk75
# mounted.lua - mrpeachy

###  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_colour gray
own_window_class Conky
own_window_title Chronograph Full 2

# 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

minimum_size 340 900  ##420 420   ## width, height
maximum_width 340     ##420       ## width, usually a good idea to equal minimum width

gap_x 10 #15        ### left &right
gap_y 10        ### up & down

alignment tl #ml
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
#xftfont CorporateMonoExtraBold:size=9
xftfont monofur:bold:size=9
# X font when Xft is disabled, you can pick one with program xfontsel
#font 5x7
#font 6x10
#font 7x13
#font 8x13
#font 9x15
#font *mintsmild.se*
#font -*-*-*-*-*-*-34-*-*-*-*-*-*-*

# 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 no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

default_color DCDCDC #220 220 220	Gainsboro
color0 8FBC8F #143 188 143	DarkSeaGreen
color1 C2CCFF # Not a clue - a blue #778899 #119 136 153	LightSlateGray
color2 FF8C00 #255 140   0	DarkOrange
color3 7FFF00 #127 255   0	Chartreuse
color4 FFA07A #255 160 122	LightSalmon
color5 FFDEAD #255 222 173	NavajoWhite
color6 00BFFF #  0 191 255	DeepSkyBlue
color7 00FFFF #  0 255 255	Cyan
color8 FFFF00 #255 255   0	Yellow
color9 B22222 #178  34  34	FireBrick
#####################################################  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 #no
#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 using 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 256

# 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

# If enabled, values which are in bytes will be printed in human readable
# format (i.e., KiB, MiB, etc). If disabled, bytes is printed instead
format_human_readable yes

# Shortens units to a single character (kiB->k, GiB->G, etc.). Default is off.
short_units yes

#   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

##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## draw-bg.lua - Above and After TEXT - requires a composite manager.
##
 lua_load /media/5/Conky/LUA/draw-bg.lua
#TEXT
# ${lua conky_draw_bg 125 0 0 0 0 0x000000 0.3}
#
# ----------------------------------------------------------------------------
## OR Both above TEXT - No composite manager required.
#
#lua_load /media/5/Conky/LUA/draw-bg.lua
#lua_draw_hook_pre draw_bg 20 0 0 0 0 0x000000 0.3
#
# TEXT
################### Chronograph ##############################################
lua_load /media/5/Conky/LUA/Chronograph_full.lua
lua_draw_hook_post main

################### Weather ##################################################
lua_load ~/v9000/v9000.lua
lua_draw_hook_pre weather
lua_load /media/5/Conky/LUA/crono_full_2.template.lua

### mount.lua ##################################################################
#
##instructions
##load script
##lua_load ~/path_to/mounted.lua
lua_load /media/5/Conky/LUA/mounted.lua
## first lua command below text:
## ${lua get_mounted_data interval}, where interval is a number.  This starts data gathering
## to get output:
## ${lua mount partition_number data_type}, where partition number is a number
## data_type can be
## total - shows total number of partitions mounted, requires a partition_number also, use 1, could be used in an if_match
## fsys - shows filesystem
## size - shows space used in appropriate units
## free - shows free space in appropriate units
## use% - shows % used
## mount - shows mountpoint
#######################################################  End LUA Settings  ###
# The all important - How often conky refreshes.
# If you have a "Crey" try: 0.2 - smokin' - but watch the CPU useage go UP!
update_interval 1

TEXT
${lua get_mounted_data 3}${lua conky_draw_bg 12 0 0 0 0 0x000000 0.5}
${lua conky_draw_bg 175 0 0 350 350 0x000000 0.3}
${lua conky_draw_bg 60 115 35 120 120 0x000000 0.3}
${lua conky_draw_bg 55 40 120 110 110 0x000000 0.3}
${lua conky_draw_bg 55 205 122 110 110 0x000000 0.3}
${lua conky_draw_bg 60 115 200 120 120 0x000000 0.3}
















































 ${color}${hr 3}
${alignc}${color3}Hosted by: ${color}${nodename} ${color3}for the past: ${color}${uptime_short}
${alignc}${color3}Kernel: ${color}${kernel}
${alignc}${color3}CPU Usage  ${color7}1: ${color}${if_match ${cpu cpu1} < 10}  ${cpu cpu1}\
${else}${if_match ${cpu cpu1} < 100} ${cpu cpu1}\
${else}${cpu cpu1}\
${endif}${endif} %\
  ${color7}2: ${color}${if_match ${cpu cpu2} < 10}  ${cpu cpu2}\
${else}${if_match ${cpu cpu2} < 100}0${cpu cpu2}\
${else}${cpu cpu2}\
${endif}${endif} %\
  ${color7}3: ${color}${if_match ${cpu cpu3} < 10}  ${cpu cpu3}\
${else}${if_match ${cpu cpu3} < 100} ${cpu cpu3}\
${else}${cpu cpu3}\
${endif}${endif} %\
  ${color7}Avg: ${color}${if_match ${cpu cpu0} < 10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0} < 100} ${cpu cpu0}\
${else}${cpu cpu0}\
${endif}${endif} %
 ${color3}CPU: ${color}${platform f71882fg.2560 temp 1}°${goto 120}${color3}SDA: ${color}${execi 15 hddtemp -n /dev/sda}°${goto 222}${color3}GPU: ${color}${nvidia temp}° ${alignr 5}${color3}MB: ${color}${platform f71882fg.2560 temp 2}°
 ${color3}RAM:  ${color}${mem} ${color}/ ${color}${memmax}${alignr 5}${color3}Swap:  ${color}${swap} ${color}/ ${color}${swapmax}
 ${color3}SDA:  ${color7}Read:  ${color}${diskio_read /dev/sda}${goto 240}${color7}Write:  ${color}${diskio_write /dev/sda}
 ${color3}eth-0 ${color7}Down:  ${color}${downspeedf eth0}${goto 240}${color7}Up:  ${color}${upspeedf eth0}
 ${color1}${cpubar cpu9 1,116} ${color3}Exchange Rates${color1} ${cpubar cpu9 1}
 ${color1}1 CAD =${color7} ${execi 1800 wget --timeout=1.0 --tries=1 -O - http://themoneyconverter.com/rss-feed/CAD/rss.xml | grep "Argentine Peso" | cut -c 40-47} ${color1}ARS\
${alignr 5}1 ARS =${color7} ${execi 1800 wget --timeout=1.0 --tries=1 -O - http://themoneyconverter.com/rss-feed/ARS/rss.xml | grep "Canadian Dollar" | cut -c 39-45} ${color1}CAD${color}
 ${color}${hr 3}
 ${color6}FSYS${color} = ${lua mount 1 total}${goto 100}${color8}SIZE${goto 150}${color7}FREE${goto 200}${color1}USED${goto 260}${color}MOUNT
 ${color}${hr}
 ${color6}${lua mount 1 fsys 9}${goto 100}${color8}${lua mount 1 size}${goto 150}${color7}${lua mount 1 free}${goto 200}${color1}${lua mount 1 use%}${goto 260}${color}${lua mount 1 mount}
 ${color6}${lua mount 2 fsys 9}${goto 100}${color8}${lua mount 2 size}${goto 150}${color7}${lua mount 2 free}${goto 200}${color1}${lua mount 2 use%}${goto 260}${color}${lua mount 2 mount}
 ${color6}${lua mount 3 fsys 9}${goto 100}${color8}${lua mount 3 size}${goto 150}${color7}${lua mount 3 free}${goto 200}${color1}${lua mount 3 use%}${goto 260}${color}${lua mount 3 mount}
 ${color6}${lua mount 4 fsys 9}${goto 100}${color8}${lua mount 4 size}${goto 150}${color7}${lua mount 4 free}${goto 200}${color1}${lua mount 4 use%}${goto 260}${color}${lua mount 4 mount}
 ${color6}${lua mount 5 fsys 9}${goto 100}${color8}${lua mount 5 size}${goto 150}${color7}${lua mount 5 free}${goto 200}${color1}${lua mount 5 use%}${goto 260}${color}${lua mount 5 mount}
 ${color6}${lua mount 6 fsys 9}${goto 100}${color8}${lua mount 6 size}${goto 150}${color7}${lua mount 6 free}${goto 200}${color1}${lua mount 6 use%}${goto 260}${color}${lua mount 6 mount}
 ${color6}${lua mount 7 fsys 9}${goto 100}${color8}${lua mount 7 size}${goto 150}${color7}${lua mount 7 free}${goto 200}${color1}${lua mount 7 use%}${goto 260}${color}${lua mount 7 mount}
 ${color6}${lua mount 8 fsys 9}${goto 100}${color8}${lua mount 8 size}${goto 150}${color7}${lua mount 8 free}${goto 200}${color1}${lua mount 8 use%}${goto 260}${color}${lua mount 8 mount}

Chronograph_full.lua  12 Nov 2012 - memory leak plugged - mrpeachy

--[[ multiple analogue clocks by mrpeachy - 18 Jun 2012
 21 Jun 2012 - Chronograph modifications by Sector11
 22 Jun 2012 - again with mrpeachy's help day names, numbers and month names
 12 Nov 2012 - memory leak plugged - mrpeachy

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT


-- INDEX (use find with):

-- ###### 12 OR 24 CLOCK FACE
-- SET BORDER OPTIONS ######  ALL CLOCKS

-- ### START CLOCK A ######################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
-- CLOCK A HOUR HAND
-- CLOCK A MINUTE HAND SETUP
-- CLOCK A SECOND HAND SETUP
-- CLOCK A ###### 24 HR TIME

-- ### START DIAL B ### Top - Week Day Names Dial #########
-- ### START DIAL C ### Right - Month Names Dial ##########
-- ### START DIAL D ### Left - Day Numbers Dial ###########

-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
-- CLOCK E HOUR HAND
-- CLOCK E MINUTE HAND SETUP
-- CLOCK E SECOND HAND SETUP
-- CLOCK E ###### 12 HR TIME

NOTE:  Putting ### CLOCK A ### last insures that it's functions are written
       over the other dials.
]]

require 'cairo'

function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
-- ########################################################
-- SETTINGS AREA
-- local cpu=conky_parse("${cpu}")
-- local red-1=conky_parse("${image ~/Conky/images/red_1.png -p 0,0 -s 35x35}")

-- ###### 12 OR 24 CLOCK FACE #############################
local clock_type_A=24 -- Large Main 24 HR Clock
local clock_type_E=12 -- Bottom - 12 HR Clock

-- ###### CLOCK SETTINGS ##################################
-- SET BORDER OPTIONS FOR "CLOCKS" ########################
local clock_border_width=0
-- set color and alpha for clock border
local cbr,cbg,cbb,cba=1,1,1,1  -- full opaque white
-- gap from clock border to minute marks
local b_to_m=1

-- ########################################################
-- ### START DIAL B ### Top - Week Day Names Dial #########
-- DIAL POSITION FOR TEXT
local center_x=175
local center_y=95
local radius=50
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,1,1,1,1) --(cr,194/255,204/255,255/255,1)	-- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",}		-- English
--text_days={"Dom","Lun","Mar","Mie","Jue","Vie","Sab",}		-- Spanish
--text_days={"dim","lun","mar","mer","jeu","ven","sam",}		-- French
for i=1,7 do
-- work out points
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=35
for i=1,7 do
local point=(math.pi/180)*((360/7)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current day of week
local hand_length=30
local day_number=tonumber(os.date("%w"))
local point=(math.pi/180)*((360/7)*(day_number))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
local hand_width=2
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END DIAL B #########################################

-- ########################################################
-- ### START DIAL C ### Right - Month Names Dial ##########
-- DIAL POSITION FOR TEXT
local center_x=260
local center_y=175
local radius=45
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,1,1,1,1) --(cr,194/255,204/255,255/255,1)	-- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",}  -- English
--text_days={"Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic",} -- Spanish
--text_days={"jan","fév","mar","avr","mai","jui","jul","aôu","sep","oct","nov","déc",} -- French
for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=32
for i=1,12 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current month
local this_month=tonumber(os.date("%m"))
local hand_length=28 --radius for this calculation
local point=(math.pi/180)*((360/12)*(this_month-1))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)

-- ### END CLOCK C ########################################

-- ########################################################
-- ### START DIAL D ### Left - Day Numbers Dial ###########
-- GET NUMBER OF DAYS IN CURRENT MONTH
-- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
-- MONTH TABLE
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
-- TEXT positioning
local center_x=95
local center_y=175
local radius=50
cairo_select_font_face (cr, "Digital tech", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,1,1,1,1) --(cr,194/255,204/255,255/255,1)	-- (cr,1,1,1,1)
for i=1,number_days do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
--only print even numbers
if math.mod(i, 2) == 0 then
--set text when even
text=string.format("%02d",i) --formats numbers to double digits
else
--set text when odd
text=""
end--odd even matching
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=40
for i=1,number_days do
local point=(math.pi/180)*((360/number_days)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
-- DRAW HAND -- snaps to current DAY
local this_day=tonumber(os.date("%d"))
local hand_length=35--radius for this calculation
local point=(math.pi/180)*((360/number_days)*(this_day-1))
local x=0+hand_length*(math.sin(point))
local y=0-hand_length*(math.cos(point))
cairo_move_to (cr,center_x,center_y)
cairo_line_to (cr,center_x+x,center_y+y)
cairo_stroke (cr)
-- ### END CLOCK D ########################################

-- ########################################################
-- ### START CLOCK E ######################################
-- MARKS AROUND CLOCK E -- Bottom - 12 HR Clock
local number_marks_E=12
-- set mark length
local m_length_E=0
-- set mark width
local m_width_E=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,0,1-- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK E HOUR HAND
-- set length of hour hand
hh_length_E=25
-- set hour hand width
hh_width_E=2
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,0,1-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK E MINUTE HAND SETUP
-- set length of minute hand
mh_length_E=35
-- set minute hand width
mh_width_E=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,0,1-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK E SECOND HAND SETUP
-- set length of seconds hand
sh_length_E=32
-- set hour hand width
sh_width_E=1
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK E ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=45
clock_centerx=175
clock_centery=260
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_E
-- set line cap type
cairo_set_line_cap  (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_E)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR SECOND MARKS
for i=1,number_marks_E do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_E))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line-- MARKS AROUND CLOCK A
cairo_stroke (cr)
end-- of for loop
--[[ TIME CALCULATIONS CLOCK E
if clock_type_E==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_E==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
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 and draw it
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_E))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_E)
cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_line_cap  (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_E)
cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_line_cap  (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_E
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes
cairo_set_line_width (cr,sh_width_E)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap  (cr, sh_cap)
cairo_stroke (cr)


-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=260
local radius=45
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 11)
cairo_set_source_rgba (cr,194/255,204/255,255/255,1)	-- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
--text_days={"12","01","02","03","04","05","06","07","08","09","10","11",}
-- FOR A 12 HOUR CLOCK WITH THE NUMBERS 13-00
text_days={"00","13","14","15","16","17","18","19","20","21","22","23",}
for i=1,12 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=32
for i=1,12 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end ]]

-- ### END CLOCK E ########################################
-- ########################################################
-- ### START CLOCK A ######################################
-- SET MARKS ##############################################
-- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=24
-- set mark length
local m_length_A=0
-- set mark width
local m_width_A=0
-- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
-- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,1 -- opaque white
-- SETUP HOUR HANDS #######################################
-- CLOCK A HOUR HAND
-- set length of hour hand
hh_length_A=130
-- set hour hand width
hh_width_A=3
-- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
-- set hour hand color
hhr,hhg,hhb,hha=1,1,1,.5-- fully opaque white
-- SETUP MINUTE HANDS #####################################
-- CLOCK A MINUTE HAND SETUP
-- set length of minute hand
mh_length_A=145
-- set minute hand width
mh_width_A=2
-- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
-- set minute hand color
mhr,mhg,mhb,mha=1,1,1,.5-- fully opaque white
-- SETUP SECOND HANDS #####################################
-- CLOCK A SECOND HAND SETUP
-- set length of seconds hand
sh_length_A=150
-- set hour hand width
sh_width_A=2
-- set hour hand line cap
sh_cap=CAIRO_LINE_CAP_ROUND
-- set seconds hand color
shr,shg,shb,sha=1,0,0,1-- fully opaque red
-- CLOCK A ###### 12 HR TIME ##############################
-- CLOCK SETTINGS
clock_radius=200
clock_centerx=175
clock_centery=175
-- DRAWING CODE
-- DRAW BORDER
cairo_set_source_rgba (cr,cbr,cbg,cbb,cba)
cairo_set_line_width (cr,clock_border_width)
cairo_arc (cr,clock_centerx,clock_centery,clock_radius,0,2*math.pi)
cairo_stroke (cr)
-- DRAW MARKS
-- stuff that can be moved outside of the loop, needs only be set once
-- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A
-- set line cap type
cairo_set_line_cap  (cr, m_cap)
-- set line width
cairo_set_line_width (cr,m_width_A)
-- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
-- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
-- drawing code using the value of i to calculate degrees
-- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
-- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- draw the line
cairo_stroke (cr)
end-- of for loop
-- HOUR MARKS
-- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
-- convert hours to seconds
h_to_s=hours*60*60
end
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*clock_type_A))-- use equation ~ eliminate decimals
-- set radius to calculate hand points
radius=hh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
--cairo_set_source_rgba (cr,hhr,hhg,hhb,hha)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_cap  (cr, hh_cap)
cairo_stroke (cr)
-- DRAW MINUTE HAND
-- get minutes and seconds just as seconds
msecs=m_to_s+seconds
-- calculate degrees for each second
msec_degs=msecs*0.1
-- set radius to calculate hand points
radius=mh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
--cairo_set_source_rgba (cr,mhr,mhg,mhb,mha)
cairo_set_source_rgba (cr,169/255,169/255,169/255,1)
cairo_set_line_cap  (cr, mh_cap)
cairo_stroke (cr)
-- DRAW SECOND HAND
--[[
-- calculate degrees for each second
sec_degs=seconds*6
-- set radius to calculate hand points
radius=sh_length_A
-- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
-- calculate coordinates for end of seconds hand
point=(math.pi/180)*sec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))BOLD
-- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
-- set up line attributes
cairo_set_line_width (cr,sh_width_A)
cairo_set_source_rgba (cr,shr,shg,shb,sha)
cairo_set_line_cap  (cr, sh_cap)
cairo_stroke (cr)
]]
-- ####################################################################
-- part of a second hand
--position
local center_x=175
local center_y=175
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
local arc=(math.pi/180)*((360/60)*seconds)
--calculate point 1
local radius1=140
local x1=0+radius1*math.sin(arc)
local y1=0-radius1*math.cos(arc)
--calculate point 2
local radius2=158
local x2=0+radius2*math.sin(arc)
local y2=0-radius2*math.cos(arc)
--draw line connecting points
cairo_move_to (cr, center_x+x1,center_y+y1)
cairo_line_to (cr, center_x+x2, center_y+y2)
cairo_set_source_rgba (cr,255/255,0/255,0/255,1)
cairo_stroke (cr)
-- ####################################################################
-- POSITION FOR TEXT HOUR NUMBERS
local center_x=175
local center_y=175
local radius=165
-- FONT
cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 15)
cairo_set_source_rgba (cr,1,1,1,1) --(cr,194/255,204/255,255/255,1)	-- (cr,1,1,1,1)
-- TABLE OF TEXT -- in order
text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
for i=1,24 do
-- OUTTER POINTS POSTION FOR TEXT
local point=(math.pi/180)*((360/24)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
-- CALCULATE CENTRE OF TEXT
local text=text_days[i]--gets text from table
--local extents=cairo_text_extents_t:create()
--tolua.takeownership(extents)
cairo_text_extents(cr,text,extents)
local width=extents.width
local height=extents.height
cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
cairo_show_text (cr, text)
cairo_stroke (cr)
end
-- INNER POINTS POSITION, radius smaller than text circle
local radius=150
for i=1,24 do
local point=(math.pi/180)*((360/24)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
cairo_stroke (cr)
end
--[[ HOUR POINTS CIRCLES,  ##########Uncoment section to draw rings around numbers
local radius=162
for i=1,60 do
local point=(math.pi/180)*((360/12)*(i-1))
local x=0+radius*(math.sin(point))
local y=0-radius*(math.cos(point))
cairo_arc (cr,center_x+x,center_y+y,12,0,2*math.pi)
cairo_stroke (cr)
end]]
-- ### END CLOCK A ########################################

-- ########################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end-- end main function

crono_full_2.template.lua

--[[
 The latest script is a lua only weather script. aka: v9000
 http://crunchbang.org/forums/viewtopic.php?id=16100

 the file:
 http://dl.dropbox.com/u/19008369/weatheragain9000.lua.tar.gz

 mrppeachys LUA Tutorial
 http://crunchbang.org/forums/viewtopic.php?id=17246
]]
_G.weather_script = function()--#### DO NOT EDIT THIS LINE ##############
--these tables hold the coordinates for each repeat do not edit #########
top_left_x_coordinate={}--###############################################
top_left_y_coordinate={}--###############################################
--#######################################################################
--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="monofur"--font must be in quotes
default_font_size=12
default_color=0xffffff	--white
default_alpha=1		--fully opaque
default_image_width=50
default_image_height=50
-- ## New Options ###
default_face="bold"
-- "normal" for normal/normal
-- "bold" for normal/bold
-- "italic" for italic/normal
-- "bolditalic" for italic/bold
--END OF DEFAULTS #######################################################
--START OF WEATHER CODE -- START OF WEATHER CODE -- START OF WEATHER CODE

-- forecast
datay=375
datayy=15 --datay+(datayy*1)

datafx1=20

imgx=35
imgy=500
imgyy=60 -- imgy+(imgyy*1)
-- =============================================================================
-- Sun & Moon Rise -------------------------------------------------------------
   out({c=0xFAFAEC,a=1,x=10,y=15,txt="Sunrise"})
      out({c=0xFAFAEC,a=1,x=10,y=28,txt=sun_rise_24[1]})
   out({c=0xC0C0C0,a=1,x=290,y=15,txt="Moonrise"})
      out({c=0xC0C0C0,a=1,x=310,y=28,txt=moon_rise_24[1]})
-- Sun & Moon Set --------------------------------------------------------------
   out({c=0xFAFAEC,a=1,x=10,y=333,txt="Sunset"})
      out({c=0xFAFAEC,a=1,x=10,y=345,txt=sun_set_24[1]})
   out({c=0xC0C0C0,a=1,x=300,y=333,txt="Moonset"})
      out({c=0xC0C0C0,a=1,x=313,y=345,txt=moon_set_24[1]})
-- Moon Phase - Top Center Circle ----------------------------------------------
   out({c=0x48D1CC,a=1,x=150,y=40,txt=moon_phase[1]})
   image({x=148,y=67,w=55,h=55,file=moon_icon[1]})
-- image({x=148,y=67,w=55,h=55,file="/media/5/Conky/images/red_1.png"})

-- Forecast for Today - see Day# Circle - Left ---------------------------------
   out({c=0xFF8C00,fs=14,a=1,x=88,y=150,txt=high_temp[1]})
   image({x=70,y=150,w=50,h=50,file=weather_icon[1]})
-- image({x=70,y=150,w=50,h=50,file="/media/5/Conky/images/red_1.png"})
   out({c=0x00BFFF,fs=14,a=1,x=88,y=210,txt=low_temp[1]})

-- Above the Month Circle on the Right -----------------------------------------
-- Humidity
   out({c=0xFAFAEC,a=1,x=240,y=100,txt="Hum:"})
      out({c=0x48D1CC,a=1,x=268,y=100,txt=now["humidity"].."%"})
-- Chance of Rain
   out({c=0xFAFAEC,a=1,x=240,y=115,txt="Rain:"})
      out({c=0x48D1CC,a=1,x=277,y=115,txt=precipitation[1].."%"})
-- Wind Info - See Months Circle & below ---------------------------------------
   image({x=235,y=150,w=50,h=50,file=now["wind_icon"]})
-- image({x=235,y=150,w=50,h=50,file="/media/5/Conky/images/red_1.png"})
   out({c=0x48D1CC,a=1,x=240,y=245,txt=now["wind_km"]})
-- out({c=0x48D1CC,a=1,x=240,y=260,txt=now["wind_nesw"]})
   out({c=0xFAFAEC,a=1,x=250,y=260,txt="@"})
      out({c=0x48D1CC,a=1,x=260,y=260,txt=now["wind_deg"]})
-- Dew Point -------------------------------------------------------------------
   out({c=0xFAFAEC,a=1,x=238,y=275,txt="DP:"})
      out({c=0x48D1CC,a=1,x=260,y=275,txt=now["dew_point"].."°"})

-- Above Day# Circle on left ---------------------------------------------------
-- Cloud Cover
   out({c=0xFAFAEC,a=1,x=60,y=100,txt="CC:"})
      out({c=0x48D1CC,a=1,x=80,y=100,txt=cloud_cover[1].."%"})
-- Ceiling
   --out({c=0xFAFAEC,a=1,x=45,y=115,txt="Ceil:"})
      out({c=0x48D1CC,a=1,x=60,y=115,txt=now["ceiling"]})
-- Current for Today - Day# Circle ---------------------------------------------
   out({c=0xFAFAEC,a=1,x=155,y=215,txt="T:"})
      out({c=0x9ACD32,fs=14,a=1,x=170,y=215,txt=now["temp"].."°"})
   image({x=132,y=218,w=80,h=80,file=now["weather_icon"]})
-- image({x=132,y=218,w=85,h=85,file="/media/5/Conky/images/red_1.png"})
   out({c=0xFAFAEC,a=1,x=155,y=310,txt="F:"})
      out({c=0x00BFFF,fs=14,a=1,x=170,y=310,txt=now["feels_like"].."°"})
-- Below day# Circle on left ---------------------------------------------------
-- Barometric Pressure
out({c=0xFAFAEC,a=1,x=42,y=245,txt=" BP:"})
	out({c=0x48D1CC,a=1,x=70,y=245,txt=now["pressure_mb"]})
-- UV
out({c=0xFAFAEC,a=1,x=55,y=260,txt="UV:"})
   out({c=0x48D1CC,a=1,x=80,y=260,txt=uv_index_num[1]})
      out({c=0x48D1CC,a=1,x=68,y=275,txt=uv_index_txt[1]})

-- Forecast for the next 3 hours -----------------------------------------------
-- image({x=5,y=353,w=340,h=2,file="/media/5/Conky/images/LightSlateGrey_1.png"})
   image({x=5,y=360,w=120,h=2,file="/media/5/Conky/images/LightSlateGrey_1.png"})
      out({c=0xFAFAEC,a=1,x=136,y=365,txt="Next 3 Hours"})
   image({x=230,y=360,w=115,h=2,file="/media/5/Conky/images/LightSlateGrey_1.png"})

-- 1st hour
out({c=0x48D1CC,x=52,y=380,txt=now["fc_hour1_time_24"]..":00"})
   image({w=80,h=80,x=30,y=380,file=now["fc_hour1_wicon"]})
-- image({w=80,h=80,x=30,y=380,file="/media/5/Conky/images/red_1.png"})
   out({c=0x00BFFF,fs=18,x=55,y=470,txt=now["fc_hour1_temp"] .."°"})
-- 2nd hour
out({c=0x48D1CC,x=159,y=380,txt=now["fc_hour2_time_24"]..":00"})
   image({w=80,h=80,x=135,y=380,file=now["fc_hour2_wicon"]})
-- image({w=80,h=80,x=135,y=380,file="/media/5/Conky/images/red_1.png"})
   out({c=0x00BFFF,fs=18,x=160,y=470,txt=now["fc_hour2_temp"] .."°"})
-- 3rd hour
out({c=0x48D1CC,x=268,y=380,txt=now["fc_hour3_time_24"]..":00"})
   image({w=80,h=80,x=245,y=380,file=now["fc_hour3_wicon"]})
-- image({w=80,h=80,x=245,y=380,file="/media/5/Conky/images/red_1.png"})
   out({c=0x00BFFF,fs=18,x=270,y=470,txt=now["fc_hour3_temp"] .."°"})
-- line
image({x=5,y=475,w=340,h=2,file="/media/5/Conky/images/LightSlateGrey_1.png"})
-- =============================================================================
-- FORECAST for the next 9 days
-- Forecast day 2 -- x = l|r  y = u|d
out({c=0x9ACD32,a=1,x=datafx1*0.4,y=datay+(datayy*8),txt=forecast_day_short[2]})
 out({c=0x9ACD32,a=1,x=datafx1*2.1,y=datay+(datayy*8),txt=forecast_date[2]})
  out({c=0x9ACD32,a=1,x=datafx1*3.7,y=datay+(datayy*8),txt=forecast_month_short[2]})
image({x=imgx*0.6,y=imgy,file=weather_icon[2]})
out({c=0xFF8C00,a=1,x=datafx1*0.4,y=datay+(datayy*9.5),txt=high_temp[2]})
out({c=0x00BFFF,a=1,x=datafx1*0.4,y=datay+(datayy*11),txt=low_temp[2]})
 out({c=0xFAFAEC,a=1,x=datafx1*3.7,y=datay+(datayy*8.8),txt=sun_rise_24[2]})
 out({c=0xFAFAEC,a=1,x=datafx1*3.7,y=datay+(datayy*9.5),txt=sun_set_24[2]})
  out({c=0xC0C0C0,a=1,x=datafx1*3.7,y=datay+(datayy*10.8),txt=moon_rise_24[2]})
  out({c=0xC0C0C0,a=1,x=datafx1*3.7,y=datay+(datayy*11.5),txt=moon_set_24[2]})
-- Forecast day 3 -- x = l|r  y = u|d
out({c=0x9ACD32,a=1,x=datafx1*6.6,y=datay+(datayy*8),txt=forecast_day_short[3]})
 out({c=0x9ACD32,a=1,x=datafx1*8.2,y=datay+(datayy*8),txt=forecast_date[3]})
  out({c=0x9ACD32,a=1,x=datafx1*9.8,y=datay+(datayy*8),txt=forecast_month_short[3]})
image({x=imgx*4.15,y=imgy,file=weather_icon[3]})
out({c=0xFF8C00,a=1,x=datafx1*6.5,y=datay+(datayy*9.5),txt=high_temp[3]})
out({c=0x00BFFF,a=1,x=datafx1*6.5,y=datay+(datayy*11),txt=low_temp[3]})
 out({c=0xFAFAEC,a=1,x=datafx1*9.8,y=datay+(datayy*8.8),txt=sun_rise_24[3]})
 out({c=0xFAFAEC,a=1,x=datafx1*9.8,y=datay+(datayy*9.5),txt=sun_set_24[3]})
  out({c=0xC0C0C0,a=1,x=datafx1*9.8,y=datay+(datayy*10.8),txt=moon_rise_24[3]})
  out({c=0xC0C0C0,a=1,x=datafx1*9.8,y=datay+(datayy*11.5),txt=moon_set_24[3]})
-- Forecast day 4 -- x = l|r  y = u|d
out({c=0x9ACD32,a=1,x=datafx1*12.4,y=datay+(datayy*8),txt=forecast_day_short[4]})
 out({c=0x9ACD32,a=1,x=datafx1*14.3,y=datay+(datayy*8),txt=forecast_date[4]})
  out({c=0x9ACD32,a=1,x=datafx1*15.7,y=datay+(datayy*8),txt=forecast_month_short[4]})
image({x=imgx*7.52,y=imgy,file=weather_icon[4]})
out({c=0xFF8C00,a=1,x=datafx1*12.4,y=datay+(datayy*9.5),txt=high_temp[4]})
out({c=0x00BFFF,a=1,x=datafx1*12.4,y=datay+(datayy*11),txt=low_temp[4]})
 out({c=0xFAFAEC,a=1,x=datafx1*15.7,y=datay+(datayy*8.8),txt=sun_rise_24[4]})
 out({c=0xFAFAEC,a=1,x=datafx1*15.7,y=datay+(datayy*9.5),txt=sun_set_24[4]})
  out({c=0xC0C0C0,a=1,x=datafx1*15.7,y=datay+(datayy*10.8),txt=moon_rise_24[4]})
  out({c=0xC0C0C0,a=1,x=datafx1*15.7,y=datay+(datayy*11.5),txt=moon_set_24[4]})
-- =============================================================================
-- Forecast day 5 -- x = l|r  y = u|d
  out({c=0x9ACD32,a=1,x=datafx1*0.4,y=datay+(datayy*13),txt=forecast_day_short[5]})
   out({c=0x9ACD32,a=1,x=datafx1*2.1,y=datay+(datayy*13),txt=forecast_date[5]})
    out({c=0x9ACD32,a=1,x=datafx1*3.7,y=datay+(datayy*13),txt=forecast_month_short[5]})
  image({x=imgx*0.6,y=imgy+(imgyy*1.2),file=weather_icon[5]})
  out({c=0xFF8C00,a=1,x=datafx1*0.4,y=datay+(datayy*14.5),txt=high_temp[5]})
  out({c=0x00BFFF,a=1,x=datafx1*0.4,y=datay+(datayy*16),txt=low_temp[5]})
   out({c=0xFAFAEC,a=1,x=datafx1*3.7,y=datay+(datayy*13.7),txt=sun_rise_24[5]})
   out({c=0xFAFAEC,a=1,x=datafx1*3.7,y=datay+(datayy*14.4),txt=sun_set_24[5]})
    out({c=0xC0C0C0,a=1,x=datafx1*3.7,y=datay+(datayy*15.7),txt=moon_rise_24[5]})
    out({c=0xC0C0C0,a=1,x=datafx1*3.7,y=datay+(datayy*16.4),txt=moon_set_24[5]})
-- Forecast day 6 -- x = l|r  y = u|d
  out({c=0x9ACD32,a=1,x=datafx1*6.6,y=datay+(datayy*13),txt=forecast_day_short[6]})
   out({c=0x9ACD32,a=1,x=datafx1*8.2,y=datay+(datayy*13),txt=forecast_date[6]})
    out({c=0x9ACD32,a=1,x=datafx1*9.8,y=datay+(datayy*13),txt=forecast_month_short[6]})
  image({x=imgx*4.18,y=imgy+(imgyy*1.2),file=weather_icon[6]})
  out({c=0xFF8C00,a=1,x=datafx1*6.7,y=datay+(datayy*14.5),txt=high_temp[6]})
  out({c=0x00BFFF,a=1,x=datafx1*6.7,y=datay+(datayy*16),txt=low_temp[6]})
  out({c=0xFAFAEC,a=1,x=datafx1*9.8,y=datay+(datayy*13.7),txt=sun_rise_24[6]})
  out({c=0xFAFAEC,a=1,x=datafx1*9.8,y=datay+(datayy*14.4),txt=sun_set_24[6]})
  out({c=0xC0C0C0,a=1,x=datafx1*9.8,y=datay+(datayy*15.7),txt=moon_rise_24[6]})
  out({c=0xC0C0C0,a=1,x=datafx1*9.8,y=datay+(datayy*16.4),txt=moon_set_24[6]})
-- Forecast day 7 -- x = l|r  y = u|d
  out({c=0x9ACD32,a=1,x=datafx1*12.4,y=datay+(datayy*13),txt=forecast_day_short[7]})
   out({c=0x9ACD32,a=1,x=datafx1*14.3,y=datay+(datayy*13),txt=forecast_date[7]})
    out({c=0x9ACD32,a=1,x=datafx1*15.7,y=datay+(datayy*13),txt=forecast_month_short[7]})
  image({x=imgx*7.49,y=imgy+(imgyy*1.2),file=weather_icon[7]})
  out({c=0xFF8C00,a=1,x=datafx1*12.4,y=datay+(datayy*14.5),txt=high_temp[7]})
  out({c=0x00BFFF,a=1,x=datafx1*12.4,y=datay+(datayy*16),txt=low_temp[7]})
  out({c=0xFAFAEC,a=1,x=datafx1*15.7,y=datay+(datayy*13.7),txt=sun_rise_24[7]})
  out({c=0xFAFAEC,a=1,x=datafx1*15.7,y=datay+(datayy*14.4),txt=sun_set_24[7]})
  out({c=0xC0C0C0,a=1,x=datafx1*15.7,y=datay+(datayy*15.7),txt=moon_rise_24[7]})
  out({c=0xC0C0C0,a=1,x=datafx1*15.7,y=datay+(datayy*16.4),txt=moon_set_24[7]})
-- =============================================================================
-- Forecast day 8 -- x = l|r  y = u|d
    out({c=0x9ACD32,a=1,x=datafx1*0.4,y=datay+(datayy*18),txt=forecast_day_short[8]})
     out({c=0x9ACD32,a=1,x=datafx1*2.1,y=datay+(datayy*18),txt=forecast_date[8]})
      out({c=0x9ACD32,a=1,x=datafx1*3.7,y=datay+(datayy*18),txt=forecast_month_short[8]})
    image({x=imgx*0.6,y=imgy+(imgyy*2.5),file=weather_icon[8]})
    out({c=0xFF8C00,a=1,x=datafx1*0.4,y=datay+(datayy*19.5),txt=high_temp[8]})
    out({c=0x00BFFF,a=1,x=datafx1*0.4,y=datay+(datayy*21),txt=low_temp[8]})
    out({c=0xFAFAEC,a=1,x=datafx1*3.7,y=datay+(datayy*18.7),txt=sun_rise_24[8]})
    out({c=0xFAFAEC,a=1,x=datafx1*3.7,y=datay+(datayy*19.4),txt=sun_set_24[8]})
    out({c=0xC0C0C0,a=1,x=datafx1*3.7,y=datay+(datayy*20.7),txt=moon_rise_24[8]})
    out({c=0xC0C0C0,a=1,x=datafx1*3.7,y=datay+(datayy*21.4),txt=moon_set_24[8]})
-- Forecast day 9 -- x = l|r  y = u|d
    out({c=0x9ACD32,a=1,x=datafx1*6.5,y=datay+(datayy*18),txt=forecast_day_short[9]})
     out({c=0x9ACD32,a=1,x=datafx1*8.1,y=datay+(datayy*18),txt=forecast_date[9]})
      out({c=0x9ACD32,a=1,x=datafx1*9.7,y=datay+(datayy*18),txt=forecast_month_short[9]})
    image({x=imgx*4.14,y=imgy+(imgyy*2.5),file=weather_icon[9]})
    out({c=0xFF8C00,a=1,x=datafx1*6.5,y=datay+(datayy*19.5),txt=high_temp[9]})
    out({c=0x00BFFF,a=1,x=datafx1*6.5,y=datay+(datayy*21),txt=low_temp[9]})
     out({c=0xFAFAEC,a=1,x=datafx1*9.8,y=datay+(datayy*18.7),txt=sun_rise_24[9]})
     out({c=0xFAFAEC,a=1,x=datafx1*9.8,y=datay+(datayy*19.4),txt=sun_set_24[9]})
      out({c=0xC0C0C0,a=1,x=datafx1*9.8,y=datay+(datayy*20.7),txt=moon_rise_24[9]})
      out({c=0xC0C0C0,a=1,x=datafx1*9.8,y=datay+(datayy*21.4),txt=moon_set_24[9]})
-- Forecast day 10 -- x = l|r  y = u|d
    out({c=0x9ACD32,a=1,x=datafx1*12.4,y=datay+(datayy*18),txt=forecast_day_short[10]})
     out({c=0x9ACD32,a=1,x=datafx1*14.3,y=datay+(datayy*18),txt=forecast_date[10]})
      out({c=0x9ACD32,a=1,x=datafx1*15.7,y=datay+(datayy*18),txt=forecast_month_short[10]})
    image({x=imgx*7.55,y=imgy+(imgyy*2.5),file=weather_icon[10]})
    out({c=0xFF8C00,a=1,x=datafx1*12.4,y=datay+(datayy*19.5),txt=high_temp[10]})
    out({c=0x00BFFF,a=1,x=datafx1*12.4,y=datay+(datayy*21),txt=low_temp[10]})
     out({c=0xFAFAEC,a=1,x=datafx1*15.7,y=datay+(datayy*18.7),txt=sun_rise_24[10]})
     out({c=0xFAFAEC,a=1,x=datafx1*15.7,y=datay+(datayy*19.4),txt=sun_set_24[10]})
      out({c=0xC0C0C0,a=1,x=datafx1*15.7,y=datay+(datayy*20.7),txt=moon_rise_24[10]})
      out({c=0xC0C0C0,a=1,x=datafx1*15.7,y=datay+(datayy*21.4),txt=moon_set_24[10]})

--########################################################################################
--END OF WEATHER CODE ----END OF WEATHER CODE ----END OF WEATHER CODE ---
--#######################################################################
end--of weather_display function do not edit this line ##################
--#######################################################################

mounted.lua

--[[partitions for conky by mrpeachy

##instructions
##load script
lua_load ~/lua/mounted.lua
## first lua command below text:
## ${lua get_mounted_data interval}, where interval is a number.  This starts data gathering
## to get output:
## ${lua mount partition_number data_type text_length}, where partition number is a number
## text_length is optional, lets you specify the max number of characters the function returns. only affects fsys and mount data options
## data_type can be
## total - shows total number of partitions mounted, requires a partition_number also, use 1, could be used in an if_match
## fsys - shows filesystem
## size - shows space used in appropriate units
## free - shows free space in appropriate units
## use% - shows % used
## mount - shows mountpoint

TEXT
CPU %: ${cpu cpu0} ${lua get_mounted_data 10}
TOTAL PARTITIONS MOUNTED: ${lua mount 1 total}
FSYS${goto 100}SIZE${goto 200}USED%${goto 300}MOUNT
${lua mount 1 fsys}${goto 100}${lua mount 1 size}${goto 200}${lua mount 1 use%}${goto 300}${lua mount 1 mount 10}
${lua mount 2 fsys}${goto 100}${lua mount 2 size}${goto 200}${lua mount 2 use%}${goto 300}${lua mount 2 mount 10}
${lua mount 3 fsys}${goto 100}${lua mount 3 size}${goto 200}${lua mount 3 use%}${goto 300}${lua mount 3 mount 10}
${lua mount 4 fsys}${goto 100}${lua mount 4 size}${goto 200}${lua mount 4 use%}${goto 300}${lua mount 4 mount 10}

]]

conky_start=1
function conky_get_mounted_data(interval)
local updates=tonumber(conky_parse("${updates}"))
timer=(updates % interval)
if timer==0 or conky_start==1 then
fsys={}
size={}
used={}
avail={}
uperc={}
mount={}
local file = io.popen("df -h")
	for line in file:lines() do
		if string.find(line,"/dev/")~=nil then
		local s,f,fs=string.find(line,"^([%d%a%p]*)%s")
		table.insert(fsys,fs)
		local s,f,sz=string.find(line,"%s*([%d%a%p]*)%s",f)
		table.insert(size,sz)
		local s,f,us=string.find(line,"%s*([%d%a%p]*)%s",f)
		table.insert(used,us)
		local s,f,av=string.find(line,"%s*([%d%a%p]*)%s",f)
		table.insert(avail,av)
		local s,f,up=string.find(line,"%s*([%d%a%p]*)%s",f)
		table.insert(uperc,up)
		local s,f,mn=string.find(line,"%s*([%d%a%p]*)%s*$",f)
		table.insert(mount,mn)
		end
	end
file:close()
conky_start=nil
end--timed section
return ""
end

function conky_mount(n,d,c)--n=partition_number,d=data_type,c=number of characters to return
d=tostring(d)
n=tonumber(n)
c=tonumber(c) or 0
if d=="total" then
data=#fsys or 1
elseif d=="fsys" then
data=fsys[n] or ""
	if c~=0 then
	data=string.sub(data,1,c) or ""
	end
elseif d=="size" then
data=size[n] or ""
elseif d=="used" then
data=used[n] or ""
elseif d=="free" then
data=avail[n] or ""
elseif d=="use%" then
data=uperc[n] or ""
elseif d=="mount" then
data=mount[n] or ""
	if c~=0 then
	data=string.sub(data,1,c) or ""
	end
else
data="check data type"
end
return data
end--end main function

draw-bg-lua - Post #1511

The v9000 needs modifications:

Thanks to mrpeachy for the edit to the v9000 script that allows a new value for default fonts in the v9000 templates.

The part of the v9000 script responsible
Starts at

function out(tx)

ends with:

end--function out

Change that section to:

function out(tx)--##############################################################
--#############################
--additional face settings
face=nil
face=(tx.face or default_face)  -- old is: face=(tx.face or "normal")
if face=="normal" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bold" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
elseif face=="italic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_NORMAL);
elseif face=="bolditalic" then
cairo_select_font_face (cr, f, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_WEIGHT_BOLD);
end
--##############################################################################
c=nil
c=(tx.c or default_color)
a=nil
a=(tx.a or default_alpha)
f=nil
f=(tx.f or default_font)
fs=nil
fs=(tx.fs or default_font_size)
x=nil
x=(tx.x or 0)
y=nil
y=(tx.y or 0)
txt=nil
txt=(tx.txt or "set txt")
local function col(c,a)
return ( (c/0x10000) % 0x100)/255,( (c/0x100) % 0x100)/255,(c % 0x100)/255,a
end--local function
cairo_set_font_size (cr, fs)
cairo_set_source_rgba (cr,col(c,a))
cairo_move_to (cr,x,y)
cairo_show_text (cr,txt)
cairo_stroke (cr)
end--function out ##############################################################

Now the template can have a new section in the SET DEFAULTS:

--SET DEFAULTS ##########################################################
--set defaults do not localise these defaults if you use a seperate display script
default_font="monofur"--font must be in quotes
default_font_size=12
default_color=0xffffff --white
default_alpha=1 --fully opaque
default_image_width=50
default_image_height=50
-- ## New Options ###
default_face="bold"
-- "normal" for normal/normal
-- "bold" for normal/bold
-- "italic" for italic/normal
-- "bolditalic" for italic/bold
--END OF DEFAULTS #######################################################

Dernière modification par Sector11 (Le 13/11/2012, à 14:04)

Hors ligne

#1515 Le 12/11/2012, à 19:25

Didier-T

Re : [Conky] Alternative à weather.com (2)

Et bien c'est parfait tous sa, Sector11 a trouvé la solution tous seul, an même temps, je crois que je n'y aurais pas pensé tongue

Hors ligne

#1516 Le 12/11/2012, à 22:51

sunkart

Re : [Conky] Alternative à weather.com (2)

Hello,

Je tente de faire tourner le script météo.
Lors de son lancement, j'ai les messages suivant qui s'affichent dans terminal :

Conky: llua_do_call: function conky_Meteo_TempAct execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_CondMeteo execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_VentDirP execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_VentForce execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_ProbOrage execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Nuit_ProbOrage execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_AM_CondMeteo1 execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Noct_CondMeteo1 execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_AM_CondMeteo2 execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Noct_CondMeteo2 execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Lune_ephemerides1 execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Lune_ephemerides2 execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_ProbOrage execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_ProbOrage execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_ProbOrage execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_ProbOrage execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Nuit_Temp execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: attempt to call a nil value
Conky: llua_do_call: function conky_Meteo_Jour_VentForce execution failed: attempt to call a nil value

Cyril

Hors ligne

#1517 Le 13/11/2012, à 06:03

Didier-T

Re : [Conky] Alternative à weather.com (2)

Bonjour sunkart,

Il faudrait le début du message retourné en terminal, merci.

Hors ligne

#1518 Le 13/11/2012, à 09:55

sunkart

Re : [Conky] Alternative à weather.com (2)

J'ai fait plusieurs essais pour avoir le début mais ça défile très (trop) vite.
Je retente ce soir.


Cyril

Hors ligne

#1519 Le 13/11/2012, à 10:21

Didier-T

Re : [Conky] Alternative à weather.com (2)

le plus simple pour y arriver est d'ouvrir 2 terminals.
1 pour lancer le conky.
l'autre pour l'arrêter.

Hors ligne

#1520 Le 13/11/2012, à 12:32

ti_tux

Re : [Conky] Alternative à weather.com (2)

Didier-T a écrit :

le plus simple pour y arriver est d'ouvrir 2 terminals.
1 pour lancer le conky.
l'autre pour l'arrêter.

Un seul suffit. Tu peux lancer ton conky et rediriger la sortie standard dans un fichier.

conky -c .conkyrc >& log.txt

Puis tu kill ton conky quand tu veux sans contrainte de temps.


Venez traduire KDE (doc, appli, pages web) en français http://fr.l10n.kde.org/

Hors ligne

#1521 Le 13/11/2012, à 12:50

Didier-T

Re : [Conky] Alternative à weather.com (2)

en effet c'est une très bonne solution.

Hors ligne

#1522 Le 13/11/2012, à 14:14

Sector11

Re : [Conky] Alternative à weather.com (2)

Didier-T a écrit :

Et bien c'est parfait tous sa, Sector11 a trouvé la solution tous seul, an même temps, je crois que je n'y aurais pas pensé tongue

Me?  I solved nothing, I am using others scripts.
I am The Great Pretender  lol

Chronograph_full.lua  12 Nov 2012 - memory leak plugged by mrpeachy
Fixed and code updated post #1514

Dernière modification par Sector11 (Le 13/11/2012, à 14:15)

Hors ligne

#1523 Le 13/11/2012, à 19:16

jpdipsy

Re : [Conky] Alternative à weather.com (2)

Toutes,tous

Juste un passage rapide pour vous montrer une "vitrine" d'une vidéo en préparation que je posterai sur "youtube"  montrant l'installation de tous le "bousin" avec xplanetFX pour arriver à quelque chose comme ceci.

La vitrine

j' espère que çà vous plaira.
A+

Hors ligne

#1524 Le 13/11/2012, à 20:05

sunkart

Re : [Conky] Alternative à weather.com (2)

Super ça fonctionne très bien cette manip pour renvoyer les retours dans un fichier txt.

J'ai pu corriger certains éléments, voici le résultat l'exécution :

Conky: can't parse X color 'lightwhite'
Conky: can't parse X color 'lightwhite'
Conky: forked to background, pid is 2411

Conky: desktop window (1400003) is subwindow of root window (14e)
Conky: window type - desktop
Conky: drawing to created window (0x3a00001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_init execution failed: ...uOne/Portable/conky/Meteo_lua/conky/script/meteo.lua:937: bad argument #1 to 'match' (string expected, got nil)
date: /home/portable/conky/meteo/CondCour: Aucun fichier ou dossier de ce type
Conky: llua_do_call: function conky_Meteo_horsligne execution failed: ...uOne/Portable/conky/Meteo_lua/conky/script/meteo.lua:1013: /home/portable/conky/meteo/CondCour: No such file or directory
Conky: llua_getstring: function conky_Meteo_Ville didn't return a string, result discarded
Conky: llua_getstring: function conky_Meteo_TempAct didn't return a string, result discarded
Conky: failed to parse compare string '<5'
Conky: compare failed for expression '<5'
Conky: llua_getstring: function conky_Meteo_TempAct didn't return a string, result discarded
Conky: llua_getstring: function conky_Meteo_CondMeteo didn't return a string, result discarded
Conky: llua_getstring: function conky_Meteo_VentDirP didn't return a string, result discarded
Conky: llua_getstring: function conky_Meteo_VentForce didn't return a string, result discarded

Cyril

Hors ligne

#1525 Le 13/11/2012, à 21:02

Didier-T

Re : [Conky] Alternative à weather.com (2)

Sector11 a écrit :
Didier-T a écrit :

Et bien c'est parfait tous sa, Sector11 a trouvé la solution tous seul, an même temps, je crois que je n'y aurais pas pensé tongue

Me?  I solved nothing, I am using others scripts.
I am The Great Pretender  lol

Chronograph_full.lua  12 Nov 2012 - memory leak plugged by mrpeachy
Fixed and code updated post #1514

sa c'est une très bonne nouvelle, plus de fuite sur le script Chronograph_full.lua, merci pour l'info Sector11, et merci à mrpeachy.

Hors ligne