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.

#1976 Le 04/11/2012, à 17:06

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Twi a écrit :

Que faut il rajouter pour que mon texte soit centré

${color1}${font ubuntu L:style=Medium Italic:pixelsize=34}${time %H:%M}${font}${color}
${font pixelsize=12}${time %A %d %B %Y}

Merci

Tu peux utiliser ${alignc} ou ${goto) mais cette dernière demande de calculer au pixel près la position idéale.


Cyril

Hors ligne

#1977 Le 04/11/2012, à 17:21

Phyllinux

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Twi a écrit :

Que faut il rajouter pour que mon texte soit centré

${color1}${font ubuntu L:style=Medium Italic:pixelsize=34}${time %H:%M}${font}${color}
${font pixelsize=12}${time %A %d %B %Y}

Merci

As tu essayé ${alignc] ?
Sans voir ton conky, difficile de t'en dire plus ...


The ship is sinking normally...

Hors ligne

#1978 Le 04/11/2012, à 17:25

Twi

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Merci les gens,

La ligne ${alignc} fonctionne.

Merci wink

Hors ligne

#1979 Le 04/11/2012, à 17:35

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

sunkart a écrit :

Bonjour Didier-T,

Je pense avoir réglé le problème d'affichage tout moche mettant à own_window_argb_visual à "no". J'ai passé à "no" le paramètre own_window_transparent.

Du coup, je me retrouve avec un truc net (même si c'est pas transparent mais noir ...) :
http://imageshack.us/a/img94/2477/cran04112012091208.th.png

On voit bien la zone du haut qui n'est pas vraiment noir (fait exprès) et la partie basse qui devrait être transparente qui est noir;

J'ai contourné mon problème en chargeant directement mon fond d'écran. C'est pas super propre et ça doit alourdir Conky. Je vais garder cette solution pour aller au bout de mon idée et je verrai le résultat final.


Cyril

Hors ligne

#1980 Le 04/11/2012, à 22:14

rsuinux

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

bonjour,
vous qui êtes au point avec conky, sauriez vous s'il est possible (et comment)  je peux mettre une pseudo fenêtre en fond d'écran, avec conky bien sur.
Pour le moment, j'ai sur mon bureau un conky en haut, et mon fond d'écran c'est une image avec nitrogen, mon environnement c'est openbox.
Et je voudrais donc mettre en plus syslog en fond d'écran (mais "par dessus" mon image) et en plus, je voudrais que ce soit un genre de

tail -f /var/log/syslog

Alors, possible ou pas?


Si tu ne sais pas: demande; si tu sais: partage!

Hors ligne

#1981 Le 05/11/2012, à 00:39

maan

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Alors suite de mon conky

1352068386.png

par contre je n'arrive pas à affiché le niveau dans mes rings de températures,
enfin c'est surtout que je ne sais pas ce que je doit lui renseigner et où pour qu'il m'affiche le niveau roll


Ubuntu_studio 14.04

Hors ligne

#1982 Le 05/11/2012, à 07:30

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

rsuinux a écrit :

bonjour,
vous qui êtes au point avec conky, sauriez vous s'il est possible (et comment)  je peux mettre une pseudo fenêtre en fond d'écran, avec conky bien sur.
Pour le moment, j'ai sur mon bureau un conky en haut, et mon fond d'écran c'est une image avec nitrogen, mon environnement c'est openbox.
Et je voudrais donc mettre en plus syslog en fond d'écran (mais "par dessus" mon image) et en plus, je voudrais que ce soit un genre de

tail -f /var/log/syslog

Alors, possible ou pas?

le plus simple serais d'utiliser tilda, avec la commande suivante :
tilda -c "tail -f /var/log/syslog"

Pour configurer sa position la transparence et tous le reste un clique droit dans la fenêtre et tu n'auras plus qu'a gérer via des onglets (je suis pas sur que l'on fasse plus simple)

Hors ligne

#1983 Le 05/11/2012, à 07:32

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@ maan,

Il vas nous falloir ton script lua.
Pour te dire quoi mettre et ou.

Hors ligne

#1984 Le 05/11/2012, à 10:57

maan

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Salut Didier,
je suppose qu ele script qu'il te faut est le meteo.lua  ..... dans le doute je te met les autres.lua 

meteo.lua

-- Créé par Didier-T (forum.ubuntu-fr.org)
-- Nécessite imagemagick http://apt.ubuntu.com/p/imagemagick



require "io"
require "os"
local Version = "v4.7"
local conditionJour = {}
local conditionNuit = {}
local conditionMatin = {}
local conditionAM = {}
local conditionSoiree = {}
local conditionNoct = {}
local InfoJour = {}
local conditioncourante = {}
local huitHeures = {}
local Rep, cmd, jours, matin, apresmidi, soiree, nuit, delais, r, repsauv, l, fichier_init, MAJ, tc, dermodif, VilleAdresse
local Debug = "Problème Info "
--Liste des accents et carractère non pris en charge par les patterns
local pat="%é%è%à%ä%â%ê%ô%ç%É%È%À%Â%Ä%Ê%Ô%Ç"


--Traduction date
function trad_date(d)
	local date = d
	date = date:gsub("Monday", "Lundi"):gsub("Tuesday", "Mardi"):gsub("Wednesday", "Mercredi"):gsub("Thursday", "Jeudi"):gsub("Friday", "Vendredi"):gsub("Saturday", "Samedi"):gsub("Sunday", "Dimanche")

	date = date:gsub("lun", "Lun"):gsub("mar", "Mar"):gsub("mer", "Mer"):gsub("jeu", "Jeu"):gsub("ven", "Ven"):gsub("sam", "Sam"):gsub("dim", "Dim")

	date = date:gsub("Mon", "Lun"):gsub("Tue", "Mar"):gsub("Wed", "Mer"):gsub("Thu", "Jeu"):gsub("Fri", "Ven"):gsub("Sat", "Sam"):gsub("Sun", "Dim")
	
	date = date:gsub("January", "Janvier"):gsub("February", "Février"):gsub("March", "Mars"):gsub("April", "Avril"):gsub("May", "Mai"):gsub("June", "Juin"):gsub("July", "Juillet"):gsub("August", "Août"):gsub("September", "Septembre"):gsub("October", "Octobre"):gsub("November", "Novembre"):gsub("December", "Décembre")

	date = date:gsub("jan", "Jan"):gsub("fev", "Fév"):gsub("mar", "Mar"):gsub("avr", "Avr"):gsub("mai", "Mai"):gsub("jui", "Jui"):gsub("aou", "Aoû"):gsub("sep", "Sep"):gsub("oct", "Oct"):gsub("nov", "Nov"):gsub("dec", "Déc")
	
	date = date:gsub("Feb", "Fév"):gsub("Apr", "Avr"):gsub("May", "Mai"):gsub("Jun", "Juin"):gsub("Jul", "Juil"):gsub("Aug", "Aoû"):gsub("Dec", "Déc")
		
	return date
end

--Vérifier l'existence d'un fichier
function existe(file) 
  local a = io.open(file, "r")
  local present
  if a then
    present = true
    io.close(a)
  else
    present = false
  end
  return present
end

--Formatage des pages web
function string.formatage(ligne)
ligne = ligne:gsub("ô", "ô"):gsub("â", "â"):gsub("é", "é"):gsub("è", "è"):gsub("à", "à"):gsub("ç", "ç"):gsub("ê", "ê"):gsub("ö", "ö"):gsub("î", "î"):gsub("ï", "ï"):gsub("û", "û"):gsub("ü", "ü"):gsub("'", "'"):gsub("Poudreries", "Bourrasques de neige"):gsub("É", "É"):gsub("°",""):gsub("[\n\r]",""):gsub("é", "é")
return ligne
end

--Traitement Huit prochaines heures

function Huit_Heures(web)
	local f, i, line, heure1, heure2, heure3, heure4, heure5, heure6, heure7, heure8, icone1, icone2, icone3, icone4, icone5, icone6, icone7, icone8, Temp1, Temp2, Temp3, Temp4, Temp5, Temp6, Temp7, Temp8, TempR1, TempR2, TempR3, TempR4, TempR5, TempR6, TempR7, TempR8, Humi1, Humi2, Humi3, Humi4, Humi5, Humi6, Humi7, Humi8, Pluie1, Pluie2, Pluie3, Pluie4, Pluie5, Pluie6, Pluie7, Pluie8, Neige1, Neige2, Neige3, Neige4, Neige5, Neige6, Neige7, Neige8, Verglas1, Verglas2, Verglas3, Verglas4, Verglas5, Verglas6, Verglas7, Verglas8, Vitesse1, Dir1, Vitesse2, Dir2, Vitesse3, Dir3, Vitesse4, Dir4, Vitesse5, Dir5, Vitesse6, Dir6, Vitesse7, Dir7, Vitesse8, Dir8, UV1, UV2, UV3, UV4, UV5, UV6, UV7, UV8, CouvNuage1, CouvNuage2, CouvNuage3, CouvNuage4, CouvNuage5, CouvNuage6, CouvNuage7, CouvNuage8, Rosee1, Rosee2, Rosee3, Rosee4, Rosee5, Rosee6, Rosee7, Rosee8, h, Dbg
	
	f=assert(io.popen("curl --max-time 60 --retry 3 --silent '"..web.."' | grep -A202 'hourly\"' | sed 's/%//g'"))
	line=f:read()
	i=0
	for line in f:lines() do
		i=i+1
		--Récup. des heures
		if i==8 then
			heure1=line:match("/>(%d*)</")
		elseif i==9 then
			heure2=line:match(">(%d*)</")
		elseif i==10 then
			heure3=line:match(">(%d*)</")
		elseif i==11 then
			heure4=line:match(">(%d*)</")
		elseif i==12 then
			heure5=line:match(">(%d*)</")
		elseif i==13 then
			heure6=line:match(">(%d*)</")
		elseif i==14 then
			heure7=line:match(">(%d*)</")
		elseif i==15 then
			heure8=line:match(">(%d*)</")
		--Récup. des icones
		elseif i==34 then
			icone1=line:match("i%p(%a*)\">")
		elseif i==37 then
			icone2=line:match("i%p(%a*)\">")
		elseif i==40 then
			icone3=line:match("i%p(%a*)\">")
		elseif i==43 then
			icone4=line:match("i%p(%a*)\">")
		elseif i==46 then
			icone5=line:match("i%p(%a*)\">")
		elseif i==49 then
			icone6=line:match("i%p(%a*)\">")
		elseif i==52 then
			icone7=line:match("i%p(%a*)\">")
		elseif i==55 then
			icone8=line:match("i%p(%a*)\">")
		--Températures
		elseif i==60 then
			Temp1=line:match(">([%p%d]*)&")
		elseif i==61 then
			Temp2=line:match(">([%p%d]*)&")
		elseif i==62 then
			Temp3=line:match(">([%p%d]*)&")
		elseif i==63 then
			Temp4=line:match(">([%p%d]*)&")
		elseif i==64 then
			Temp5=line:match(">([%p%d]*)&")
		elseif i==65 then
			Temp6=line:match(">([%p%d]*)&")
		elseif i==66 then
			Temp7=line:match(">([%p%d]*)&")
		elseif i==67 then
			Temp8=line:match(">([%p%d]*)&")
		--Températures ressentie
		elseif i==71 then
			TempR1=line:match(">([%p%d]*)&")
		elseif i==72 then
			TempR2=line:match(">([%p%d]*)&")
		elseif i==73 then
			TempR3=line:match(">([%p%d]*)&")
		elseif i==74 then
			TempR4=line:match(">([%p%d]*)&")
		elseif i==75 then
			TempR5=line:match(">([%p%d]*)&")
		elseif i==76 then
			TempR6=line:match(">([%p%d]*)&")
		elseif i==77 then
			TempR7=line:match(">([%p%d]*)&")
		elseif i==78 then
			TempR8=line:match(">([%p%d]*)&")
		--Humidité
		elseif i==82 then
			Humi1=line:match(">(%d*)<")
		elseif i==83 then
			Humi2=line:match(">(%d*)<")
		elseif i==84 then
			Humi3=line:match(">(%d*)<")
		elseif i==85 then
			Humi4=line:match(">(%d*)<")
		elseif i==86 then
			Humi5=line:match(">(%d*)<")
		elseif i==87 then
			Humi6=line:match(">(%d*)<")
		elseif i==88 then
			Humi7=line:match(">(%d*)<")
		elseif i==89 then
			Humi8=line:match(">(%d*)<")
		--Pluie
		elseif i==109 then
			Pluie1=line:match("v>(%d*)<")
		elseif i==110 then
			Pluie2=line:match("v>(%d*)<")
		elseif i==111 then
			Pluie3=line:match("v>(%d*)<")
		elseif i==112 then
			Pluie4=line:match("v>(%d*)<")
		elseif i==113 then
			Pluie5=line:match("v>(%d*)<")
		elseif i==114 then
			Pluie6=line:match("v>(%d*)<")
		elseif i==115 then
			Pluie7=line:match("v>(%d*)<")
		elseif i==116 then
			Pluie8=line:match("v>(%d*)<")
		--Neige
		elseif i==120 then
			Neige1=line:match("v>(%d*)<")
		elseif i==121 then
			Neige2=line:match("v>(%d*)<")
		elseif i==122 then
			Neige3=line:match("v>(%d*)<")
		elseif i==123 then
			Neige4=line:match("v>(%d*)<")
		elseif i==124 then
			Neige5=line:match("v>(%d*)<")
		elseif i==125 then
			Neige6=line:match("v>(%d*)<")
		elseif i==126 then
			Neige7=line:match("v>(%d*)<")
		elseif i==127 then
			Neige8=line:match("v>(%d*)<")
		--Verglas
		elseif i==131 then
			Verglas1=line:match("v>(%d*)<")
		elseif i==132 then
			Verglas2=line:match("v>(%d*)<")
		elseif i==133 then
			Verglas3=line:match("v>(%d*)<")
		elseif i==134 then
			Verglas4=line:match("v>(%d*)<")
		elseif i==135 then
			Verglas5=line:match("v>(%d*)<")
		elseif i==136 then
			Verglas6=line:match("v>(%d*)<")
		elseif i==137 then
			Verglas7=line:match("v>(%d*)<")
		elseif i==138 then
			Verglas8=line:match("v>(%d*)<")
		--Vent
		elseif i==159 then
			Vitesse1, Dir1=line:gsub("W","O"):match(">(%d*)%s(%a*)<")
			VentP1=vent_plein(Dir1)
		elseif i==160 then
			Vitesse2, Dir2=line:gsub("W","O"):match(">(%d*)%s(%a*)<")
			VentP2=vent_plein(Dir2)
		elseif i==161 then
			Vitesse3, Dir3=line:gsub("W","O"):match(">(%d*)%s(%a*)<")
			VentP3=vent_plein(Dir3)
		elseif i==162 then
			Vitesse4, Dir4=line:gsub("W","O"):match(">(%d*)%s(%a*)<")
			VentP4=vent_plein(Dir4)
		elseif i==163 then
			Vitesse5, Dir5=line:gsub("W","O"):match(">(%d*)%s(%a*)<")
			VentP5=vent_plein(Dir5)
		elseif i==164 then
			Vitesse6, Dir6=line:gsub("W","O"):match(">(%d*)%s(%a*)<")
			VentP6=vent_plein(Dir6)
		elseif i==165 then
			Vitesse7, Dir7=line:gsub("W","O"):match(">(%d*)%s(%a*)<")
			VentP7=vent_plein(Dir7)
		elseif i==166 then
			Vitesse8, Dir8=line:gsub("W","O"):match(">(%d*)%s(%a*)<")
			VentP8=vent_plein(Dir8)
		--Uv
		elseif i==170 then
			UV1=line:match(">(%d*)<")
		elseif i==171 then
			UV2=line:match(">(%d*)<")
		elseif i==172 then
			UV3=line:match(">(%d*)<")
		elseif i==173 then
			UV4=line:match(">(%d*)<")
		elseif i==174 then
			UV5=line:match(">(%d*)<")
		elseif i==175 then
			UV6=line:match(">(%d*)<")
		elseif i==176 then
			UV7=line:match(">(%d*)<")
		elseif i==177 then
			UV8=line:match(">(%d*)<")
		--Couverture nuageuse
		elseif i==181 then
			CouvNuage1=line:match(">(%d*)<")
		elseif i==182 then
			CouvNuage2=line:match(">(%d*)<")
		elseif i==183 then
			CouvNuage3=line:match(">(%d*)<")
		elseif i==184 then
			CouvNuage4=line:match(">(%d*)<")
		elseif i==185 then
			CouvNuage5=line:match(">(%d*)<")
		elseif i==186 then
			CouvNuage6=line:match(">(%d*)<")
		elseif i==187 then
			CouvNuage7=line:match(">(%d*)<")
		elseif i==188 then
			CouvNuage8=line:match(">(%d*)<")
		--Point de rosée
		elseif i==192 then
			Rosee1=line:match(">([%p%d]*)&")
		elseif i==193 then
			Rosee2=line:match(">([%p%d]*)&")
		elseif i==194 then
			Rosee3=line:match(">([%p%d]*)&")
		elseif i==195 then
			Rosee4=line:match(">([%p%d]*)&")
		elseif i==196 then
			Rosee5=line:match(">([%p%d]*)&")
		elseif i==197 then
			Rosee6=line:match(">([%p%d]*)&")
		elseif i==198 then
			Rosee7=line:match(">([%p%d]*)&")
		elseif i==199 then
			Rosee8=line:match(">([%p%d]*)&")
		end
	end
	f:close()

	huitHeures[1] = {Heure=heure1, Icone=icone1, TempMax=Temp1, TempMaxR=TempR1, VentDir=Dir1, VentForce=Vitesse1, Humidite=Humi1, CouvNuage=CouvNuage1, PointRosee=Rosee1, UV=UV1, Pluie=Pluie1, Neige=Neige1, Verglas=Verglas1, VentP=VentP1}
	huitHeures[2] = {Heure=heure2, Icone=icone2, TempMax=Temp2, TempMaxR=TempR2, VentDir=Dir2, VentForce=Vitesse2, Humidite=Humi2, CouvNuage=CouvNuage2, PointRosee=Rosee2, UV=UV2, Pluie=Pluie2, Neige=Neige2, Verglas=Verglas2, VentP=VentP2}
	huitHeures[3] = {Heure=heure3, Icone=icone3, TempMax=Temp3, TempMaxR=TempR3, VentDir=Dir3, VentForce=Vitesse3, Humidite=Humi3, CouvNuage=CouvNuage3, PointRosee=Rosee3, UV=UV3, Pluie=Pluie3, Neige=Neige3, Verglas=Verglas3, VentP=VentP3}
	huitHeures[4] = {Heure=heure4, Icone=icone4, TempMax=Temp4, TempMaxR=TempR4, VentDir=Dir4, VentForce=Vitesse4, Humidite=Humi4, CouvNuage=CouvNuage4, PointRosee=Rosee4, UV=UV4, Pluie=Pluie4, Neige=Neige4, Verglas=Verglas4, VentP=VentP4}
	huitHeures[5] = {Heure=heure5, Icone=icone5, TempMax=Temp5, TempMaxR=TempR5, VentDir=Dir5, VentForce=Vitesse5, Humidite=Humi5, CouvNuage=CouvNuage5, PointRosee=Rosee5, UV=UV5, Pluie=Pluie5, Neige=Neige5, Verglas=Verglas5, VentP=VentP5}
	huitHeures[6] = {Heure=heure6, Icone=icone6, TempMax=Temp6, TempMaxR=TempR6, VentDir=Dir6, VentForce=Vitesse6, Humidite=Humi6, CouvNuage=CouvNuage6, PointRosee=Rosee6, UV=UV6, Pluie=Pluie6, Neige=Neige6, Verglas=Verglas6, VentP=VentP6}
	huitHeures[7] = {Heure=heure7, Icone=icone7, TempMax=Temp7, TempMaxR=TempR7, VentDir=Dir7, VentForce=Vitesse7, Humidite=Humi7, CouvNuage=CouvNuage7, PointRosee=Rosee7, UV=UV7, Pluie=Pluie7, Neige=Neige7, Verglas=Verglas7, VentP=VentP7}
	huitHeures[8] = {Heure=heure8, Icone=icone8, TempMax=Temp8, TempMaxR=TempR8, VentDir=Dir8, VentForce=Vitesse8, Humidite=Humi8, CouvNuage=CouvNuage8, PointRosee=Rosee8, UV=UV8, Pluie=Pluie8, Neige=Neige8, Verglas=Verglas8, VentP=VentP8}
	
	local t = {"VentP", "Heure", "Icone", "TempMax", "TempMaxR", "VentDir", "VentForce", "Humidite", "CouvNuage", "PointRosee", "UV", "Pluie", "Neige", "Verglas"}
	for j = 1, 8 do
		local donee = {}
		donee = huitHeures[j]
		for i = 1,13 do
			if donee[t[i]] == nil then
				local file = assert(io.open(repsauv.."/Debug", "a+"))
				file:write ("\n", Debug,"huitHeures ", t[i]," jour n° ", j)
				donee[t[i]]="N/A"
			end
		end
		huitHeures[j] = donee
	end


	for h = 1,8 do
		if huitHeures[h].VentDir == "CLM" then
			huitHeures[h].VentDir = "Calme"
			huitHeures[h].VentForce = "0"
		end
		huitHeures[h].VentIcone = icone_vent(direction_vent(huitHeures[h].VentDir), huitHeures[h].VentForce)
		huitHeures[h].VentP = vent_plein(huitHeures[h].VentDir)
	end

end
--Traitement information Quart de journée
function Prevision_Quart_T(web)
	local f, i, line, icone, cond, Tmax, Tmin, Tmaxres, Tminres, dirvent, forcevent, Precipitationpourcent, Pluie, Neige, Humidite,Couverture, Pointrosee, Visibilite, Dbg

	f=assert(io.popen("curl --max-time 60 --retry 3 --silent '"..web.."' | grep -A50 '/#detail-' | sed 's/%//g'"))
	line=f:read()
	i=0
	for line in f:lines() do
		i=i+1
		if i==4 then
			icone=line:match("icon i%p(%a*)\">")
		elseif i==5 then
			cond=line:formatage():match("cond\">([%a%p%s"..pat.."]*)</")
		elseif i==6 then
			Tmax=line:match(">([%p%d]*)<s")
		elseif i==7 then
			Tmin=line:match("lo\">%a*%s([%p%d]*)<s")
		elseif i==10 then
			Tmaxres, Tminres=line:formatage():match("&#174; ([%p%d]*) / ([%p%d]*)</")
		elseif i==27 then
			dirvent=line:gsub("W","O"):match("'(%a*)'")
		elseif i==28 then
			forcevent=line:match("'(%d*)[%a%p]*'")
		elseif i==38 then
			Precipitationpourcent=line:match(">(%d*)</")
		elseif i==39 then
			Pluie=line:match(">(%d*) %a*</")
		elseif i==40 then
			Neige=line:match(">(%d*) %a*</")
		elseif i==41 then
			Humidite=line:match(">(%d*)</")
		elseif i==42 then
			Couverture=line:match(">(%d*)</")
		elseif i==43 then
			Pointrosee=line:match(">([%p%d]*)&#")
		elseif i==44 then
			Visibilite=line:match(">(%d*) %a*</")
		end
	end
	f:close()
	

	return {Icone=icone, CondMeteo=cond, TempMax=Tmax, TempMin=Tmin, TempMaxR=Tmaxres, TempMinR=Tminres, VentDir=dirvent, VentForce=forcevent, Humidite=Humidite, CouvNuage=Couverture, PointRosee=Pointrosee, ProbPrec=Precipitationpourcent, Visibilite=Visibilite, QNeige=Neige, QPluie=Pluie}
end


--Prévision
function prevision(web)
	local f, i, line, iconej, Tmax, Tmaxr, ProbPrecj, Vdirj, Vforcej, Vrafalesj, Descriptifj, UV, ProbOragesj, Precj, Pluiej, Neigej, Verglasj, iconen, Tmin, Tminr, ProbPrecn, Vdirn, Vforcen, Vrafalesn, Descriptifn, UVn, ProbOragesn, Precn, Pluien, Neigen, Verglasn, jour,mois, annee, AujoudhuiMax, NormaleMax, RecordMax, Histo_Max, AujoudhuiMin, NormaleMin, RecordMin, Histo_Min,  LeverSoleil, LeverSoleilH, LeverSoleilM, Culmine, CulmineH, CulmineM, CoucherSoleil, CoucherSoleilH, CoucherSoleilM, Datej

	f=assert(io.popen("curl --max-time 60 --retry 3 --silent '"..web.."' | sed 's/%//g' | grep -A193 '/#detail-'"))
	line=f:read()
	i=0
	for line in f:lines() do
		i=i+1
		--jour
		if i==5 then
			iconej=line:match("icon i%p(%a*)\">")
		elseif i==6 then
			Tmax=line:match("temp\">([%p%d]*)<")
		elseif i==7 then
			Tmaxr=line:match("174; ([%p%d]*)&#")
		elseif i==8 then
			ProbPrecj=line:match("feel[%a%p%d]* (%d*)</")
		elseif i==40 then
			Vdirj, Vforcej=line:gsub("W","O"):match(">(%a*) (%d*) [%a%p]*<")
		elseif i==43 then
			Vrafalesj=line:match("> (%d*) [%a%p]*<")
		elseif i==47 then
			Descriptifj=line:formatage():gsub(";",""):match("<p>([%a%p%s"..pat.."]*)</p>")
		elseif i==51 then
			UV=line:match("g>(%d*)</s")
		elseif i==52 then
			ProbOragesj=line:match(">(%d*)</s")
		elseif i==53 then
			Precj=line:match(">(%d*) %a*</s")
		elseif i==54 then
			Pluiej=line:match(">(%d*) %a*</s")
		elseif i==55 then
			Neigej=line:match(">(%d*) %a*</s")
		elseif i==56 then
			Verglasj=line:match(">(%d*) %a*</s")
		--nuit
		elseif i==65 then
			iconen=line:match("icon i%p(%a*)\">")
		elseif i==66 then
			Tmin=line:match("temp\">([%p%d]*)<")
		elseif i==67 then
			Tminr=line:match("174; ([%p%d]*)&#")
		elseif i==68 then
			ProbPrecn=line:match("feel[%a%p%d]* (%d*)</")
		elseif i==101 then
			Vdirn, Vforcen=line:gsub("W","O"):match(">(%a*) (%d*) [%a%p]*<")
		elseif i==104 then
			Vrafalesn=line:match("> (%d*) [%a%p]*<")
		elseif i==108 then
			Descriptifn=line:formatage():gsub(";",""):match("<p>([%a%p%s"..pat.."]*)</p>")
		elseif i==112 then
			UVn=line:match("g>([%a%p%d]*)</s")
		elseif i==113 then
			ProbOragesn=line:match(">(%d*)</s")
		elseif i==114 then
			Precn=line:match(">(%d*) %a*</s")
		elseif i==115 then
			Pluien=line:match(">(%d*) %a*</s")
		elseif i==116 then
			Neigen=line:match(">(%d*) %a*</s")
		elseif i==117 then
			Verglasn=line:match(">(%d*) %a*</s")
		--historique
		elseif i==133 then
			jour,mois,annee=line:match("- (%d*)/(%d*)/(%d*)</")
		elseif i==151 then
			AujoudhuiMax=line:formatage():match(">([%d%a%p]*)</")
		elseif i==153 then
			NormaleMax=line:formatage():match(">([%d%a%p]*)</")
		elseif i==155 then
			RecordMax=line:formatage():match(">([%d%a%p]*)</")
		elseif i==157 then
			Histo_Max=line:formatage():match(">([%d%a%p]*)</")
		elseif i==162 then
			AujoudhuiMin=line:formatage():match(">([%d%a%p]*)</")
		elseif i==164 then
			NormaleMin=line:formatage():match(">([%d%a%p]*)</")
		elseif i==166 then
			RecordMin=line:formatage():match(">([%d%a%p]*)</")
		elseif i==168 then
			Histo_Min=line:formatage():match(">([%d%a%p]*)</")
		--Lever coucher soleil
		elseif i==185 then
			LeverSoleil,LeverSoleilH,LeverSoleilM=line:match(">((%d*):(%d*))<")
		elseif i==188 then
			Culmine, CulmineH, CulmineM=line:match(">((%d*):(%d*))<")
		elseif i==191 then
			CoucherSoleil,CoucherSoleilH,CoucherSoleilM=line:match(">((%d*):(%d*))<")
		end
	end
	f:close()

	Datej = os.time{year=annee, month=mois, day=jour, hour=0}

	return { Icone=iconej, CondMeteo=Descriptifj, Temp=Tmax, TempRes=Tmaxr, ProbPrec=ProbPrecj, VentDir=Vdirj, VentForce=Vforcej, VentRafales=Vrafalesj, Uv=UV, ProbOrage=ProbOragesj, NivPrec=Precj, QPluie=Pluiej, QNeige=Neigej, EVerglas=Verglasj }, { Icone=iconen, CondMeteo=Descriptifn, Temp=Tmin, TempRes=Tminr, ProbPrec=ProbPrecn, VentDir=Vdirn, VentForce=Vforcen, VentRafales=Vrafalesn, ProbOrage=ProbOragesn, NivPrec=Precn, QPluie=Pluien, QNeige=Neigen, EVerglas=Verglasn }, { Jour=Datej, LeverSoleil=LeverSoleil, LeverSoleilH=LeverSoleilH, LeverSoleilM=LeverSoleilM, CoucherSoleil=CoucherSoleil, CoucherSoleilH=CoucherSoleilH, CoucherSoleilM=CoucherSoleilM, Histo_Max=Histo_Max, Histo_Min=Histo_Min }

end


--Infos condition courante
function current(web)
	local f, i, line, ville, lat, lon, icone, cur, temp, tempres, directvent, vitessevent, Humidite, Pression, Couvnuageuse, UV, Pointderosee, Precipitations, Visibilite, jour, mois, annee, Date, Dbg

	f=assert(io.popen("curl --max-time 60 --retry 3 --silent '"..web.."' | sed -e 's/%//g' -e '/var apgWxInfoObj/,/\"detail-now\"/d' | grep -A60 'meta'"))
	line=f:read()
	i=0
	for line in f:lines() do
		i=i+1
		if i==2 then
			ville,lat,lon=line:match("city: '([%w%s%-]*)'[%s%w%p]*lat: '([%d%p]*)'[%s%w%p]*lon: '([%d%p]*)'")
		elseif i==5 then
			icone=line:match("icon i%p(%a*)\">")
		elseif i==6 then
			cur, temp, tempres=line:formatage():match("cond\">([%a%p%s"..pat.."]*)</[%a%p%s]*temp\">([%p%d]*)<s[%w%p%s]*; ([%p%d]*)<s")
		elseif i==22 then
			directvent=line:gsub("W","O"):match("'(%a*)'")
		elseif i==23 then
			vitessevent=line:match("'(%d*)[%a%p]*'")
		elseif i==34 then
			Humidite=line:match("g>(%d*)</s")
		elseif i==35 then
			Pression=line:match("g>(%d*).")
		elseif i==36 then
			Couvnuageuse=line:match("g>(%d*)</s")
		elseif i==37 then
			UV=line:match("g>(%d*)</s")
		elseif i==38 then
			Pointderosee=line:match("g>([%p%d]*)&#176")
		elseif i==39 then
			Precipitations=line:formatage():match("g>(%d*) ")
		elseif i==40 then
			Visibilite=line:match("g>(%d*) ")
		elseif i==57 then
			jour, mois, annee=line:match(">[%a%d%p%s]* (%d*)/(%d*)/(%d*)<")
		end
	end
	f:close()

	Date = os.time{year=annee, month=mois, day=jour, hour=0}

	return {Icone=icone, Cond=cur, Temp=temp, Tempr=tempres, VentDir=directvent, VentForce=vitessevent, Humidite=Humidite, Pression=Pression, CouvNuage=Couvnuageuse, Uv=UV, PointRosee=Pointderosee, QPrec=Precipitations, Visibilite=Visibilite, Date=Date, Ville=ville, latitude=lat, longitude=lon}

end


--Infos lunaison
function lunaison(r)
	local s, web, Lune
	
	web="http://www.calendrier-lunaire.net/"

	f=assert(io.popen("curl --max-time 60 --retry 3 --silent '"..web.."' | grep -A53 'ephemerides\"' | sed 's/%//g'"))
	line=f:read()
	i=0
	for line in f:lines() do
		i=i+1
		if i==3 then
			icone=line:match("src=\"([%w%p]*)\"")
		elseif i==7 then
			ephemerides1, ephemerides2=line:formatage():match(">(%a*)</span> (%a*)<")
		elseif i==11 then
			Visibilite=line:match("\">([%d%p]*) <")
		elseif i==12 then
			Phases, Phases1, Phases2=line:formatage():match("\">(([%a%p%d"..pat.."]*),%s*([%a%p%d"..pat.."]*))</s")
		elseif i==13 then
			Noeud_lunaire=line:match("\">([%a%d%p%s]*)</s")
		elseif i==14 then
			Apogee=line:match("\">([%a%d%p%s]*)</s")
		elseif i==15 then
			Perigee=line:match("\">([%a%d%p%s]*)</s")
		elseif i==16 then
			Distance=line:match("\">(%d*) %a*</s")
		elseif i==18 then
			Age=line:match("\">([%a%d%s]*)</")
		elseif i==19 then
			Lever_LuneHeure, Lever_LuneMinute, Coucher_LuneHeure, Coucher_LuneMinute=line:match("\">([%d%p]*):([%d%p]*)</span>[%a%p%s]*;\">([%d%p]*):([%d%p]*)</")
		elseif i==48 then
			Eclipse_partielle=line:match("\">([%w%s]* <br /> [%d%p]*)</a>")
		elseif i==49 then
			Eclipse_total=line:match("\">([%w%s]* <br /> [%d%p]*)</a>")
		end
	end
	f:close()	if Noeud_lunaire:match("(%d+)") ~= nil then Noeud_lunaire = Noeud_lunaire:match("(%d+)") end

	if Apogee:match("(%d+)") ~= nil then Apogee = Apogee:match("(%d+)") end
	if Perigee:match("(%d+)") ~= nil then Perigee = Perigee:match("(%d+)") end
	ephemerides = ephemerides1.." "..ephemerides2	
	Eclipse_partielle = datelune(Eclipse_partielle)
	Eclipse_total = datelune(Eclipse_total)
	s = "${exec wget --tries=3 -q -O "..r.."/lune.png http://www.calendrier-lunaire.net/"..icone.."}"
	conky_parse( s )
	conky_parse( "${exec convert "..r.."/lune.png -transparent '#091a2a' "..r.."/lune.png}" )

end

function datelune(d)
	local j, m, a, h, min = d:gsub("Janvier", "01"):gsub("Février", "02"):gsub("Mars", "03"):gsub("Avril", "04"):gsub("Mais", "05"):gsub("Juin", "06"):gsub("Juillet", "07"):gsub("Août", "08"):gsub("septembre", "09"):gsub("Octobre", "10"):gsub("Novembre", "11"):gsub("Décembre", "12"):match("(%d+) (%d+) (%d+) <br /> (%d+):(%d+)")
	d = os.time{year=a, month=m, day=j, hour=h, min=min}

	return d
	
end


--Détermine icône vent
function direction_vent(i)

	if i == "Calme" then
		return 0
	elseif i == "N" then
		return 10
	elseif i == "NNE" then
		return 11
	elseif i == "NE" then
		return 12
	elseif i == "ENE" then
		return 13
	elseif i == "E" then
		return 14
	elseif i == "ESE" then
		return 15
	elseif i == "SE" then
		return 16
	elseif i == "SSE" then
		return 17
	elseif i == "S" then
		return 2
	elseif i == "SSO" then
		return 3
	elseif i == "SO" then
		return 4
	elseif i == "OSO" then
		return 5
	elseif i == "O" then
		return 6
	elseif i == "ONO" then
		return 7
	elseif i == "NO" then
		return 8
	elseif i == "NNO" then
		return 9
	else
		return 1
	end

end


--Renvoi vent direction pleine en toute lettre
function vent_plein(d)

	local b

	if string.len(d) == 1 then
		if string.find(d, "N") ~= nil then 
			b = string.gsub(d, "N", "Nord") 
		elseif string.find(d, "S") ~= nil then 
			b = string.gsub(d, "S", "Sud") 
		elseif string.find(d, "E") ~= nil then
			b = string.gsub(d, "E", "Est") 
		elseif string.find(d, "O") ~= nil then
			b = string.gsub(d, "O", "Ouest")
		end
	else
		b = d
	end

	return b

end


--Détermine l'icône vent en tenant conte de la force du vent
function icone_vent(d, fo)

	local f = tonumber(fo)
	local n

	if f <= Palier then
		n = d
	elseif f <= Palier*2 then
		n = d + 17
	elseif f <= Palier*3 then
		n = d + 34
	elseif f >= (Palier*3)+1 then
		n = d + 51
	end

	if n <= 9 then 
		n = "0"..n
	end

	return n..".png"

end


--Découpage descriptions sur deux lignes
function decoupage(d)

	local l1, l2, n, p1, p2, n1, n2, l1b, l2b, dm, dp
	if string.len(d) >= 22 then
		n = math.ceil(string.len(d)/2)
		dm = string.sub(d, 1, n)
		dp = string.sub(d, n)
		p1 = string.find(dp, " ")
		local b = 1
		p2 = nil
		if string.find(dm, ' ') then
			while p2 == nil do
				b = b+1
				p2 = string.find(dm, ' ', -b)
			end
		end
		if p1 ~= nil then p1 = n+p1-1 end
		
		if p1 == nil and p2 == nil then p1 = string.find(d, " ") end
		if p2 == nil then p2 = p1 end
		if p1 == nil then p1 = p2 end
		if p1-n >= n-p2 then
			l1b = string.sub(d, 1, p2-1)
			l2b = string.sub(d, p2+1)
		else
			l1b = string.sub(d, 1, p1-1)
			l2b = string.sub(d, p1+1)
		end
	else
		l1b = d
		l2b = " "
	end
	n1 = math.ceil((22 - string.len(l1b))/2)
	l1 = string.rep(" ", n1)..l1b 
	n2 = math.ceil((22 - string.len(l2b))/2)
	l2 = string.rep(" ", n2)..l2b 

--Retour information avec espaces ligne 1 & 2 et sans espaces ligne 1 & 2
	return l1, l2, l1b, l2b

end


--Information Matin
function Prevision_Matin(a, j, x)
	local i = j+x
	conditionMatin[j] = Prevision_Quart_T(a..'?day='..i)
	
	local t = {"Icone", "CondMeteo", "TempMax", "TempMin", "TempMaxR", "TempMinR", "VentDir", "VentForce", "Humidite", "CouvNuage", "PointRosee", "ProbPrec", "Visibilite", "QNeige", "QPluie"}
		
	local donee = {}
	donee = conditionMatin[j]
	for i = 1,15 do
		if donee[t[i]] == nil then
			local file = assert(io.open(repsauv.."/Debug", "a+"))
			file:write ("\n", Debug, "conditionMatin ", t[i]," jour n° ", j)
			donee[t[i]]="N/A"
		end
	end
	conditionMatin[j]=donee
	
	if conditionMatin[j].VentDir == "CLM" then
		conditionMatin[j].VentDir = "Calme"
		conditionMatin[j].VentForce = "0"
	end
	conditionMatin[j].VentIcone = icone_vent(direction_vent(conditionMatin[j].VentDir), conditionMatin[j].VentForce)
	conditionMatin[j].VentP = vent_plein(conditionMatin[j].VentDir)
	conditionMatin[j].CondMeteo1, conditionMatin[j].CondMeteo2, conditionMatin[j].CondMeteo1se, conditionMatin[j].CondMeteo2se = decoupage(conditionMatin[j].CondMeteo)
	print("Matin "..j.." Ok")
end


--Information Après-midi
function Prevision_AM(a, j, x)
	local i = j+x
	conditionAM[j] = Prevision_Quart_T(a..'?day='..i)
	
	local t = {"Icone", "CondMeteo", "TempMax", "TempMin", "TempMaxR", "TempMinR", "VentDir", "VentForce", "Humidite", "CouvNuage", "PointRosee", "ProbPrec", "Visibilite", "QNeige", "QPluie"}
		
	local donee = {}
	donee = conditionAM[j]
	for i = 1,15 do
		if donee[t[i]] == nil then
			local file = assert(io.open(repsauv.."/Debug", "a+"))
			file:write ("\n", Debug, "conditionAM ", t[i]," jour n° ", j)
			donee[t[i]]="N/A"
		end
	end
	conditionAM[j]=donee

	if conditionAM[j].VentDir == "CLM" then
		conditionAM[j].VentDir = "Calme"
		conditionAM[j].VentForce = "0"
	end
	conditionAM[j].VentIcone = icone_vent(direction_vent(conditionAM[j].VentDir), conditionAM[j].VentForce)
	conditionAM[j].VentP = vent_plein(conditionAM[j].VentDir)
	conditionAM[j].CondMeteo1, conditionAM[j].CondMeteo2, conditionAM[j].CondMeteo1se, conditionAM[j].CondMeteo2se = decoupage(conditionAM[j].CondMeteo)
	print("Apres Midi "..j.." Ok")
end


--Information Soirée
function Prevision_Soiree(a, j, x)
	local i = j+x
	conditionSoiree[j] = Prevision_Quart_T(a..'?day='..i)
	
	local t = {"Icone", "CondMeteo", "TempMax", "TempMin", "TempMaxR", "TempMinR", "VentDir", "VentForce", "Humidite", "CouvNuage", "PointRosee", "ProbPrec", "Visibilite", "QNeige", "QPluie"}
		
	local donee = {}
	donee = conditionSoiree[j]
	for i = 1,15 do
		if donee[t[i]] == nil then
			local file = assert(io.open(repsauv.."/Debug", "a+"))
			file:write ("\n", Debug, "conditionSoiree ", t[i]," jour n° ", j)
			donee[t[i]]="N/A"
		end
	end
	conditionSoiree[j]=donee

	if conditionSoiree[j].VentDir == "CLM" then
		conditionSoiree[j].VentDir = "Calme"
		conditionSoiree[j].VentForce = "0"
	end
	conditionSoiree[j].VentIcone = icone_vent(direction_vent(conditionSoiree[j].VentDir), conditionSoiree[j].VentForce)
	conditionSoiree[j].VentP = vent_plein(conditionSoiree[j].VentDir)
	conditionSoiree[j].CondMeteo1, conditionSoiree[j].CondMeteo2, conditionSoiree[j].CondMeteo1se, conditionSoiree[j].CondMeteo2se = decoupage(conditionSoiree[j].CondMeteo)
	print("Soiree "..j.." Ok")
end


--Information Nuit
function Prevision_Nuit(a, j, x)
	local i = j+x
	conditionNoct[j] = Prevision_Quart_T(a..'?day='..i)
	
	local t = {"Icone", "CondMeteo", "TempMax", "TempMin", "TempMaxR", "TempMinR", "VentDir", "VentForce", "Humidite", "CouvNuage", "PointRosee", "ProbPrec", "Visibilite", "QNeige", "QPluie"}
		
	local donee = {}
	donee = conditionNoct[j]
	for i = 1,15 do
		if donee[t[i]] == nil then
			local file = assert(io.open(repsauv.."/Debug", "a+"))
			file:write ("\n", Debug, "conditionNoct ", t[i]," jour n° ", j)
			donee[t[i]]="N/A"
		end
	end
	conditionNoct[j]=donee

	if conditionNoct[j].VentDir == "CLM" then
		conditionNoct[j].VentDir = "Calme"
		conditionNoct[j].VentForce = "0"
	end
	conditionNoct[j].VentIcone = icone_vent(direction_vent(conditionNoct[j].VentDir), conditionNoct[j].VentForce)
	conditionNoct[j].VentP = vent_plein(conditionNoct[j].VentDir)
	conditionNoct[j].CondMeteo1, conditionNoct[j].CondMeteo2, conditionNoct[j].CondMeteo1se, conditionNoct[j].CondMeteo2se = decoupage(conditionNoct[j].CondMeteo)
	print("Nuit "..j.." Ok")
end

--Information Huit heures
function Prevision_Huit_Heures(a)
	Huit_Heures(a)
	
	
	print("Huit prochaines heures Ok")

end 

--Traitement infos prévisions (15 jours max) jour 1 = aujourd'hui
function jour_n(a, j, x)

	local i = j+x
	conditionJour[j], conditionNuit[j], InfoJour[j] = prevision(a..'?day='..i)

	local t = { "Icone", "CondMeteo", "Temp", "TempRes", "ProbPrec", "VentDir", "VentForce", "VentRafales", "Uv", "ProbOrage", "NivPrec", "QPluie", "QNeige", "EVerglas" }
	local donee = {}
	donee = conditionJour[j]
	for i = 1,14 do
		if donee[t[i]] == nil then
			local file = assert(io.open(repsauv.."/Debug", "a+"))
			file:write ("\n", Debug, "conditionJour ", t[i]," jour n° ", j)
			donee[t[i]]="N/A"
		end
	end
	conditionJour[j]=donee
	
	local t = { "Icone", "CondMeteo", "Temp", "TempRes", "ProbPrec", "VentDir", "VentForce", "VentRafales", "ProbOrage", "NivPrec", "QPluie", "QNeige", "EVerglas" }
	donee = conditionNuit[j]
	for i = 1,13 do
		if donee[t[i]] == nil then
			local file = assert(io.open(repsauv.."/Debug", "a+"))
			file:write ("\n", Debug, "conditionNuit ", t[i]," jour n° ", j)
			donee[t[i]]="N/A"
		end
	end
	conditionNuit[j]=donee
	
	local t = { "Jour", "LeverSoleil", "LeverSoleilH", "LeverSoleilM", "CoucherSoleil", "CoucherSoleilH", "CoucherSoleilM", "Histo_Max", "Histo_Min" }
	donee = InfoJour[j]
	for i = 1,9 do
		if donee[t[i]] == nil then
			local file = assert(io.open(repsauv.."/Debug", "a+"))
			file:write ("\n", Debug, "InfoJour ", t[i]," jour n° ", j)
			donee[t[i]]="N/A"
		end
	end
	InfoJour[j]=donee

	if conditionJour[j].VentDir == "CLM" then
		conditionJour[j].VentDir = "Calme"
		conditionJour[j].VentForce = "0"
	end
	conditionJour[j].VentIcone = icone_vent(direction_vent(conditionJour[j].VentDir), conditionJour[j].VentForce)
	conditionJour[j].RafalesIcone = icone_vent(direction_vent(conditionJour[j].VentDir), conditionJour[j].VentRafales)
	conditionJour[j].VentP = vent_plein(conditionJour[j].VentDir)
	conditionJour[j].CondMeteo1, conditionJour[j].CondMeteo2, conditionJour[j].CondMeteo1se, conditionJour[j].CondMeteo2se = decoupage(conditionJour[j].CondMeteo)

	if conditionNuit[j].VentDir == "Calme" then
		conditionNuit[j].VentForce = "0"
	end
	conditionNuit[j].VentIcone = icone_vent(direction_vent(conditionNuit[j].VentDir), conditionNuit[j].VentForce)
	conditionNuit[j].RafalesIcone = icone_vent(direction_vent(conditionNuit[j].VentDir), conditionNuit[j].VentRafales)
	conditionNuit[j].VentP = vent_plein(conditionNuit[j].VentDir)
	conditionNuit[j].CondMeteo1, conditionNuit[j].CondMeteo2, conditionNuit[j].CondMeteo1se, conditionNuit[j].CondMeteo2se = decoupage(conditionNuit[j].CondMeteo)
	print("Prévision "..j.." Ok")

end

--initialisation paramètres
function conky_init(cfg)

	local cmd1, pos1
	local home = os.getenv("HOME")
	cfg = string.gsub(cfg, "~", home)
	cfg = string.gsub(cfg, "$HOME", home)
	fichier_init = cfg
	
	local file = assert(io.open(cfg, "rb") )
	local line = file:read()
	for line in file:lines() do
		pos1 = string.find(line, '#')
		if pos1 ~= nil then
			line = string.sub(line, 1, pos1-1)
		end
		pos1 = string.find(line, '=')
		if string.find(line, 'repsauv=') ~= nil then
			repsauv = string.sub(line, pos1+1)
		elseif string.find(line, 'TempShell=') ~= nil then
			r = string.sub(line, pos1+1)
		elseif string.find(line, 'web=') ~= nil then
			cmd1 = string.sub(line, pos1+1)
		elseif string.find(line, 'periode=') ~= nil then
			jours = string.sub(line, pos1+1)
		elseif string.find(line, 'matinée=') ~= nil then
			matin = string.sub(line, pos1+1)
		elseif string.find(line, 'am=') ~= nil then
			apresmidi = string.sub(line, pos1+1)
		elseif string.find(line, 'soiree=') ~= nil then
			soiree = string.sub(line, pos1+1)
		elseif string.find(line, 'nuit=') ~= nil then
			nuit = string.sub(line, pos1+1)
		elseif string.find(line, 'Prev8heures=') ~= nil then
			huit = string.sub(line, pos1+1)
		elseif string.find(line, 'Palier=') ~= nil then
			Palier = tonumber(string.sub(line, pos1+1))
		elseif string.find(line, 'update=') ~= nil then
			delais = string.sub(line, pos1+1)
		end
	end
	io.close(file)	
	r = r:gsub("~", home):gsub("$HOME", home)
	repsauv = repsauv:gsub("~", home):gsub("$HOME", home)
	VilleAdresse=string.match(cmd1, ".com/%a*/%a*/([%w%p%s]*)/%d*/%a*")
	
print("", "version = "..Version.."\n", "web = "..cmd1.."\n", "Pévision Nb jours = "..jours.."\n", "Pévision Matin = "..matin.."\n", "Pévision Après Midi = "..apresmidi.."\n", "Pévision Soirée = "..soiree.."\n", "Pévision Nuit = "..nuit.."\n","Prévision sur 8 heures = "..huit.."\n", "Délais = "..delais.."\n", "Chemin de travail = "..r.."\n","Palier = "..Palier.."\n", "Chemin de sauvegarde = "..repsauv)

--Création répertoire de travail
	l = cmd1:match("/(%d+)")
	if string.find(cmd1, 'forecast') ~= nil then
		pos1 = string.find(cmd1, '/weather')
		cmd = string.sub(cmd1, 0, pos1-1)
	else
		pos1 = string.find(cmd1, '/current')
		cmd = string.sub(cmd1, 0, pos1-1)
	end

	local bar, bar1
	local l1 = string.gsub(cmd, '/'..l, "" )
	local b = 1
	while bar1 == nil do
		b = b+1
		bar1 = string.find(l1, '/', -b)
	end
	l1 = string.sub(l1, bar1+1)
	Rep = r.."/"..l1.."/"..l
	if os.execute("cd "..Rep) ~= 0 then
		os.execute("mkdir "..r.."/"..l1.."&& mkdir "..Rep)
	end
	
--initialisation compteurs
	t = os.time()-delais
	tc = t
	start = 1
	
--Vérification existence repsauv

	if os.execute("cd "..repsauv) ~= 0 then
--création de repsauv si inexistant
		local pos1 = 1
		local chemin = nil
		local cheminsup = nil
		while pos1 ~= nil do
			pos1 = string.find(repsauv, '/', pos1+1)
			if pos1 ~= nil then
				cheminsup = string.sub(repsauv, pos1)
				chemin = string.gsub(repsauv, cheminsup, "")
			else
				cheminsup = ""
				chemin = repsauv
			end
			if os.execute("cd "..chemin) ~= 0 then
				os.execute("mkdir "..chemin)
			end
		end
	end
	
	if not existe(repsauv.."/CondCour") then
		conky_Meteo_enligne()
	end
	
	MAJ ="0"
	
end

--Mise à jour météo
function conky_Meteo_Maj()

	local s = '${if_gw}${lua conky_Meteo_enligne}${else}${lua conky_Meteo_horsligne}${endif}'
	conky_parse( s )
	return " "
end

--hors ligne récupération de données
function conky_Meteo_horsligne()

	if dermodif == nil or dermodif ~= conky_parse("${exec date -r "..repsauv.."/CondCour '+%s'}") then
		dermodif=conky_parse("${exec date -r "..repsauv.."/CondCour '+%s'}")
--Récupération dernière condition courante
		local file = assert(io.open(repsauv.."/CondCour", "r") )
		local line = file:read()
		local i = 0
		local donee = {}
		for line in file:lines() do
			i = i+1
			donee[i] = line
		end
		local t = {"Icone", "Tempr", "Temp", "Cond", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "VentDir", "VentPlein", "VentForce", "VentIcone", "Humidite", "PointRosee", "Pression", "Visibilite", "Date", "Ville", "CouvNuage", "Uv", "QPrec", "latitude", "longitude"}
		for i = 1,23 do
			conditioncourante[t[i]] = donee[i]
		end
		time = donee[24]
		io.close(file)
		
--Récupération prévision
		
		for j = 1,jours do
			local file = assert(io.open(repsauv.."/prevision"..j, "r"))
			local line = file:read()
			local i = 0
			local donee = {}
			for line in file:lines() do
				i = i+1
				donee[i] = line
			end
			local info = {}
			local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "Temp", "TempRes", "ProbPrec", "VentDir", "VentP", "VentForce", "VentRafales", "Uv", "ProbOrage", "NivPrec", "QPluie", "QNeige", "Icone", "VentIcone", "RafalesIcone", "EVerglas"}
			conditionJour[j] = {}
			for i = 1, 21 do
				info[t[i]] = donee[i]
			end
			conditionJour[j] = info
			local info1 = {}
			t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "Temp", "TempRes", "ProbPrec", "VentDir", "VentP", "VentForce", "VentRafales", "ProbOrage", "NivPrec", "QPluie", "QNeige", "Icone", "VentIcone", "RafalesIcone", "EVerglas"}
			conditionNuit[j] = {}
			for i = 22, 41 do
				info1[t[i-21]] = donee[i]
			end
			conditionNuit[j] = info1
			local info2 = {}
			t= {"Jour", "LeverSoleilH", "LeverSoleilM", "CoucherSoleilH", "CoucherSoleilM", "Histo_Max", "Histo_Min"}
			InfoJour[j] = {}
			for i = 42, 48 do
				info2[t[i-41]] = donee[i]
			end
			InfoJour[j] = info2
			io.close(file)
			
			if matin == "oui" then
				local file = assert(io.open(repsauv.."/matin"..j, "r"))
				local line = file:read()
				local i = 0
				local donee = {}
				for line in file:lines() do
					i = i+1
					donee[i] = line
				end
				local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "TempMax", "TempMin", "TempMaxR", "TempMinR", "ProbPrec", "VentDir", "VentP", "VentForce", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite", "Icone", "VentIcone"}
				conditionMatin[j] = {}
				local info3 = {}
				for i = 1, 21 do
					info3[t[i]] = donee[i]
				end
				conditionMatin[j] = info3
				io.close(file)
			end

			if apresmidi == "oui" then
				local file = assert(io.open(repsauv.."/ApresMidi"..j, "r"))
				local line = file:read()
				local i = 0
				local donee = {}
				for line in file:lines() do
					i = i+1
					donee[i] = line
				end
				local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "TempMax", "TempMin", "TempMaxR", "TempMinR", "ProbPrec", "VentDir", "VentP", "VentForce", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite", "Icone", "VentIcone"}
				conditionAM[j] = {}
				local info3 = {}
				for i = 1, 21 do
					info3[t[i]] = donee[i]
				end
				conditionAM[j] = info3
				io.close(file)
			end

			if soiree == "oui" then
				local file = assert(io.open(repsauv.."/Soiree"..j, "r"))
				local line = file:read()
				local i = 0
				local donee = {}
				for line in file:lines() do
					i = i+1
					donee[i] = line
				end
				local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "TempMax", "TempMin", "TempMaxR", "TempMinR", "ProbPrec", "VentDir", "VentP", "VentForce", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite", "Icone", "VentIcone"}
				conditionSoiree[j] = {}
				local info3 = {}
				for i = 1, 21 do
					info3[t[i]] = donee[i]
				end
				conditionSoiree[j] = info3
				io.close(file)
			end

			if nuit == "oui" then
				local file = assert(io.open(repsauv.."/Nuit"..j, "r"))
				local line = file:read()
				local i = 0
				local donee = {}
				for line in file:lines() do
					i = i+1
					donee[i] = line
				end
				local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "TempMax", "TempMin", "TempMaxR", "TempMinR", "ProbPrec", "VentDir", "VentP", "VentForce", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite", "Icone", "VentIcone"}
				conditionNoct[j] = {}
				local info3 = {}
				for i = 1, 21 do
					info3[t[i]] = donee[i]
				end
				conditionNoct[j] = info3
				io.close(file)
			end
		end
		
		if huit == "oui" then
			for j = 1,8 do
				local file = assert(io.open(repsauv.."/huitHeures"..j, "r"))
				local line = file:read()
				local i = 0
				local donee = {}
				for line in file:lines() do
					i = i+1
					donee[i] = line
				end
				local t = {"Heure", "Icone", "TempMax", "TempMaxR", "VentDir", "VentForce", "Humidite", "CouvNuage", "PointRosee", "UV", "Pluie", "Neige", "Verglas", "VentP", "VentIcone"}
				huitHeures[j] = {}
				local info3 = {}
				for i = 1, 15 do
					info3[t[i]] = donee[i]
				end
				huitHeures[j] = info3
				io.close(file)
			end
		end			


--Récupération lunaison
		local file = assert(io.open(repsauv.."/lunaison", "r"))
		local line = file:read()
		local i = 0
		local donee = {}
		for line in file:lines() do
			i = i+1
			donee[i] = line
		end
		ephemerides = donee[1]
		ephemerides1 = donee[2]
		ephemerides2 = donee[3]
		Visibilite = donee[4]
		Phases = donee[5]
		Phases1 = donee[6]
		Phases2 = donee[7]
		Noeud_lunaire = donee[8]
		Apogee = donee[9]
		Perigee = donee[10]
		Distance = donee[11]
		Age = donee[12]
		Lever_LuneHeure = donee[13]
		Lever_LuneMinute = donee[14]
		Coucher_LuneHeure = donee[15]
		Coucher_LuneMinute = donee[16]
		Eclipse_partielle = donee[17]
		Eclipse_total = donee[18]
		io.close(file)

		
		if MAJ == "0" then
			MAJ = "1"
		else
			MAJ = "0"
		end

		
		collectgarbage()
	end
	return ""
end

--en ligne mise à jour
function conky_Meteo_enligne()
	local i
	if tonumber(delais) <= os.difftime(os.time(), t) then
		t = os.time()
		time = t

			conditioncourante.Date = nil
			while conditioncourante.Date == nil do

				conditioncourante = current(cmd..'/current-weather/'..l)
				
					local y = {"Icone", "Cond", "Temp", "Tempr", "VentDir", "VentForce", "Humidite", "Pression", "CouvNuage", "Uv", "PointRosee", "QPrec", "Visibilite", "Ville", "latitude","Date", "longitude"}
					local donee = conditioncourante
					
					for i = 1,17 do
						if donee[y[i]] == nil then
							local file = assert(io.open(repsauv.."/Debug", "a+"))
							file:write ("\n", Debug, "conditioncourante ", y[i])
							donee[y[i]]="N/A"
						end
					end
					conditioncourante=donee

				if conditioncourante.VentDir == "CLM" then
					conditioncourante.VentDir = "Calme"
					conditioncourante.VentForce = "0"
				end
				if conditioncourante.Ville == "" then
					conditioncourante.Ville = VilleAdresse
				end
				conditioncourante.VentIcone = icone_vent(direction_vent(conditioncourante.VentDir), conditioncourante.VentForce)
				conditioncourante.VentPlein = vent_plein(conditioncourante.VentDir)
				conditioncourante.CondMeteo1, conditioncourante.CondMeteo2, conditioncourante.CondMeteo1se, conditioncourante.CondMeteo2se = decoupage(conditioncourante.Cond)
				print("Condition courante Ok")

				if 14400 <= os.difftime(os.time(), tc) or start == 1 then
					start = 2
					tc = t

					local addr_week = cmd..'/daily-weather-forecast/'..l
					jour_n(addr_week, 1, 0)

					if conditioncourante.Date == InfoJour[1].Jour then
						for i = 2,jours do jour_n(addr_week, i, 0) end
					else
						for i = 1,jours do jour_n(addr_week, i, 1) end
					end

--infos matin si demandée
					if matin == "oui" then
						addr_week = cmd..'/morning-weather-forecast/'..l

						if conditioncourante.Date == InfoJour[1].Jour then
							for i = 1,jours do Prevision_Matin(addr_week, i, 0) end
						else
							for i = 1,jours do Prevision_Matin(addr_week, i, 1) end
						end
					end

--infos Après Midi si demandée
					if apresmidi == "oui" then
						addr_week = cmd..'/afternoon-weather-forecast/'..l

						if conditioncourante.Date == InfoJour[1].Jour then
							for i = 1,jours do Prevision_AM(addr_week, i, 0) end
						else
							for i = 1,jours do Prevision_AM(addr_week, i, 1) end
						end
					end

--infos Soirée si demandée
					if soiree == "oui" then
						addr_week = cmd..'/evening-weather-forecast/'..l

						if conditioncourante.Date == InfoJour[1].Jour then
							for i = 1,jours do Prevision_Soiree(addr_week, i, 0) end
						else
							for i = 1,jours do Prevision_Soiree(addr_week, i, 1) end
						end
					end

--infos Nuit si demandée
					if nuit == "oui" then
						addr_week = cmd..'/overnight-weather-forecast/'..l

						if conditioncourante.Date == InfoJour[1].Jour then
							for i = 1,jours do Prevision_Nuit(addr_week, i, 0) end
						else
							for i = 1,jours do Prevision_Nuit(addr_week, i, 1) end
						end
					end
					
				end -- fin mise à jour compète
			end
			
			if huit == "oui" then
				addr_week = cmd..'/hourly-weather-forecast/'..l
				Prevision_Huit_Heures(addr_week)
			end
			
			lunaison(r)
			print("lunaison Ok")
--lancement sauvegarde
		if repsauv ~= nil then
			sauvegarde()
		end
		
		
		if MAJ == "0" then
			MAJ = "1"
		else
			MAJ = "0"
		end

		
		collectgarbage()
		print(os.difftime(os.time(), t).." seconde(s)")
	end
	return " "
end


--Retour d'information météo

--Condition courrante

function conky_Meteo_IconeM(r, p, s, f)
	if os.date("%H%M", os.time()) <= InfoJour[1].CoucherSoleilH..InfoJour[1].CoucherSoleilM and os.date("%H%M", os.time()) >= InfoJour[1].LeverSoleilH..InfoJour[1].LeverSoleilM then
		return "${image "..r.."/jour/"..conditioncourante.Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
	else
		return "${image "..r.."/nuit/"..conditioncourante.Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
	end
end

function conky_Meteo_TempRes()
	return conditioncourante.Tempr
end

function conky_Meteo_TempAct()
	return conditioncourante.Temp
end

function conky_Meteo_CondMeteo()
	return conditioncourante.Cond
end

function conky_Meteo_CondMeteo1()
	return conditioncourante.CondMeteo1
end

function conky_Meteo_CondMeteo2()
	return conditioncourante.CondMeteo2
end

function conky_Meteo_CondMeteo1se()
	return conditioncourante.CondMeteo1se
end

function conky_Meteo_CondMeteo2se()
	return conditioncourante.CondMeteo2se
end

function conky_Meteo_VentDir()
	return conditioncourante.VentDir
end

function conky_Meteo_VentDirP()
	return conditioncourante.VentPlein
end

function conky_Meteo_VentForce()
	return conditioncourante.VentForce
end

function conky_Meteo_IconeV(r, p, s, f)
	return "${image "..r.."/"..conditioncourante.VentIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_Humidite()
	return tonumber(conditioncourante.Humidite)
end

function conky_Meteo_Rose()
	return tonumber(conditioncourante.PointRosee)
end

function conky_Meteo_Pression()
	return tonumber(conditioncourante.Pression)
end

function conky_Meteo_Visibilite()
	return tonumber(conditioncourante.Visibilite)
end

function conky_Meteo_Date(format)
	format = string.gsub(format, "_", " ")
	return trad_date(os.date(format, conditioncourante.Date))
end

function conky_Meteo_Ville()
	return conditioncourante.Ville
end

function conky_Meteo_CouvNuage(r)
	if r == nil then r = 100 end
	local Couv = (tonumber(conditioncourante.CouvNuage) / 100) * r
	if Couv - math.floor(Couv) <= 0.5 then 
		Couv = math.floor(Couv)
	else
		Couv = math.ceil(Couv)
	end
	return Couv
end

function conky_Meteo_Uv()
	return conditioncourante.Uv
end

function conky_Meteo_QPrec()
	return conditioncourante.QPrec
end

function conky_Meteo_latitude()
	return conditioncourante.latitude
end

function conky_Meteo_longitude()
	return conditioncourante.longitude
end

function conky_Meteo_Heure()
	return os.date("%H", time)
end

function conky_Meteo_Minute()
	return os.date("%M", time)
end


--Prévision Météo

--Jour

function conky_Meteo_Jour_CondMeteo(j)
	return conditionJour[tonumber(j)].CondMeteo
end

function conky_Meteo_Jour_CondMeteo1(j)
	return conditionJour[tonumber(j)].CondMeteo1
end

function conky_Meteo_Jour_CondMeteo2(j)
	return conditionJour[tonumber(j)].CondMeteo2
end

function conky_Meteo_Jour_CondMeteo1se(j)
	return conditionJour[tonumber(j)].CondMeteo1se
end

function conky_Meteo_Jour_CondMeteo2se(j)
	return conditionJour[tonumber(j)].CondMeteo2se
end

function conky_Meteo_Jour_Temp(j)
	return tonumber(conditionJour[tonumber(j)].Temp)
end

function conky_Meteo_Jour_TempRes(j)
	return tonumber(conditionJour[tonumber(j)].TempRes)
end

function conky_Meteo_Jour_ProbPrec(j)
	return tonumber(conditionJour[tonumber(j)].ProbPrec)
end

function conky_Meteo_Jour_VentDir(j)
	return conditionJour[tonumber(j)].VentDir
end

function conky_Meteo_Jour_VentDirP(j)
	return conditionJour[tonumber(j)].VentP
end

function conky_Meteo_Jour_VentForce(j)
	return tonumber(conditionJour[tonumber(j)].VentForce)
end

function conky_Meteo_Jour_VentRafales(j)
	return tonumber(conditionJour[tonumber(j)].VentRafales)
end

function conky_Meteo_Jour_Uv(j)
	return tonumber(conditionJour[tonumber(j)].Uv)
end

function conky_Meteo_Jour_ProbOrage(j)
	return tonumber(conditionJour[tonumber(j)].ProbOrage)
end

function conky_Meteo_Jour_NivPrec(j)
	return tonumber(conditionJour[tonumber(j)].NivPrec)
end

function conky_Meteo_Jour_QPluie(j)
	return tonumber(conditionJour[tonumber(j)].QPluie)
end

function conky_Meteo_Jour_QNeige(j)
	return tonumber(conditionJour[tonumber(j)].QNeige)
end

function conky_Meteo_Jour_EVerglas(j)
	return tonumber(conditionJour[tonumber(j)].EVerglas)
end

function conky_Meteo_Jour_IconeM(r, p, s, f, j)
	return "${image "..r.."/jour/"..conditionJour[tonumber(j)].Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_Jour_IconeV(r, p, s, f, j)
	return "${image "..r.."/"..conditionJour[tonumber(j)].VentIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_Jour_IconeR(r, p, s, f, j)
	return "${image "..r.."/"..conditionJour[tonumber(j)].RafalesIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end


--Nuit

function conky_Meteo_Nuit_CondMeteo(j)
	return conditionNuit[tonumber(j)].CondMeteo
end

function conky_Meteo_Nuit_CondMeteo1(j)
	return conditionNuit[tonumber(j)].CondMeteo1
end

function conky_Meteo_Nuit_CondMeteo2(j)
	return conditionNuit[tonumber(j)].CondMeteo2
end

function conky_Meteo_Nuit_CondMeteo1se(j)
	return conditionNuit[tonumber(j)].CondMeteo1se
end

function conky_Meteo_Nuit_CondMeteo2se(j)
	return conditionNuit[tonumber(j)].CondMeteo2se
end

function conky_Meteo_Nuit_Temp(j)
	return tonumber(conditionNuit[tonumber(j)].Temp)
end

function conky_Meteo_Nuit_TempRes(j)
	return tonumber(conditionNuit[tonumber(j)].TempRes)
end

function conky_Meteo_Nuit_ProbPrec(j)
	return tonumber(conditionNuit[tonumber(j)].ProbPrec)
end

function conky_Meteo_Nuit_VentDir(j)
	return conditionNuit[tonumber(j)].VentDir
end

function conky_Meteo_Nuit_VentDirP(j)
	return conditionNuit[tonumber(j)].VentP
end

function conky_Meteo_Nuit_VentForce(j)
	return tonumber(conditionNuit[tonumber(j)].VentForce)
end

function conky_Meteo_Nuit_VentRafales(j)
	return tonumber(conditionNuit[tonumber(j)].VentRafales)
end

function conky_Meteo_Nuit_ProbOrage(j)
	return tonumber(conditionNuit[tonumber(j)].ProbOrage)
end

function conky_Meteo_Nuit_NivPrec(j)
	return tonumber(conditionNuit[tonumber(j)].NivPrec)
end

function conky_Meteo_Nuit_QPluie(j)
	return tonumber(conditionNuit[tonumber(j)].QPluie)
end

function conky_Meteo_Nuit_QNeige(j)
	return tonumber(conditionNuit[tonumber(j)].QNeige)
end

function conky_Meteo_Nuit_EVerglas(j)
	return tonumber(conditionNuit[tonumber(j)].EVerglas)
end

function conky_Meteo_Nuit_IconeM(r, p, s, f, j)
	return "${image "..r.."/nuit/"..conditionNuit[tonumber(j)].Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_Nuit_IconeV(r, p, s, f, j)
	return "${image "..r.."/"..conditionNuit[tonumber(j)].VentIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_Nuit_IconeR(r, p, s, f, j)
	return "${image "..r.."/"..conditionNuit[tonumber(j)].RafalesIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end


--Infos sur la journée

function conky_Meteo_Jour(format, j)
	format = string.gsub(format, "_", " ")
	return trad_date(os.date(format, InfoJour[tonumber(j)].Jour))
end

function conky_Meteo_HLeverSoleil(j)
	return InfoJour[tonumber(j)].LeverSoleilH
end

function conky_Meteo_MLeverSoleil(j)
	return InfoJour[tonumber(j)].LeverSoleilM
end

function conky_Meteo_LeverSoleil(j)
	return tonumber((InfoJour[tonumber(j)].LeverSoleilH*60)+InfoJour[tonumber(j)].LeverSoleilM)
end

function conky_Meteo_HCoucherSoleil(j)
	return InfoJour[tonumber(j)].CoucherSoleilH
end

function conky_Meteo_MCoucherSoleil(j)
	return InfoJour[tonumber(j)].CoucherSoleilM
end

function conky_Meteo_CoucherSoleil(j)
	return tonumber((InfoJour[tonumber(j)].CoucherSoleilH*60)+InfoJour[tonumber(j)].CoucherSoleilM)
end

function conky_Meteo_HDureeJour(j)
	return InfoJour[tonumber(j)].CoucherSoleilH-InfoJour[tonumber(j)].LeverSoleilH
end

function conky_Meteo_MDureeJour(j)
	return os.date("%M", ((((InfoJour[tonumber(j)].CoucherSoleilH*3600)-3600)+(InfoJour[tonumber(j)].CoucherSoleilM*60))-(((InfoJour[tonumber(j)].LeverSoleilH*3600))+(InfoJour[tonumber(j)].LeverSoleilM*60))))
end

function conky_Meteo_Histo_Min(j)
	return InfoJour[tonumber(j)].Histo_Min
end

function conky_Meteo_Histo_Max(j)
	return InfoJour[tonumber(j)].Histo_Max
end


--Matin

function conky_Meteo_Matin_CondMeteo(j)
	return conditionMatin[tonumber(j)].CondMeteo
end

function conky_Meteo_Matin_CondMeteo1(j)
	return conditionMatin[tonumber(j)].CondMeteo1
end

function conky_Meteo_Matin_CondMeteo2(j)
	return conditionMatin[tonumber(j)].CondMeteo2
end

function conky_Meteo_Matin_CondMeteo1se(j)
	return conditionMatin[tonumber(j)].CondMeteo1se
end

function conky_Meteo_Matin_CondMeteo2se(j)
	return conditionMatin[tonumber(j)].CondMeteo2se
end

function conky_Meteo_Matin_TempMax(j)
	return tonumber(conditionMatin[tonumber(j)].TempMax)
end

function conky_Meteo_Matin_TempMin(j)
	return tonumber(conditionMatin[tonumber(j)].TempMin)
end

function conky_Meteo_Matin_TempMaxRes(j)
	return tonumber(conditionMatin[tonumber(j)].TempMaxR)
end

function conky_Meteo_Matin_TempMinRes(j)
	return tonumber(conditionMatin[tonumber(j)].TempMinR)
end

function conky_Meteo_Matin_ProbPrec(j)
	return tonumber(conditionMatin[tonumber(j)].ProbPrec)
end

function conky_Meteo_Matin_VentDir(j)
	return conditionMatin[tonumber(j)].VentDir
end

function conky_Meteo_Matin_VentDirP(j)
	return conditionMatin[tonumber(j)].VentP
end

function conky_Meteo_Matin_VentForce(j)
	return tonumber(conditionMatin[tonumber(j)].VentForce)
end

function conky_Meteo_Matin_QPluie(j)
	return tonumber(conditionMatin[tonumber(j)].QPluie)
end

function conky_Meteo_Matin_QNeige(j)
	return tonumber(conditionMatin[tonumber(j)].QNeige)
end

function conky_Meteo_Matin_Humidite(j)
	return tonumber(conditionMatin[tonumber(j)].Humidite)
end

function conky_Meteo_Matin_CouvNuage(j, r)
	if r == nil then r = 100 end
	local Couv = (tonumber(conditionMatin[tonumber(j)].CouvNuage) / 100) * r
	if Couv - math.floor(Couv) <= 0.5 then 
		Couv = math.floor(Couv)
	else
		Couv = math.ceil(Couv)
	end
	return Couv
end

function conky_Meteo_Matin_Rose(j)
	return tonumber(conditionMatin[tonumber(j)].PointRosee)
end

function conky_Meteo_Matin_Visibilite(j)
	return tonumber(conditionMatin[tonumber(j)].Visibilite)
end

function conky_Meteo_Matin_IconeM(r, p, s, f, j)
	return "${image "..r.."/jour/"..conditionMatin[tonumber(j)].Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_Matin_IconeV(r, p, s, f, j)
	return "${image "..r.."/"..conditionMatin[tonumber(j)].VentIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end


--Après Midi

function conky_Meteo_AM_CondMeteo(j)
	return conditionAM[tonumber(j)].CondMeteo
end

function conky_Meteo_AM_CondMeteo1(j)
	return conditionAM[tonumber(j)].CondMeteo1
end

function conky_Meteo_AM_CondMeteo2(j)
	return conditionAM[tonumber(j)].CondMeteo2
end

function conky_Meteo_AM_CondMeteo1se(j)
	return conditionAM[tonumber(j)].CondMeteo1se
end

function conky_Meteo_AM_CondMeteo2se(j)
	return conditionAM[tonumber(j)].CondMeteo2se
end

function conky_Meteo_AM_TempMax(j)
	return tonumber(conditionAM[tonumber(j)].TempMax)
end

function conky_Meteo_AM_TempMin(j)
	return tonumber(conditionAM[tonumber(j)].TempMin)
end

function conky_Meteo_AM_TempMaxRes(j)
	return tonumber(conditionAM[tonumber(j)].TempMaxR)
end

function conky_Meteo_AM_TempMinRes(j)
	return tonumber(conditionAM[tonumber(j)].TempMinR)
end

function conky_Meteo_AM_ProbPrec(j)
	return tonumber(conditionAM[tonumber(j)].ProbPrec)
end

function conky_Meteo_AM_VentDir(j)
	return conditionAM[tonumber(j)].VentDir
end

function conky_Meteo_AM_VentDirP(j)
	return conditionAM[tonumber(j)].VentP
end

function conky_Meteo_AM_VentForce(j)
	return tonumber(conditionAM[tonumber(j)].VentForce)
end

function conky_Meteo_AM_QPluie(j)
	return tonumber(conditionAM[tonumber(j)].QPluie)
end

function conky_Meteo_AM_QNeige(j)
	return tonumber(conditionAM[tonumber(j)].QNeige)
end

function conky_Meteo_AM_Humidite(j)
	return tonumber(conditionAM[tonumber(j)].Humidite)
end

function conky_Meteo_AM_CouvNuage(j, r)
	if r == nil then r = 100 end
	local Couv = (tonumber(conditionAM[tonumber(j)].CouvNuage) / 100) * r
	if Couv - math.floor(Couv) <= 0.5 then 
		Couv = math.floor(Couv)
	else
		Couv = math.ceil(Couv)
	end
	return Couv
end

function conky_Meteo_AM_Rose(j)
	return tonumber(conditionAM[tonumber(j)].PointRosee)
end

function conky_Meteo_AM_Visibilite(j)
	return tonumber(conditionAM[tonumber(j)].Visibilite)
end

function conky_Meteo_AM_IconeM(r, p, s, f, j)
	return "${image "..r.."/jour/"..conditionAM[tonumber(j)].Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_AM_IconeV(r, p, s, f, j)
	return "${image "..r.."/"..conditionAM[tonumber(j)].VentIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end


--Soirée

function conky_Meteo_Soiree_CondMeteo(j)
	return conditionSoiree[tonumber(j)].CondMeteo
end

function conky_Meteo_Soiree_CondMeteo1(j)
	return conditionSoiree[tonumber(j)].CondMeteo1
end

function conky_Meteo_Soiree_CondMeteo2(j)
	return conditionSoiree[tonumber(j)].CondMeteo2
end

function conky_Meteo_Soiree_CondMeteo1se(j)
	return conditionSoiree[tonumber(j)].CondMeteo1se
end

function conky_Meteo_Soiree_CondMeteo2se(j)
	return conditionSoiree[tonumber(j)].CondMeteo2se
end

function conky_Meteo_Soiree_TempMax(j)
	return tonumber(conditionSoiree[tonumber(j)].TempMax)
end

function conky_Meteo_Soiree_TempMin(j)
	return tonumber(conditionSoiree[tonumber(j)].TempMin)
end

function conky_Meteo_Soiree_TempMaxRes(j)
	return tonumber(conditionSoiree[tonumber(j)].TempMaxR)
end

function conky_Meteo_Soiree_TempMinRes(j)
	return tonumber(conditionSoiree[tonumber(j)].TempMinR)
end

function conky_Meteo_Soiree_ProbPrec(j)
	return tonumber(conditionSoiree[tonumber(j)].ProbPrec)
end

function conky_Meteo_Soiree_VentDir(j)
	return conditionSoiree[tonumber(j)].VentDir
end

function conky_Meteo_Soiree_VentDirP(j)
	return conditionSoiree[tonumber(j)].VentP
end

function conky_Meteo_Soiree_VentForce(j)
	return tonumber(conditionSoiree[tonumber(j)].VentForce)
end

function conky_Meteo_Soiree_QPluie(j)
	return tonumber(conditionSoiree[tonumber(j)].QPluie)
end

function conky_Meteo_Soiree_QNeige(j)
	return tonumber(conditionSoiree[tonumber(j)].QNeige)
end

function conky_Meteo_Soiree_Humidite(j)
	return tonumber(conditionSoiree[tonumber(j)].Humidite)
end

function conky_Meteo_Soiree_CouvNuage(j, r)
	if r == nil then r = 100 end
	local Couv = (tonumber(conditionSoiree[tonumber(j)].CouvNuage) / 100) * r
	if Couv - math.floor(Couv) <= 0.5 then 
		Couv = math.floor(Couv)
	else
		Couv = math.ceil(Couv)
	end
	return Couv
end

function conky_Meteo_Soiree_Rose(j)
	return tonumber(conditionSoiree[tonumber(j)].PointRosee)
end

function conky_Meteo_Soiree_Visibilite(j)
	return tonumber(conditionSoiree[tonumber(j)].Visibilite)
end

function conky_Meteo_Soiree_IconeM(r, p, s, f, j)
	return "${image "..r.."/jour/"..conditionSoiree[tonumber(j)].Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_Soiree_IconeV(r, p, s, f, j)
	return "${image "..r.."/"..conditionSoiree[tonumber(j)].VentIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end


--Nuit

function conky_Meteo_Noct_CondMeteo(j)
	return conditionNoct[tonumber(j)].CondMeteo
end

function conky_Meteo_Noct_CondMeteo1(j)
	return conditionNoct[tonumber(j)].CondMeteo1
end

function conky_Meteo_Noct_CondMeteo2(j)
	return conditionNoct[tonumber(j)].CondMeteo2
end

function conky_Meteo_Noct_CondMeteo1se(j)
	return conditionNoct[tonumber(j)].CondMeteo1se
end

function conky_Meteo_Noct_CondMeteo2se(j)
	return conditionNoct[tonumber(j)].CondMeteo2se
end

function conky_Meteo_Noct_TempMax(j)
	return tonumber(conditionNoct[tonumber(j)].TempMax)
end

function conky_Meteo_Noct_TempMin(j)
	return tonumber(conditionNoct[tonumber(j)].TempMin)
end

function conky_Meteo_Noct_TempMaxRes(j)
	return tonumber(conditionNoct[tonumber(j)].TempMaxR)
end

function conky_Meteo_Noct_TempMinRes(j)
	return tonumber(conditionNoct[tonumber(j)].TempMinR)
end

function conky_Meteo_Noct_ProbPrec(j)
	return tonumber(conditionNoct[tonumber(j)].ProbPrec)
end

function conky_Meteo_Noct_VentDir(j)
	return conditionNoct[tonumber(j)].VentDir
end

function conky_Meteo_Noct_VentDirP(j)
	return conditionNoct[tonumber(j)].VentP
end

function conky_Meteo_Noct_VentForce(j)
	return tonumber(conditionNoct[tonumber(j)].VentForce)
end

function conky_Meteo_Noct_QPluie(j)
	return tonumber(conditionNoct[tonumber(j)].QPluie)
end

function conky_Meteo_Noct_QNeige(j)
	return tonumber(conditionNoct[tonumber(j)].QNeige)
end

function conky_Meteo_Noct_Humidite(j)
	return tonumber(conditionNoct[tonumber(j)].Humidite)
end

function conky_Meteo_Noct_CouvNuage(j, r)
	if r == nil then r = 100 end
	local Couv = (tonumber(conditionNoct[tonumber(j)].CouvNuage) / 100) * r
	if Couv - math.floor(Couv) <= 0.5 then 
		Couv = math.floor(Couv)
	else
		Couv = math.ceil(Couv)
	end
	return Couv
end

function conky_Meteo_Noct_Rose(j)
	return tonumber(conditionNoct[tonumber(j)].PointRosee)
end

function conky_Meteo_Noct_Visibilite(j)
	return tonumber(conditionNoct[tonumber(j)].Visibilite)
end

function conky_Meteo_Noct_IconeM(r, p, s, f, j)
	return "${image "..r.."/nuit/"..conditionNoct[tonumber(j)].Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_Noct_IconeV(r, p, s, f, j)
	return "${image "..r.."/"..conditionNoct[tonumber(j)].VentIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end

--Huit prochaines heures


function conky_Meteo_huitHeures_VentDirP(j)
	return huitHeures[tonumber(j)].VentP
end

function conky_Meteo_huitHeures_IconeV(r, p, s, f, j)
	return "${image "..r.."/"..huitHeures[tonumber(j)].VentIcone.." -p "..p.." -s "..s.." -f "..f.."}"
end

function conky_Meteo_huitHeures_Heure(j)
	return tonumber(huitHeures[tonumber(j)].Heure)
end

function conky_Meteo_huitHeures_IconeM(r, p, s, f, j)
	if huitHeures[tonumber(j)].Heure <= InfoJour[1].CoucherSoleilH and huitHeures[tonumber(j)].Heure >= InfoJour[1].LeverSoleilH then
		return "${image "..r.."/jour/"..huitHeures[tonumber(j)].Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
	else
		return "${image "..r.."/nuit/"..huitHeures[tonumber(j)].Icone..".png -p "..p.." -s "..s.." -f "..f.."}"
	end
end

function conky_Meteo_huitHeures_Temp(j)
	return tonumber(huitHeures[tonumber(j)].TempMax)
end

function conky_Meteo_huitHeures_TempR(j)
	return tonumber(huitHeures[tonumber(j)].TempMaxR)
end

function conky_Meteo_huitHeures_VentDir(j)
	return huitHeures[tonumber(j)].VentDir
end

function conky_Meteo_huitHeures_VentForce(j)
	return tonumber(huitHeures[tonumber(j)].VentForce)
end

function conky_Meteo_huitHeures_Humidite(j)
	return tonumber(huitHeures[tonumber(j)].Humidite)
end

function conky_Meteo_huitHeures_CouvNuage(j)
	return tonumber(huitHeures[tonumber(j)].CouvNuage)
end

function conky_Meteo_huitHeures_Rose(j)
	return tonumber(huitHeures[tonumber(j)].PointRosee)
end

function conky_Meteo_huitHeures_ProbPluie(j)
	return tonumber(huitHeures[tonumber(j)].Pluie)
end

function conky_Meteo_huitHeures_ProbNeige(j)
	return tonumber(huitHeures[tonumber(j)].Neige)
end

function conky_Meteo_huitHeures_ProbVerglas(j)
	return tonumber(huitHeures[tonumber(j)].Verglas)
end

function conky_Meteo_huitHeures_Uv(j)
	return tonumber(huitHeures[tonumber(j)].UV)
end

--Lunaison

function conky_Lune_ephemerides()
	return ephemerides
end

function conky_Lune_ephemerides1()
	return ephemerides1
end

function conky_Lune_ephemerides2()
	return ephemerides2
end

function conky_Lune_Visibilite()
	return Visibilite
end

function conky_Lune_Phases()
	return Phases
end

function conky_Lune_Phases1()
	return Phases1
end

function conky_Lune_Phases2()
	return Phases2
end

function conky_Lune_Noeudlunaire()
	return Noeud_lunaire
end

function conky_Lune_Apogee()
	return Apogee
end

function conky_Lune_Perigee()
	return Perigee
end

function conky_Lune_Distance()
	return Distance
end

function conky_Lune_Age()
	return Age
end

function conky_Lune_HLeverLune()
	return Lever_LuneHeure
end

function conky_Lune_MLeverLune()
	return Lever_LuneMinute
end

function conky_Lune_HCoucherLune()
	return Coucher_LuneHeure
end

function conky_Lune_MCoucherLune()
	return Coucher_LuneMinute
end

function conky_Lune_EclipsePartielle(format)
	if format == nil then format = "%A_%d_%B_%Y_à_%H:%M" end
	format = string.gsub(format, "_", " ")
	return trad_date(os.date(format, Eclipse_partielle))
end

function conky_Lune_EclipseTotal()
	if format == nil then format = "%A_%d_%B_%Y_à_%H:%M" end
	format = string.gsub(format, "_", " ")
	return trad_date(os.date(format, Eclipse_total))
end


--Informations sur le lua
function conky_Version()
	return Version
end

function conky_Meteo_fichier_init()
	return fichier_init
end

function conky_Meteo_etat_MAJ()
	return MAJ
end


--Sauvegarde des données
function sauvegarde()

--sauvegarde prévision
	for j = 1,jours do
		local file = assert(io.open(repsauv.."/prevision"..j, "w+"))
		file:write ("\n")
		local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "Temp", "TempRes", "ProbPrec", "VentDir", "VentP", "VentForce", "VentRafales", "Uv", "ProbOrage", "NivPrec", "QPluie", "QNeige", "Icone", "VentIcone", "RafalesIcone", "EVerglas"}
		for i = 1, 21 do
			file:write (conditionJour[j][t[i]], "\n")
		end
		t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "Temp", "TempRes", "ProbPrec", "VentDir", "VentP", "VentForce", "VentRafales", "ProbOrage", "NivPrec", "QPluie", "QNeige", "Icone", "VentIcone", "RafalesIcone", "EVerglas"}
		for i = 1, 20 do
			file:write (conditionNuit[j][t[i]], "\n")
		end
		t= {"Jour", "LeverSoleilH", "LeverSoleilM", "CoucherSoleilH", "CoucherSoleilM", "Histo_Max", "Histo_Min"}
		for i = 1, 7 do
			file:write (InfoJour[j][t[i]], "\n")
		end
		io.close(file)

		if matin == "oui" then
			local file = assert(io.open(repsauv.."/matin"..j, "w+"))
			file:write ("\n")
			local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "TempMax", "TempMin", "TempMaxR", "TempMinR", "ProbPrec", "VentDir", "VentP", "VentForce", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite", "Icone", "VentIcone"}
			for i = 1, 21 do
				file:write (conditionMatin[j][t[i]], "\n")
			end
			io.close(file)
		end
		if apresmidi == "oui" then
			local file = assert(io.open(repsauv.."/ApresMidi"..j, "w+"))
			file:write ("\n")
			local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "TempMax", "TempMin", "TempMaxR", "TempMinR", "ProbPrec", "VentDir", "VentP", "VentForce", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite", "Icone", "VentIcone"}
			for i = 1, 21 do
				file:write (conditionAM[j][t[i]], "\n")
			end
			io.close(file)
		end
		if soiree == "oui" then
			local file = assert(io.open(repsauv.."/Soiree"..j, "w+"))
			file:write ("\n")
			local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "TempMax", "TempMin", "TempMaxR", "TempMinR", "ProbPrec", "VentDir", "VentP", "VentForce", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite", "Icone", "VentIcone"}
			for i = 1, 21 do
				file:write (conditionSoiree[j][t[i]], "\n")
			end
			io.close(file)
		end
		if nuit == "oui" then
			local file = assert(io.open(repsauv.."/Nuit"..j, "w+"))
			file:write ("\n")
			local t = {"CondMeteo", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "TempMax", "TempMin", "TempMaxR", "TempMinR", "ProbPrec", "VentDir", "VentP", "VentForce", "QPluie", "QNeige", "Humidite", "CouvNuage", "PointRosee", "Visibilite", "Icone", "VentIcone"}
			for i = 1, 21 do
				file:write (conditionNoct[j][t[i]], "\n")
			end
			io.close(file)
		end
	end

	if huit == "oui" then
		for j = 1,8 do
			local file = assert(io.open(repsauv.."/huitHeures"..j, "w+"))
			file:write ("\n")
			local t = {"Heure", "Icone", "TempMax", "TempMaxR", "VentDir", "VentForce", "Humidite", "CouvNuage", "PointRosee", "UV", "Pluie", "Neige", "Verglas", "VentP", "VentIcone"}
			for i = 1, 15 do
				file:write (huitHeures[j][t[i]], "\n")
			end
			io.close(file)
		end
	end			

--sauvegarde lunaison
	local file = assert(io.open(repsauv.."/lunaison", "w+"))
	file:write ("\n", ephemerides, "\n")
	file:write (ephemerides1, "\n")
	file:write (ephemerides2, "\n")
	file:write (Visibilite, "\n")
	file:write (Phases, "\n")
	file:write (Phases1, "\n")
	file:write (Phases2, "\n")
	file:write (Noeud_lunaire, "\n")
	file:write (Apogee, "\n")
	file:write (Perigee, "\n")
	file:write (Distance, "\n")
	file:write (Age, "\n")
	file:write (Lever_LuneHeure, "\n")
	file:write (Lever_LuneMinute, "\n")
	file:write (Coucher_LuneHeure, "\n")
	file:write (Coucher_LuneMinute, "\n")
	file:write (Eclipse_partielle, "\n")
	file:write (Eclipse_total, "\n")
	io.close(file)
	
--Sauvegarde condition courante
	local file = assert(io.open(repsauv.."/CondCour", "w+") )
	file:write ("\n")
	local t = {"Icone", "Tempr", "Temp", "Cond", "CondMeteo1", "CondMeteo2", "CondMeteo1se", "CondMeteo2se", "VentDir", "VentPlein", "VentForce", "VentIcone", "Humidite", "PointRosee", "Pression", "Visibilite", "Date", "Ville", "CouvNuage", "Uv", "QPrec", "latitude", "longitude"}
	for i = 1,23 do
		file:write (conditioncourante[t[i]], "\n")
	end
	file:write (time, "\n")
	io.close(file)

--modification des droits utilisateur
	os.execute('chmod o+rw- '..r..'/*lun*')
	os.execute('chmod -R o+rw- '..repsauv)
	os.execute('chmod -R o+rw- '..Rep)
end

clock_rings.lua, sans les ring temperature que l'on voit sur la photos plus haut. Car vu qu'il ne marchait pas ...

--[[
Clock Rings by londonali1010 (2009)

This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement near the end of the script uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
	lua_load ~/.conky/conky22/script/clock_rings-v1.1.1.lua
	lua_draw_hook_pre clock_rings

Changelog:
+ v1.1.1 -- Fixed minor bug that caused the script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.1 -- Added colour option for clock hands (07.10.2009)
+ v1.0 -- Original release (30.09.2009)
]]

settings_table = {
	{
		-- Edit this table to customise your rings.
		-- You can create more rings simply by adding more elements to settings_table.
		-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
		name='time',
		-- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
		arg='%I.%M',
		-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
		max=12,
		-- "bg_colour" is the colour of the base ring.
		bg_colour=0x666666,
		-- "bg_alpha" is the alpha value of the base ring.
		bg_alpha=0.1,
		-- "fg_colour" is the colour of the indicator part of the ring.
		fg_colour=0xFF6600,
		-- "fg_alpha" is the alpha value of the indicator part of the ring.
		fg_alpha=0.9,
		-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
		x=150, y=150,
		-- "radius" is the radius of the ring.
		radius=135,
		-- "thickness" is the thickness of the ring, centred around the radius.
		thickness=4,
		-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
		start_angle=0,
		-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
		end_angle=360
	},
	{
		name='time',
		arg='%M.%S',
		max=60,
		bg_colour=0x666666,
		bg_alpha=0.9,
		fg_colour=0xFF6600,
		fg_alpha=0.5,
		x=150, y=150,
		radius=140,
		thickness=4,
		start_angle=0,
		end_angle=360
		
	},
	{
		name='time',
		arg='%S',
		max=60,
		bg_colour=0x666666,
		bg_alpha=0.3,
		fg_colour=0xFF6600,
		fg_alpha=0.3,
		x=150, y=150,
		radius=145,
		thickness=4,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=150,
		radius=80,
		thickness=130,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFFFFFF,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=150,
		radius=1,
		thickness=10,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=24,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=35,
		thickness=27,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=85, y=150,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=24,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=35,
		thickness=27,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=215, y=150,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=19,
		thickness=1,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=0.1,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=33,
		thickness=22,
		start_angle=0,
		end_angle=360
	},
	{
		name='eval',
		arg='1',
		max=1,
		bg_colour=0xFF6600,
		bg_alpha=1.0,
		fg_colour=0xFFFFFF,
		fg_alpha=0.0,
		x=150, y=75,
		radius=1,
		thickness=2,
		start_angle=0,
		end_angle=360
	},   
	{
        	name='cpu',
        	arg='cpu0',
        	max=100,
      	        bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=60, y=415,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='memperc',
        	arg='',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=85, y=470,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='swapperc',
        	arg='',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=110, y=524,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='fs_used_perc',
        	arg='/',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=135, y=578,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='fs_used_perc',
        	arg='/home/maan',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xFF6600,
        	fg_alpha=0.8,
        	x=160, y=632,
        	radius=25,
        	thickness=7,
        	start_angle=-90,
        	end_angle=180
    	},
    	{
        	name='downspeedf',
        	arg='eth0',
        	max=1000,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0x339900,
        	fg_alpha=0.8,
        	x=235, y=660,
        	radius=26,
        	thickness=7,
        	start_angle=-90,
        	end_angle=190
    	},
        {
        	name='upspeedf',
        	arg='eth0',
        	max=100,
        	bg_colour=0xffffff,
        	bg_alpha=0.2,
        	fg_colour=0xff6600,
        	fg_alpha=0.8,
        	x=235, y=660,
        	radius=18,
        	thickness=5,
        	start_angle=-90,
        	end_angle=190
    	}, 	 
	}

-- Use these settings to define the origin and extent of your clock.

clock_r=127

-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.

clock_x=150
clock_y=150

-- Colour & alpha of the clock hands

clock_colour=0xFF6600
clock_alpha=1

-- Do you want to show the seconds hand?

show_seconds=true

require 'cairo'

function rgb_to_r_g_b(colour,alpha)
	return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function draw_ring(cr,t,pt)
	local w,h=conky_window.width,conky_window.height

	local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
	local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

	local angle_0=sa*(2*math.pi/360)-math.pi/2
	local angle_f=ea*(2*math.pi/360)-math.pi/2
	local t_arc=t*(angle_f-angle_0)

	-- Draw background ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
	cairo_set_line_width(cr,ring_w)
	cairo_stroke(cr)

	-- Draw indicator ring

	cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
	cairo_stroke(cr)
end

function draw_clock_hands(cr,xc,yc)
	local secs,mins,hours,secs_arc,mins_arc,hours_arc
	local xh,yh,xm,ym,xs,ys

	secs=os.date("%S")
	mins=os.date("%M")
	hours=os.date("%I")

	secs_arc=(2*math.pi/60)*secs
	mins_arc=(2*math.pi/60)*mins+secs_arc/60
	hours_arc=(2*math.pi/12)*hours+mins_arc/12

	-- Draw hour hand

	xh=xc+0.7*clock_r*math.sin(hours_arc)
	yh=yc-0.7*clock_r*math.cos(hours_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xh,yh)

	cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
	cairo_set_line_width(cr,5)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(clock_colour,clock_alpha))
	cairo_stroke(cr)

	-- Draw minute hand

	xm=xc+clock_r*math.sin(mins_arc)
	ym=yc-clock_r*math.cos(mins_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xm,ym)

	cairo_set_line_width(cr,3)
	cairo_stroke(cr)

	-- Draw seconds hand

	if show_seconds then
		xs=xc+clock_r*math.sin(secs_arc)
		ys=yc-clock_r*math.cos(secs_arc)
		cairo_move_to(cr,xc,yc)
		cairo_line_to(cr,xs,ys)

		cairo_set_line_width(cr,1)
		cairo_stroke(cr)
	end
end

function conky_clock_rings()
	local function setup_rings(cr,pt)
		local str=''
		local value=0

		str=string.format('${%s %s}',pt['name'],pt['arg'])
		str=conky_parse(str)

		value=tonumber(str)
		if value == nil then value = 0 end
		pct=value/pt['max']

		draw_ring(cr,pct,pt)
	end

	-- Check that Conky has been running for at least 5s

	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)	

	local updates=conky_parse('${updates}')
	update_num=tonumber(updates)

	if update_num>5 then
		for i in pairs(settings_table) do
			setup_rings(cr,settings_table[i])
		end
	end

	draw_clock_hands(cr,clock_x,clock_y)
end

multi_rings.lua

--==============================================================================
--                            multi_rings.lua
--
--  author  : SLK
--  version : v2011011601
--  license : Distributed under the terms of GNU GPL version 2 or later
--
--==============================================================================

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    clock DATA
-- HOURS
clock_h = {
    {
    name='time',                   arg='%H',                    max_value=12,
    x=150,                           y=150,
    graph_radius=140,
    graph_thickness=3,
    graph_unit_angle=30,           graph_unit_thickness=5,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    txt_radius=100,
    txt_weight=1,                  txt_size=10.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=125,
    graduation_thickness=10,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0x00FF00, graduation_fg_alpha=0.5,
    },
}
-- MINUTES
clock_m = {
    {
    name='time',                   arg='%M',                    max_value=60,
    x=150,                           y=150,
    graph_radius=100,
    graph_thickness=3,
    graph_unit_angle=6,            graph_unit_thickness=3,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    txt_radius=100,
    txt_weight=0,                  txt_size=9.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=57,
    graduation_thickness=0,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    },
}
-- SECONDS
clock_s = {
    {
    name='time',                   arg='%S',                    max_value=60,
    x=150,                           y=150,
    graph_radius=50,
    graph_thickness=3,
    graph_unit_angle=6,            graph_unit_thickness=3,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    txt_radius=100,
    txt_weight=0,                  txt_size=12.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=0,
    graduation_thickness=0,        graduation_mark_thickness=0,
    graduation_unit_angle=0,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    },
}

--------------------------------------------------------------------------------
--                                                                    gauge DATA
gauge = {
{
    name='cpu',                    arg='cpu0',                  max_value=100,
    x=85,                       y=150,
    graph_radius=14,
    graph_thickness=27,
    graph_start_angle=0,
    graph_unit_angle=3.5,          graph_unit_thickness=3.0,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00CFB3,       hand_fg_alpha=1.0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=27,
    graduation_thickness=4,        graduation_mark_thickness=4,
    graduation_unit_angle=30,
    graduation_fg_colour=0x00FF00, graduation_fg_alpha=1.0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.0,
},
{
    name='memperc',                arg='',                      max_value=100,
    x=215,                        y=150,
    graph_radius=14,
    graph_thickness=27,
    graph_start_angle=0,
    graph_unit_angle=3.5,          graph_unit_thickness=3.0,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00CFB3,       hand_fg_alpha=1.0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=27,
    graduation_thickness=4,        graduation_mark_thickness=4,
    graduation_unit_angle=30,
    graduation_fg_colour=0x00FF00, graduation_fg_alpha=1.0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.0,
},
{
    name='fs_used_perc',                arg='/',                      max_value=100,
    x=150,                        y=75,
    graph_radius=10,
    graph_thickness=23,
    graph_start_angle=0,
    graph_unit_angle=3.5,          graph_unit_thickness=3.0,
    graph_bg_colour=0xFFFFFF,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.0,
    hand_fg_colour=0x00CFB3,       hand_fg_alpha=1.0,
    txt_radius=1,
    txt_weight=0,                  txt_size=8.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.0,
    graduation_radius=22,
    graduation_thickness=4,        graduation_mark_thickness=4,
    graduation_unit_angle=30,
    graduation_fg_colour=0x00FF00, graduation_fg_alpha=1.0,
    caption='',
    caption_weight=1,              caption_size=8.0,
    caption_fg_colour=0xFFFFFF,    caption_fg_alpha=0.0,
},
}

-------------------------------------------------------------------------------
--                                                                 rgb_to_r_g_b
-- converts color in hexa to decimal
--
function rgb_to_r_g_b(colour, alpha)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

-------------------------------------------------------------------------------
--                                                            angle_to_position
-- convert degree to rad and rotate (0 degree is top/north)
--
function angle_to_position(start_angle, current_angle)
    local pos = current_angle + start_angle
    return ( ( pos * (2 * math.pi / 360) ) - (math.pi / 2) )
end

-------------------------------------------------------------------------------
--                                                              draw_clock_ring
-- displays clock
--
function draw_clock_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']

    -- background ring
    cairo_arc(display, x, y, graph_radius, 0, 2 * math.pi)
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = (value % max_value)
    local i = 1
    while i <= val do
        cairo_arc(display, x, y, graph_radius,(  ((graph_unit_angle * i) - graph_unit_thickness)*(2*math.pi/360)  )-(math.pi/2),((graph_unit_angle * i) * (2*math.pi/360))-(math.pi/2))
        cairo_set_source_rgba(display,rgb_to_r_g_b(graph_fg_colour,graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = (graph_unit_angle * i) - graph_unit_thickness

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = 360 / graduation_unit_angle
        local i = 1
        while i <= nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            cairo_arc(display, x, y, graduation_radius, (((graduation_unit_angle * i)-(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2),(((graduation_unit_angle * i)+(graduation_mark_thickness/2))*(2*math.pi/360))-(math.pi/2))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * (math.cos((angle * 2 * math.pi / 360)-(math.pi/2)))
    local movey = txt_radius * (math.sin((angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight);
    cairo_set_font_size (display, txt_size);
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha));
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3);
    cairo_show_text (display, value);
    cairo_stroke (display);
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_ring
-- displays gauges
--
function draw_gauge_ring(display, data, value)
    local max_value = data['max_value']
    local x, y = data['x'], data['y']
    local graph_radius = data['graph_radius']
    local graph_thickness, graph_unit_thickness = data['graph_thickness'], data['graph_unit_thickness']
    local graph_start_angle = data['graph_start_angle']
    local graph_unit_angle = data['graph_unit_angle']
    local graph_bg_colour, graph_bg_alpha = data['graph_bg_colour'], data['graph_bg_alpha']
    local graph_fg_colour, graph_fg_alpha = data['graph_fg_colour'], data['graph_fg_alpha']
    local hand_fg_colour, hand_fg_alpha = data['hand_fg_colour'], data['hand_fg_alpha']
    local graph_end_angle = (max_value * graph_unit_angle) % 360

    -- background ring
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, 0), angle_to_position(graph_start_angle, graph_end_angle))
    cairo_set_source_rgba(display, rgb_to_r_g_b(graph_bg_colour, graph_bg_alpha))
    cairo_set_line_width(display, graph_thickness)
    cairo_stroke(display)

    -- arc of value
    local val = value % (max_value + 1)
    local start_arc = 0
    local stop_arc = 0
    local i = 1
    while i <= val do
        start_arc = (graph_unit_angle * i) - graph_unit_thickness
        stop_arc = (graph_unit_angle * i)
        cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
        cairo_set_source_rgba(display, rgb_to_r_g_b(graph_fg_colour, graph_fg_alpha))
        cairo_stroke(display)
        i = i + 1
    end
    local angle = start_arc

    -- hand
    start_arc = (graph_unit_angle * val) - (graph_unit_thickness * 2)
    stop_arc = (graph_unit_angle * val)
    cairo_arc(display, x, y, graph_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
    cairo_set_source_rgba(display, rgb_to_r_g_b(hand_fg_colour, hand_fg_alpha))
    cairo_stroke(display)

    -- graduations marks
    local graduation_radius = data['graduation_radius']
    local graduation_thickness, graduation_mark_thickness = data['graduation_thickness'], data['graduation_mark_thickness']
    local graduation_unit_angle = data['graduation_unit_angle']
    local graduation_fg_colour, graduation_fg_alpha = data['graduation_fg_colour'], data['graduation_fg_alpha']
    if graduation_radius > 0 and graduation_thickness > 0 and graduation_unit_angle > 0 then
        local nb_graduation = graph_end_angle / graduation_unit_angle
        local i = 0
        while i < nb_graduation do
            cairo_set_line_width(display, graduation_thickness)
            start_arc = (graduation_unit_angle * i) - (graduation_mark_thickness / 2)
            stop_arc = (graduation_unit_angle * i) + (graduation_mark_thickness / 2)
            cairo_arc(display, x, y, graduation_radius, angle_to_position(graph_start_angle, start_arc), angle_to_position(graph_start_angle, stop_arc))
            cairo_set_source_rgba(display,rgb_to_r_g_b(graduation_fg_colour,graduation_fg_alpha))
            cairo_stroke(display)
            cairo_set_line_width(display, graph_thickness)
            i = i + 1
        end
    end

    -- text
    local txt_radius = data['txt_radius']
    local txt_weight, txt_size = data['txt_weight'], data['txt_size']
    local txt_fg_colour, txt_fg_alpha = data['txt_fg_colour'], data['txt_fg_alpha']
    local movex = txt_radius * math.cos(angle_to_position(graph_start_angle, angle))
    local movey = txt_radius * math.sin(angle_to_position(graph_start_angle, angle))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, txt_weight)
    cairo_set_font_size (display, txt_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
    cairo_move_to (display, x + movex - (txt_size / 2), y + movey + 3)
    cairo_show_text (display, value)
    cairo_stroke (display)

    -- caption
    local caption = data['caption']
    local caption_weight, caption_size = data['caption_weight'], data['caption_size']
    local caption_fg_colour, caption_fg_alpha = data['caption_fg_colour'], data['caption_fg_alpha']
    local tox = graph_radius * (math.cos((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    local toy = graph_radius * (math.sin((graph_start_angle * 2 * math.pi / 360)-(math.pi/2)))
    cairo_select_font_face (display, "ubuntu", CAIRO_FONT_SLANT_NORMAL, caption_weight);
    cairo_set_font_size (display, caption_size)
    cairo_set_source_rgba (display, rgb_to_r_g_b(caption_fg_colour, caption_fg_alpha))
    cairo_move_to (display, x + tox + 5, y + toy + 1)
    -- bad hack but not enough time !
    if graph_start_angle < 105 then
        cairo_move_to (display, x + tox - 30, y + toy + 1)
    end
    cairo_show_text (display, caption)
    cairo_stroke (display)
end

-------------------------------------------------------------------------------
--                                                               go_clock_rings
-- loads data and displays clock
--
function go_clock_rings(display)
    local function load_clock_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_clock_ring(display, data, value)
    end
    
    for i in pairs(clock_h) do
        load_clock_rings(display, clock_h[i])
    end
    for i in pairs(clock_m) do
        load_clock_rings(display, clock_m[i])
    end
    for i in pairs(clock_s) do
        load_clock_rings(display, clock_s[i])
    end
end

-------------------------------------------------------------------------------
--                                                               go_gauge_rings
-- loads data and displays gauges
--
function go_gauge_rings(display)
    local function load_gauge_rings(display, data)
        local str, value = '', 0
        str = string.format('${%s %s}',data['name'], data['arg'])
        str = conky_parse(str)
        value = tonumber(str)
        draw_gauge_ring(display, data, value)
    end
    
    for i in pairs(gauge) do
        load_gauge_rings(display, gauge[i])
    end
end

-------------------------------------------------------------------------------
--                                                                         MAIN
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)
    local display = cairo_create(cs)
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then
        go_clock_rings(display)
        go_gauge_rings(display)
    end

end

Comme tu vois  sur mon sreem postez ci-dessus tout est en place sauf que dans les rings il n'y a aucune réaction.
Le top dans mon esprit serait que dans les rings il puisse y avoir différente couleur genre :
--vert quand c'est bon
--orange quand on atteint les 45/50°C
--rouge quand il faut que j'arrête  tout avant de tout cramer  tongue

Dernière modification par maan (Le 05/11/2012, à 11:02)


Ubuntu_studio 14.04

Hors ligne

#1985 Le 05/11/2012, à 18:01

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@maan
Je ne suis pas sur d'avoir bien compris; mais je sais qu'il existe des scripts lua que tu devras configurer manuellement afin de les disposer comme tu veux...?
rings.lua:image_anneaux

Hors ligne

#1986 Le 05/11/2012, à 19:23

maan

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@ ragamatrix
Bin en fait je n'arrivais pas à faire afficher mes niveaux dans mes cercles,
mais j'ai réussi à trouver, en fait c'est que je ne mettais  dans "name" et "arg" des valeurs qui n’était pas reconnu.
Mais à force de persister j'ai trouver .........  tongue

Pour ma dernière question,
c'est comment dans un même cercle, faire démarrer par une couleur (verte) pour finir à l'autre bout du cercle par une autre couleur (rouge)

Voilà car en fait ça ne fait que depuis cette semaine que j'ai découvert les conkys, et je découvre aussi le monde du script ...  roll


Ubuntu_studio 14.04

Hors ligne

#1987 Le 05/11/2012, à 23:47

pαηdørα

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonsoir,
  Suite au changement de mon ordinateur portable je me suis replongé dans conky ( merci au passage pour vos idées/astuces qui sont fort utile big_smile). Mais je rencontre quelque difficultés et/où me pose des questions:

1°) J'aimerai intégré à mon conky de droite (conkyrc) l'indicateur de bureau or le problème qui gère pas les "•" (du à la police choisi pour faire les test) il m'indique pas sur quel bureau je suis mais le premier "•" change de couleur quand je suis sur les bureaux 2,3,4 mais redeviens blanc quand je suis sur le premier ce qui est très embêtant lol avez vous une idée du pourquoi ?

2°) J'ai trouvé l'idée de cherrak (page 72 post 1787) d'utiliser une image comme "support" pour les conky très intéressante mais je n'arrive pas à faire que mon conky de gauche et celui de droite se superpose sur l'image choisie en arrière plan sur mon conky du haut, comment peut-on arrivé a un même rendu ?(j'utilise la même image pour effectuer les test et comprendre le fonctionnement)

Voici mes conky et le rendu pas fini(les couleurs et la police datent de mes premiers conky de ma période violet/vert lol)
capture2zt.png

conkyrc:

######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1

imlib_cache_size 0
double_buffer yes
no_buffers yes


#####################
# - Text settings - #
#####################
use_xft yes
xftfont Ubuntu:style=Bold:size=8
override_utf8_locale yes
text_buffer_size 2048

#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type overside
own_window_argb_value 180
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

alignment top_right
gap_x 10
gap_y 50
minimum_size 830 200
maximum_width 200

default_bar_size 60 8

#########################
# - Graphics settings - #
#########################
draw_shades no
draw_graph_borders no

lua_load /home/lucas/Documents/conky/test/script.lua
lua_draw_hook_pre main_bars



TEXT

${voffset 30}${color F3BEF14}${offset 37}${font Ink Swipes BRK:size=18}Processeur:
${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}coeur 1: ${color F3BEF14}${cpu cpu0}%
${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}coeur 2: ${color F3BEF14}${cpu cpu1}%
${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}coeur 3: ${color F3BEF14}${cpu cpu2}%
${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}coeur 4: ${color F3BEF14}${cpu cpu3}%

${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}ram: ${color F3BEF14}${memperc}%

${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}swap: ${color F3BEF14}${swapperc}%


${color F3BEF14}${goto 00}${font Ink Swipes BRK:size=18}Alimentation${font}
${color 3BEF14}${font Ink Swipes BRK:size=10}Charge :${color F3BEF14}${font Ink Swipes BRK:size=10}${battery_short BAT1}
${color 3BEF14}${font Ink Swipes BRK:size=10}Autonomie : ${color F3BEF14}${battery_time BAT1}

${voffset 30}${color F3BEF14}${offset 37}${font Ink Swipes BRK:size=18}Network
${color F3BEF14}${font Ink Swipes BRK:size=12}LAN
${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}Up: ${color F3BEF14}${upspeedf eth0} kb/s
${voffset 4}${color 3BEF14}${font Ink Swipes BRK:size=10}Down: ${color F3BEF14}${downspeedf eth0} kb/s

${color F3BEF14}${font Ink Swipes BRK:size=12}Wifi
${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}Up: ${color F3BEF14}${upspeedf wlan0} kb/s
${voffset 4}${color 3BEF14}${font Ink Swipes BRK:size=10}Down: ${color F3BEF14}${downspeedf wlan0} kb/s

${color 3BEF14}${font Ink Swipes BRK:size=10}IP Publique : ${color F3BEF14}${execi 600 wget -O - http://ip.tupeux.com | tail}
${color 3BEF14}${font Ink Swipes BRK:size=10}IP locale: ${color F3BEF14}${addr wlan0}

${voffset 30}${color F3BEF14}${offset 37}${font Ink Swipes BRK:size=18}Temperature
${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}linux: ${color F3BEF14}${execi 10 hddtemp -n /dev/sda}C
${voffset -6}${color 3BEF14}${font Ink Swipes BRK:size=10}data: ${color F3BEF14}${execi 10 hddtemp -n /dev/sdb}C
${color 3BEF14}${font Ink Swipes BRK:size=10}carte graph: ${color F3BEF14}${texeci 30 aticonfig --od-gettemperature | grep Temperature |cut -c43-47}C

${if_match ${desktop}==1}${color1}${endif}•${color}${offset 10}${if_match ${desktop}==2}${color1}${endif}•${color}${offset 10}${if_match ${desktop}==3}${color1}${endif}•${color}${offset 10}${if_match ${desktop}==4}${color1}${endif}•${color}

conkyrc2:

######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1

imlib_cache_size 0
double_buffer yes
no_buffers yes
format_human_readable
draw_graph_borders no

#####################
# - Text settings - #
#####################
use_xft yes
xftfont Ubuntu:style=Bold:size=8
override_utf8_locale yes
text_buffer_size 2048

#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type overside
own_window_argb_value 180
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

alignment top_left
gap_x 0
gap_y 0
minimum_size 300 500
maximum_width 200

default_bar_size 60 8

#########################
# - Graphics settings - #
#########################
draw_shades no




TEXT



${color F3BEF14}${font Ink Swipes BRK:size=18}Disques durs:
${voffset 8}${color 3BEF14}${font Ink Swipes BRK:size=10}racine : ${color F3BEF14}${fs_free /home}/${fs_size /home} 
${voffset 8}${color 3BEF14}${font Ink Swipes BRK:size=10}windows :${color F3BEF14}${if_mounted /media/windows}${fs_free //media/windows}/${fs_size //media/windows}$endif
${voffset 8}${color 3BEF14}${font Ink Swipes BRK:size=10}data :${color F3BEF14}${if_mounted /media/data}${fs_free //media/data}/${fs_size //media/data}$endif
${voffset 8}${color 3BEF14}${font Ink Swipes BRK:size=10}usb1 :${color F3BEF14}${if_mounted /media/usb1}${fs_free //media/usb1}/${fs_size //media/usb1}$endif
${voffset 8}${color 3BEF14}${font Ink Swipes BRK:size=10}usb2 :${color F3BEF14}${if_mounted /media/usb2}${fs_free //media/usb2}/${fs_size //media/usb2}$endif
${voffset 8}${color 3BEF14}${font Ink Swipes BRK:size=10}usb3 :${color F3BEF14}${if_mounted /media/usb3}${fs_free //media/usb3}/${fs_size //media/usb3}$endif
${voffset 8}${color 3BEF14}${font Ink Swipes BRK:size=10}usb4 :${color F3BEF14}${if_mounted /media/usb4}${fs_free //media/usb4}/${fs_size //media/usb4}$endif

${voffset 30}${color F3BEF14}${offset 37}${font Ink Swipes BRK:size=18}Mails:
${color 3BEF14}${font Ink Swipes BRK:size=9}Gmail: ${color F3BEF14}${execi 60 python /home/lucas/Documents/conky/test/conkygmail.py}${color F3BEF14}

${if_mounted /media/usb3}${voffset 8}${color 3BEF14}${font Ink Swipes BRK:size=10}usb3 :${color F3BEF14}${fs_free //media/usb3}/${fs_size //media/usb3}$endif
${goto 5} ${font Ink Swipes BRK:size=10}${color 3BEF14}Nom:     ${goto 85}CPU  ${goto 135}${font Ink Swipes BRK:size=10}${font Ink Swipes BRK:size=10}RAM
${goto 10} ${font Ink Swipes BRK:size=10}${color 3BEF14}${top_mem name 1}    ${goto 85}${color F3BEF14}${top_mem cpu 1}    ${goto 135}${top_mem mem 1}
${goto 10} ${color 3BEF14}${top_mem name 2}    ${goto 85}${color F3BEF14}${top_mem cpu 2}    ${goto 135}${top_mem mem 2}
${goto 10} ${color 3BEF14}${top_mem name 3}    ${goto 85}${color F3BEF14}${top_mem cpu 3}    ${goto 135}${top_mem mem 3}
${goto 10} ${color 3BEF14}${top_mem name 4}    ${goto 85}${color F3BEF14}${top_mem cpu 4}    ${goto 135}${top_mem mem 4}

conkyrc3:

######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1

imlib_cache_size 0
double_buffer yes
no_buffers yes
format_human_readable
draw_graph_borders no

#####################
# - Text settings - #
#####################
use_xft yes
xftfont Calibri Bold Caps:size=8
override_utf8_locale yes
text_buffer_size 2048

#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type overside
own_window_argb_value 180
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

alignment top_left
gap_x 0
gap_y 0
minimum_size 1920 1080
maximum_width 1920

default_bar_size 60 8

#########################
# - Graphics settings - #
#########################
draw_shades no

default_color 6D6D6D             

TEXT
####################
# - Clock Center - #
####################
${image /home/lucas/Documents/conky/source/conky/Top_Bar/images/background2.png -s 1920x1080 -p 0,0}
${voffset -10}${goto 10}${font Ink Swipes BRK:size=15} ${color 3BEF14}Ewilan ${goto 950}${color 3BEF14${font Ink Swipes BRK:size=10}Musique: ${font}${if_running banshee}${color1}Artiste : ${color5}${exec conkyBanshee --datatype=AR}${color1}Album   : $color5${exec conkyBanshee --datatype=AL}${color1}Titre   : $$color5${exec conkyBanshee --datatype=TI}${color1}Durée   : $$color5${exec conkyBanshee --datatype=PT} / ${exec conkyBanshee --datatype=LE}${exec conkyBanshee -n -d PP}%${color1}${execibar 1 conkyBanshee --datatype=PP}${else}${color5}pas de musique $endif${goto 1850}${voffset -10}${font Ink Swipes BRK:size=15}${color 3BEF14${time %I:%M %P}${offset -90}${voffset 12}${font Ink Swipes BRK:size=10}${time  %B %d}

MSI GX60-1AC-001FR
A10 (2.4GHz)/8GHz RAM/1 To
Multiboot: Linux Mint 13/Windows seven

Hors ligne

#1988 Le 06/11/2012, à 08:00

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

pαηdørα a écrit :

2°) J'ai trouvé l'idée de cherrak (page 72 post 1787) d'utiliser une image comme "support" pour les conky très intéressante mais je n'arrive pas à faire que mon conky de gauche et celui de droite se superpose sur l'image choisie en arrière plan sur mon conky du haut, comment peut-on arrivé a un même rendu ?(j'utilise la même image pour effectuer les test et comprendre le fonctionnement)

Même problème que toi. Impossible de superposer correctement une image affichée par conky par dessus mon fond d'écran.
Essaye de mettre le paramètre own_window_argb_visual à "no" et own_window_transparent à "yes". Et de faire le même test en mettant "no" au 2.

Cerrak a chargé son fond d'écran en entier. j'ai testé mais conky passe de 2% à 10% de CPU, donc j'ai abandonné l'idée.


Cyril

Hors ligne

#1989 Le 06/11/2012, à 12:50

fanchois

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour a tous,
je débute en conky et j'essaye d'y inclure une image mais le texte est superposé dessus...
je ne vois pas l'option a entrer dans image  ou la façon de décaler le reste pour voir mon image,
quelqu'un connait la solution?

alignment top_right
background yes
border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white

#clignotement
double_buffer yes

draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=12
gap_x 5
gap_y 5

minimum_size 5 5
net_avg_samples 2

# no_buffers yes

out_to_console no
out_to_stderr no

extra_newline no

own_window yes
own_window_class Conky
# own_window_type   override  # type de fenêtre "maison" (le type desktop convient si on n'a pas d'ombre)
own_window_type desktop
# own_window_hints  undecorated,below,sticky,skip_taskbar,skip_pager # définition du type 

stippled_borders 0

update_interval 1.0

uppercase no

use_spacer none

show_graph_scale no
show_graph_range no

TEXT
${image $HOME/Bureau/WGET/pgplot.png -s 400x400}
$hr
${scroll 16 $nodename - $sysname $kernel on $machine | }
$hr 

${color grey}Uptime:$color $uptime
${color grey}Frequency (in MHz):$color $freq
${color grey}Frequency (in GHz):$color $freq_g
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
$hr
${color grey}File systems:
 / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color grey}Networking:
Up:$color ${upspeed eth0} ${color grey} - Down:$color ${downspeed eth0}
$hr
${color grey}Name              PID   CPU%   MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}

Hors ligne

#1990 Le 06/11/2012, à 13:20

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@maan
J'ai trouvé dans un de mes scripts lua une explication pour modifier les couleurs...Par contre je ne sais pas si cela pourra convenir à ton script.
Pour choisir tes couleurs tu peux aller ici
C'est la valeur hex que tu dois modifier du genre (dans le script lua) :

 bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}}, 

Exemple :

 {
	name="time",
	arg="%S",
	max=60,
	xc=250,
	yc=100,
	thickness=20,
	radius=60,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	}, 

Je ne suis pas encore sur que c'est cela que tu cherchais, ça peut peut-être servir...
Bon bricolage wink

Hors ligne

#1991 Le 06/11/2012, à 13:30

ragamatrix

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

fanchois a écrit :

Bonjour a tous,
je débute en conky et j'essaye d'y inclure une image mais le texte est superposé dessus...
je ne vois pas l'option a entrer dans image  ou la façon de décaler le reste pour voir mon image,
quelqu'un connait la solution?

alignment top_right
background yes
border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white

#clignotement
double_buffer yes

draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
use_xft yes
xftfont DejaVu Sans Mono:size=12
gap_x 5
gap_y 5

minimum_size 5 5
net_avg_samples 2

# no_buffers yes

out_to_console no
out_to_stderr no

extra_newline no

own_window yes
own_window_class Conky
# own_window_type   override  # type de fenêtre "maison" (le type desktop convient si on n'a pas d'ombre)
own_window_type desktop
# own_window_hints  undecorated,below,sticky,skip_taskbar,skip_pager # définition du type 

stippled_borders 0

update_interval 1.0

uppercase no

use_spacer none

show_graph_scale no
show_graph_range no

TEXT
${image $HOME/Bureau/WGET/pgplot.png -s 400x400}
$hr
${scroll 16 $nodename - $sysname $kernel on $machine | }
$hr 

${color grey}Uptime:$color $uptime
${color grey}Frequency (in MHz):$color $freq
${color grey}Frequency (in GHz):$color $freq_g
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
$hr
${color grey}File systems:
 / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
${color grey}Networking:
Up:$color ${upspeed eth0} ${color grey} - Down:$color ${downspeed eth0}
$hr
${color grey}Name              PID   CPU%   MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}

Salut !
Après la dimension de ton image tu joues avec ces paramètres (x=16=déplacement horizontal) (y=150=déplacement vertical) 16,150 (-)pour monter plus tu augmentes plus tu descends

 ${image $HOME/Bureau/WGET/pgplot.png -s 400x400 -16,150 }  

J'ai bon ?...Je ne suis pas l'expert ici...:)

Hors ligne

#1992 Le 06/11/2012, à 13:54

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

fanchois a écrit :

Bonjour a tous,
je débute en conky et j'essaye d'y inclure une image mais le texte est superposé dessus...
je ne vois pas l'option a entrer dans image  ou la façon de décaler le reste pour voir mon image,
quelqu'un connait la solution?

Deux possibilités pour compléter la réponse de ragamatrix :
soit tu insères autant de ligne que possible pour descendre le texte sous l'image, l'équivalent de 400px (puisque c'est la taille de l'image en hauteur)
soit tu utilises ${voffset} pour décaler le texte sous


Cyril

Hors ligne

#1993 Le 06/11/2012, à 15:44

maan

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

ragamatrix a écrit :

@maan
J'ai trouvé dans un de mes scripts lua une explication pour modifier les couleurs...Par contre je ne sais pas si cela pourra convenir à ton script.
Pour choisir tes couleurs tu peux aller ici
C'est la valeur hex que tu dois modifier du genre (dans le script lua) :

 bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}}, 

Exemple :

 {
	name="time",
	arg="%S",
	max=60,
	xc=250,
	yc=100,
	thickness=20,
	radius=60,
	sectors=20,
	bg_colour1={{0,0xFFFFFF,0.1},{0.5,0xFFFFFF,0.4},{1,0xFFFFFF,0.1}},
	fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1.0},{1,0x00FF00,0.1}},
	fg_colour2={{0,0xFF0000,0.1},{0.5,0xFF0000,1.0},{1,0xFF0000,0.1}},
	}, 

Je ne suis pas encore sur que c'est cela que tu cherchais, ça peut peut-être servir...
Bon bricolage wink

Salut et merci de prendre un peu de ton temps.
Donc ce script je connais et j'ais essayer mais ça ne marche pas .....
j'ai réessayer en mettant au tout début dans "settings_table", le descriptif avec l’écriture et valeur .... mais toujours rien !!!

Mais merci encore je continu de bidouiller et tester si tu as d'autres idées je prends tongue


Ubuntu_studio 14.04

Hors ligne

#1994 Le 06/11/2012, à 18:18

pαηdørα

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

sunkart a écrit :

[...] Essaye de mettre le paramètre own_window_argb_visual à "no" et own_window_transparent à "yes". Et de faire le même test en mettant "no" au 2.

J'ai fait les test cité mais le seul changement qui se produit est quand on met "no" à own_window_transparent (ce qui est logique lol ) qui est l'apparition d'un rectangle noir comme fond pour ce conky.

sunkart a écrit :

Cerrak a chargé son fond d'écran en entier. j'ai testé mais conky passe de 2% à 10% de CPU, donc j'ai abandonné l'idée.

Quand tu dit que Cerrak à changé son fond d'écran en entier tu entend quoi par là ?

Sinon quelqu'un d'autre à une petite idée pour ce problème ci ou l'autre ?


MSI GX60-1AC-001FR
A10 (2.4GHz)/8GHz RAM/1 To
Multiboot: Linux Mint 13/Windows seven

Hors ligne

#1995 Le 06/11/2012, à 21:00

sunkart

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

pαηdørα a écrit :
sunkart a écrit :

Cerrak a chargé son fond d'écran en entier. j'ai testé mais conky passe de 2% à 10% de CPU, donc j'ai abandonné l'idée.

Quand tu dit que Cerrak à changé son fond d'écran en entier tu entend quoi par là ?

Sinon quelqu'un d'autre à une petite idée pour ce problème ci ou l'autre ?

Il fait affcher une image de la taille du fond d'écran par Conky.


Cyril

Hors ligne

#1996 Le 07/11/2012, à 12:29

fanchois

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

sunkart a écrit :

Deux possibilités pour compléter la réponse de ragamatrix :
soit tu insères autant de ligne que possible pour descendre le texte sous l'image, l'équivalent de 400px (puisque c'est la taille de l'image en hauteur)
soit tu utilises ${voffset} pour décaler le texte sous

Salut smile
la solution du ${voffset 400} apparait comme la plus "a des couettes"
Merci a vous smile

je me retrouve maintenant avec un autre petit souci:

je cherche a actualiser toutes les heures l'image que j'ai inséré dans mon conky avec une tache 'cron'
donc toutes les heures cron relance un script que refais mon image et actualise mon conky avec cette commande (trouvée sur un forum)

killall -SIGUSR1 conky

seulement ça marche pô, cette commande actualise effectivement le conky mai ne charge pas la nouvelle image...

auriez vous une solution autre que

killall conky
conky

Hors ligne

#1997 Le 07/11/2012, à 12:50

Phyllinux

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

fanchois a écrit :
sunkart a écrit :

Deux possibilités pour compléter la réponse de ragamatrix :
soit tu insères autant de ligne que possible pour descendre le texte sous l'image, l'équivalent de 400px (puisque c'est la taille de l'image en hauteur)
soit tu utilises ${voffset} pour décaler le texte sous

Salut smile
la solution du ${voffset 400} apparait comme la plus "a des couettes"
Merci a vous smile

je me retrouve maintenant avec un autre petit souci:

je cherche a actualiser toutes les heures l'image que j'ai inséré dans mon conky avec une tache 'cron'
donc toutes les heures cron relance un script que refais mon image et actualise mon conky avec cette commande (trouvée sur un forum)

killall -SIGUSR1 conky

seulement ça marche pô, cette commande actualise effectivement le conky mai ne charge pas la nouvelle image...

auriez vous une solution autre que

killall conky
conky

As tu essayé de lancer ta commande d'affichage de l'image par un execi 3600 ?
Dans ce cas là, toutes les 3600 secondes, donc toutes les heures, le conky relance l'affichage de la commande.


The ship is sinking normally...

Hors ligne

#1998 Le 07/11/2012, à 13:26

fanchois

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Phyllinux a écrit :

As tu essayé de lancer ta commande d'affichage de l'image par un execi 3600 ?
Dans ce cas là, toutes les 3600 secondes, donc toutes les heures, le conky relance l'affichage de la commande.

tu veux dire remplacer dans le conky

${image $HOME/Bureau/WGET/plot.png -p 0,0 -s 400x350}

par

${execl 3600 ${image $HOME/Bureau/WGET/plot.png -p 0,0 -s 400x350}}

quelque chose comme ça?

EDIT:
ça a l'air d'être une bonne piste en effet, mais je ne parviens pas à avoir la bonne synthaxe, le terminal répond

sh: 1: image: not found

en utilisant:

${execl 15 image $HOME/Bureau/WGET/plot.png -p 0,0 -s 400x350}

à noter que la solution

killall conky
conky

marche quand je lance mon script a la main, mais pas avec cron:

Conky: received SIGINT or SIGTERM to terminate. bye!

Dernière modification par fanchois (Le 07/11/2012, à 13:40)

Hors ligne

#1999 Le 07/11/2012, à 14:47

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

Bonjour franchois,

ceci pourra t'aider

${image $HOME/Bureau/WGET/plot.png -p 0,0 -s 400x350 -f 3600}

demande à conky d'actualiser l'image toutes les heures

Hors ligne

#2000 Le 07/11/2012, à 15:29

Didier-T

Re : (4) Conky : Postez vos conkyrc ou certaines parties intéressantes

@ pαηdørα,

pαηdørα a écrit :

1°) J'aimerai intégré à mon conky de droite (conkyrc) l'indicateur de bureau or le problème qui gère pas les "•" (du à la police choisi pour faire les test) il m'indique pas sur quel bureau je suis mais le premier "•" change de couleur quand je suis sur les bureaux 2,3,4 mais redeviens blanc quand je suis sur le premier ce qui est très embêtant lol avez vous une idée du pourquoi ?

Si tu veux utiliser des raccourcis avec color et color1, il faut commencer par les définir dans la partie avant text (color = default_color).
par exemple tu pourrais choisir d'avoir le bureau courant en blanc et les autres en gris

default_color BEBEBE
color1 FFFFFF

Hors ligne