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.

#2051 Le 24/11/2012, à 06:40

Didier-T

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

maan a écrit :

bon ...... bin je doit mal m'y prendre car ça ne marche pas sad

peut tu montrer le retour d'info en Terminal.

Hors ligne

#2052 Le 24/11/2012, à 15:20

maan

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

je te mettrai ça mais pas aujourd'hui car il a démarrer sur les bon fichiers tongue

Par contre je pensais.... ne serait-il pas possible d'ecrire dans mon conkyrc après text des sugestions ......genre
temps core0 ici (chemin du fichier) et si ça ne marche pas allez chercher là (2eme chemin) .......

Mais vu mes connaissance en script ..... mais voilà je me pose la question avec des "if" et "esle"  ne srait-ce pas possible ?????


Ubuntu_studio 14.04

Hors ligne

#2053 Le 24/11/2012, à 15:28

Didier-T

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

maan a écrit :

je te mettrai ça mais pas aujourd'hui car il a démarrer sur les bon fichiers tongue

Par contre je pensais.... ne serait-il pas possible d'ecrire dans mon conkyrc après text des sugestions ......genre
temps core0 ici (chemin du fichier) et si ça ne marche pas allez chercher là (2eme chemin) .......

Mais vu mes connaissance en script ..... mais voilà je me pose la question avec des "if" et "esle"  ne srait-ce pas possible ?????

En fait, c'est un peut mon idée, mais pour voir si c'est réalisable, j'ai besoins des messages d'erreurs.
Ce sera pour le prochaine foi.

Hors ligne

#2054 Le 25/11/2012, à 09:09

Didier-T

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

Bonjour a tous,

Un petit chronographe entièrement personnalisable.
Si sa vous intéresse, je viens de finir la modification d'un script de mrpeachy et sector11

deux petits screen, histoire de montrer a quoi sa peut ressembler.
1353826902.png 1353861924.png

Toutes les aiguilles avance de manière régulière (sauf la trotteuse des secondes, qui du coups ne trotte pas mais saute).

chronographe.lua

--[[ multiple analogue clocks by Didier-T (forum Ubuntu.fr) - 25 Nov 2012
 Basé sur le travail de mrpeachy et Sector11

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

]]

require 'cairo'
--Position et taille horloge
local init={
{text={"Dim","Lun","Mar","Mer","Jeu","Ven","Sam"},
nb=7*24,
formule='jour',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=90,
text_radius=45,
point_radius=32,
hand_length=28,
point_ray=0.5
},
{text={""},
nb="",
formule='jour_num',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=90,
center_y=175,
text_radius=45,
point_radius=35,
hand_length=28,
point_ray=0.5
},
{text={"Jan","Fév","Mar","Avr","Mai","Jui","Jul","Aôu","Sep","Oct","Nov","Déc"},
nb="",
formule='mois',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=260,
center_y=175,
text_radius=45,
point_radius=32,
point_ray=1,
hand_length=28
},
{text={"00","01","02","03","04","05","06","07","08","09","10","11"},
nb=12*3600,
formule='heure',
police="monofur",
taille=15,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFFFF00,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFFFF00,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=175,
text_radius=165,
point_radius=150,
hand_length=125,
point_ray=1
},
{text={"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""},
nb=3600,
formule='minute',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xF00000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xF00000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=175,
text_radius=170,
point_radius=150,
point_ray=0,
hand_length=135
},
{text={"","01","02","03","04","","06","07","08","09","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59"},
nb=60,
formule='secondes',
police="Ubuntu",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0x000000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0x000000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.5,
center_x=175,
center_y=175,
text_radius=160,
point_radius=150,
point_ray=0.5,
hand_length=0
},
}

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 cr = cairo_create(cs)
  local extents=cairo_text_extents_t:create()
  tolua.takeownership(extents)
  local h, min, sec=time()
  local jour, jour_num, mois, nb_jour=date()

  if tonumber(conky_parse('${updates}'))>3 then
    for i in pairs(init) do
      draw(cr, extents, init[i], h, min, sec, jour, jour_num, mois, nb_jour)
    end
  end

  cairo_destroy(cr)
  cairo_surface_destroy(cs)
  cr=nil
  collectgarbage()
end

function draw(cr, extents, value, h, min, sec, jour, jour_num, mois, nb_jour)
  local pos
  local nb=tonumber(table.getn(value.text))
  cairo_select_font_face (cr, value.police, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
  cairo_set_font_size (cr, value.taille)
-- Section Horloge
  if value.formule=="heure" then
    pos=heure(h, min, sec)
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==h then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="minute" then 
    pos=minute(min, sec)
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==min then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="secondes" then
    pos=sec
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==sec then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
-- Section date
  elseif value.formule=="mois" then
    value.nb, pos=month()
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if i==mois then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="jour_num" then
    value.nb=nb_jour*24
    nb=nb_jour
    pos=day(jour-1)
    for i=1, nb_jour do
      if math.mod(i, 2) == 0 then
        text=string.format("%02d",i)
      else
        text=""
      end
      local j=i-1
      if i==jour then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="jour" then
    pos=(jour_num*24)+tonumber(os.date("%H"))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if i==jour_num+1 then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
    
-- Horloge avec personnalisée (non utilisé pour le moment)  
  else
    pos=tonumber(conky_parse(value.formule))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if tonumber(text)==pos then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, i, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, i, cr, value.point_ray)
      end
    end
  end
  hand(pos, value.nb, value.text_radius, value.hand_length, value.center_x, value.center_y, value.hand_color, value.hand_alpha, cr)
end

function date()
  local jour=tonumber(os.date("%d"))
  local jour_num=tonumber(os.date("%w"))
  local mois=tonumber(os.date("%m"))
  local nb_jour=tonumber(conky_parse("${exec echo $(($(date --date '1 month' +%j)-$(date +%j)))}"))
  return jour, jour_num, mois, nb_jour
end

function day(jour)
  local hjour=(jour*24)+tonumber(os.date("%H"))
  return hjour
end

function month()
  local nb_jours_annee=tonumber(conky_parse("${exec echo $(date --date '31 Dec' +%j)}"))
  local jour_annee=tonumber(conky_parse("${exec echo $(date +%j)}"))
  return nb_jours_annee, jour_annee
end

function time()
  local h=tonumber(os.date("%I"))
  local min=tonumber(os.date("%M"))
  local sec=tonumber(os.date("%S"))
  return h, min, sec
end

function heure(h, min, sec)
  local hs=(h*3600)+(min*60)+sec
  return hs
end

function minute(min, sec)
  local m=(min*60)+sec
  return m
end

function rgb_to_r_g_b(col,alp)
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

function texte(police, taille, text, nb, radius, center_x, center_y, color, alpha, i, extents, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_text_extents(cr,text,extents)
  local width=extents.width
  local height=extents.height
  cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
  cairo_show_text (cr, text)
  cairo_stroke (cr)
end

function point(nb, radius, center_x, center_y, color, alpha, i, cr, ray)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_arc (cr,center_x+x,center_y+y,ray,0,2*math.pi)
  cairo_stroke (cr)
end

function hand(pos, nb, radius, hand_length, center_x, center_y, color, alpha, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(pos))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x,center_y)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_stroke (cr)
end

draw-bg.lua

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

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

so:

Above and After TEXT  (requires a composite manager or it blinks!)

 lua_load ~/wea_conky/draw_bg.lua
 TEXT
 ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.4}

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

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

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

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

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

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

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

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

${lua luacal {settings}}

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

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

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

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

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

.conkyrc

# To use #! in a conky use: ${exec echo '#!'}
# ${font DS\-Digital:bold:size=24}
# OS: ${pre_exec lsb_release -d | cut -c14-50}
# killall conky && conky -c ~/Conky/S11_Chronograph.conky &
# Thank you - mrpeachy

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky
#own_window_colour gray
own_window_class Conky
own_window_title Chronograph

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

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

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

minimum_size 350 350   #Taille minimum (px) ; largeur / hauteur
maximum_width 350 350      #Largeur maximum (px)

gap_x 0 #15        ### left &right
gap_y 100        ### up & down

alignment tm #ml
####################################################  End Window Settings  ###
###  Font Settings  ##########################################################
# Use Xft (anti-aliased font and stuff)
use_xft yes
xftfont CorporateMonoExtraBold:size=9

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

draw_shades no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
default_shade_color gray
default_outline_color black

default_color DCDCDC #220 220 220	Gainsboro
color0 8FBC8F #143 188 143	DarkSeaGreen
color1 778899 #119 136 153	LightSlateGray
color2 FF8C00 #255 140   0	DarkOrange
color3 7FFF00 #127 255   0	Chartreuse
color4 FFA07A #255 160 122	LightSalmon
color5 FFDEAD #255 222 173	NavajoWhite
color6 00BFFF #  0 191 255	DeepSkyBlue
color7 00FFFF #  0 255 255	Cyan
color8 FFFF00 #255 255   0	Yellow
color9 B22222 #178  34  34	FireBrick
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 0
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background none

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

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

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

# change GiB to G and MiB to M
short_units yes

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

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

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

lua_load ~/.conky/conky-perso/Chronographe/LUA/chronographe.lua
lua_draw_hook_post main
lua_load ~/.conky/conky-perso/Chronographe/LUA/draw-bg.lua

update_interval 1

TEXT
${voffset 200}${color red}${font caviar dreams:style=Bold:size=5}${alignc}TOP CPU
${font Consolas:size=5}${color green2}${alignc}${top name 1}${top cpu 1} %
${alignc}${color lightgrey}${top name 2}${top cpu 2} % 
${alignc}${color lightgrey}${top name 3}${top cpu 3} % 
${alignc}${color lightgrey}${top name 4}${top cpu 4} %
${voffset 3}${color red}${font caviar dreams:style=Bold:size=5}${alignc}TOP RAM 
${font Consolas:size=5}${color red}${alignc}${top_mem name 1}${top_mem mem 1} %
${alignc}${color lightgrey}${top_mem name 2}${top_mem mem 2} %
${alignc}${color lightgrey}${top_mem name 3}${top_mem mem 3} %
${alignc}${color lightgrey}${top_mem name 4}${top_mem mem 4} %
#${lua conky_draw_bg 20 0 55 0 590 0x000000 0.4}
${lua conky_draw_bg 175 0 0 350 350 0x000000 0.3}
${lua conky_draw_bg 60 115 30 120 120 0x000000 0.2}
${lua conky_draw_bg 59 31 116 118 118 0x000000 0.2}
${lua conky_draw_bg 59 201 116 118 118 0x000000 0.2}
${lua conky_draw_bg 59 116 201 118 118 0x000000 0.2}

Edit : petites modifications sur le chronographe.lua et ajout d'une seconde capture

Dernière modification par Didier-T (Le 25/11/2012, à 18:48)

Hors ligne

#2055 Le 25/11/2012, à 20:06

samytou

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

bonjour à tous, je vous présente mon conky sur ubuntu 12.04
mini_121126073737788118.png
modération merci de mettre des miniatures

règles a écrit :

Mise en forme des messages
2   Les images de la taille d'une vignette (approximativement 300x300) peuvent être postées. Veuillez utiliser un lien ou une miniature pour les images plus grandes (certains hébergeurs d'images en créent automatiquement, comme Toile-libre ou Casimages).

désolé, fait.

Dernière modification par samytou (Le 26/11/2012, à 20:39)

Hors ligne

#2056 Le 26/11/2012, à 16:55

Sector11

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

Didier-T a écrit :

Bonjour a tous,

Edit : petites modifications sur le chronographe.lua et ajout d'une seconde capture

Very nice! Consider it C4'd - some of it looks so familiar.  big_smile

I've been working on a different concept - code is still a mess.
When I clean it up I'll post it.

abjyI60i.jpg
Left to right:

  1. Greek - 24HR - with part second hand.

  2. Spanish - 24HR - second hand

  3. English - 12HR - with second hand & seconds

  4. French - 12HR - with second hand - no seconds

Dernière modification par Sector11 (Le 26/11/2012, à 17:01)

Hors ligne

#2057 Le 26/11/2012, à 18:06

Didier-T

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

Sector11 a écrit :

Very nice! Consider it C4'd - some of it looks so familiar.  big_smile

I've been working on a different concept - code is still a mess.
When I clean it up I'll post it.

http://t.imgbox.com/abjyI60i.jpg
Left to right:

  1. Greek - 24HR - with part second hand.

  2. Spanish - 24HR - second hand

  3. English - 12HR - with second hand & seconds

  4. French - 12HR - with second hand - no seconds

Le rendu visuel est vraiment bien.
Je me demande si tu as réussi à rendre le Chronographe plus petit... certainement.
je vais regarder de mon coté, pour permettre d'avoir un bout d'aiguille de manière à rendre possible la reproduction visuelle de ton travaille.

Hors ligne

#2058 Le 26/11/2012, à 18:56

Sector11

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

Didier-T a écrit :

Le rendu visuel est vraiment bien.
Je me demande si tu as réussi à rendre le Chronographe plus petit... certainement.
je vais regarder de mon coté, pour permettre d'avoir un bout d'aiguille de manière à rendre possible la reproduction visuelle de ton travaille.

Merci.  It could be made smaller, with a different font (notice the jue mer [Thursday Wednesday] in the Fench version).  I think because of that the font "may" undergo a change.  Haven't decided yet.

Since the "inactive" names and numbers are at "alpha 0.2" and the active one at "alpha 1.0" - it could be made smaller with names and numbers overlaping a bit as it's the current day/number that is highlighted ....

Idea change while typing this response: font remains ... more work coming - inactive alpha = 0.0 and much smaller!

Thanks for the idea Dedier-T

Dernière modification par Sector11 (Le 26/11/2012, à 21:32)

Hors ligne

#2059 Le 26/11/2012, à 21:31

Sector11

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

@ Dedier-T

OK this is just for show again as I have to "clean up" the code:
I made The Clock smaller.

abv7b35y.jpg

"Green centre" is the clock in development.  Left Shadowed day number so the number of days per month is visible. Bottom centre is the size difference - changed two font calls.

month | day names = CorporateMonoExtraBold
month numbers = Liquid Crystal
HR numbers = DS-Digital

Dernière modification par Sector11 (Le 26/11/2012, à 21:31)

Hors ligne

#2060 Le 26/11/2012, à 21:56

Didier-T

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

Script Chronographe retravaillé.

1353959640.png

Chronographe.lua

--[[ multiple analogue clocks by Didier-T (forum Ubuntu.fr) - 25 Nov 2012
 Basé sur le travail de mrpeachy et Sector11
26 Nov - ajout hand_gap et hand_larg Didier-T

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

]]

require 'cairo'
--Position et taille horloge
local init={
{text={"Dim","Lun","Mar","Mer","Jeu","Ven","Sam"},
nb=7*24,
formule='jour',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=90,
text_radius=45,
point_radius=32,
hand_gap=0,
hand_larg=1,
hand_length=28,
point_ray=0.5
},
{text={""},
nb="",
formule='jour_num',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=90,
center_y=175,
text_radius=45,
point_radius=35,
hand_gap=0,
hand_larg=1,
hand_length=28,
point_ray=0.5
},
{text={"Jan","Fév","Mar","Avr","Mai","Jui","Jul","Aôu","Sep","Oct","Nov","Déc"},
nb="",
formule='mois',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=260,
center_y=175,
text_radius=45,
point_radius=32,
point_ray=1,
hand_gap=0,
hand_larg=1,
hand_length=28
},
{text={"00","01","02","03","04","05","06","07","08","09","10","11"},
nb=12*3600,
formule='heure',
police="monofur",
taille=15,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFFFF00,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFFFF00,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=175,
text_radius=165,
point_radius=150,
hand_gap=0,
hand_length=110,
hand_larg=3,
point_ray=1
},
{text={"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""},
nb=3600,
formule='minute',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xF00000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xF00000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=175,
text_radius=170,
point_radius=150,
point_ray=0,
hand_gap=-20,
hand_larg=2,
hand_length=135
},
{text={"","01","02","03","04","","06","07","08","09","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59"},
nb=60,
formule='secondes',
police="Ubuntu",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0x000000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFF0000,
hand_alpha=0.5,
center_x=175,
center_y=175,
text_radius=160,
point_radius=150,
point_ray=0.5,
hand_gap=150,
hand_larg=4,
hand_length=165
},
}

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 cr = cairo_create(cs)
  local extents=cairo_text_extents_t:create()
  tolua.takeownership(extents)
  local h, min, sec=time()
  local jour, jour_num, mois, nb_jour=date()

  if tonumber(conky_parse('${updates}'))>3 then
    for i in pairs(init) do
      draw(cr, extents, init[i], h, min, sec, jour, jour_num, mois, nb_jour)
    end
  end

  cairo_destroy(cr)
  cairo_surface_destroy(cs)
  cr=nil
  collectgarbage()
end

function draw(cr, extents, value, h, min, sec, jour, jour_num, mois, nb_jour)
  local pos
  local nb=tonumber(table.getn(value.text))
  cairo_select_font_face (cr, value.police, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
  cairo_set_font_size (cr, value.taille)
-- Section Horloge
  if value.formule=="heure" then
    pos=heure(h, min, sec)
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==h then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="minute" then 
    pos=minute(min, sec)
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==min then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="secondes" then
    pos=sec
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==sec then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
-- Section date
  elseif value.formule=="mois" then
    value.nb, pos=month()
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if i==mois then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="jour_num" then
    value.nb=nb_jour*24
    nb=nb_jour
    pos=day(jour-1)
    for i=1, nb_jour do
      if math.mod(i, 2) == 0 then
        text=string.format("%02d",i)
      else
        text=""
      end
      local j=i-1
      if i==jour then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="jour" then
    pos=(jour_num*24)+tonumber(os.date("%H"))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if i==jour_num+1 then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
    
-- Horloge avec personnalisée (non utilisé pour le moment)  
  else
    pos=tonumber(conky_parse(value.formule))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if tonumber(text)==pos then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, i, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, i, cr, value.point_ray)
      end
    end
  end
  hand(pos, value.nb, value.text_radius, value.hand_length, value.hand_gap, value.hand_larg, value.center_x, value.center_y, value.hand_color, value.hand_alpha, cr)
end

function date()
  local jour=tonumber(os.date("%d"))
  local jour_num=tonumber(os.date("%w"))
  local mois=tonumber(os.date("%m"))
  local nb_jour=tonumber(conky_parse("${exec echo $(($(date --date '1 month' +%j)-$(date +%j)))}"))
  return jour, jour_num, mois, nb_jour
end

function day(jour)
  local hjour=(jour*24)+tonumber(os.date("%H"))
  return hjour
end

function month()
  local nb_jours_annee=tonumber(conky_parse("${exec echo $(date --date '31 Dec' +%j)}"))
  local jour_annee=tonumber(conky_parse("${exec echo $(date +%j)}"))
  return nb_jours_annee, jour_annee
end

function time()
  local h=tonumber(os.date("%I"))
  local min=tonumber(os.date("%M"))
  local sec=tonumber(os.date("%S"))
  return h, min, sec
end

function heure(h, min, sec)
  local hs=(h*3600)+(min*60)+sec
  return hs
end

function minute(min, sec)
  local m=(min*60)+sec
  return m
end

function rgb_to_r_g_b(col,alp)
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

function texte(police, taille, text, nb, radius, center_x, center_y, color, alpha, i, extents, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_text_extents(cr,text,extents)
  local width=extents.width
  local height=extents.height
  cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
  cairo_show_text (cr, text)
  cairo_stroke (cr)
end

function point(nb, radius, center_x, center_y, color, alpha, i, cr, ray)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_arc (cr,center_x+x,center_y+y,ray,0,2*math.pi)
  cairo_stroke (cr)
end

function hand(pos, nb, radius, hand_length, hand_gap, largeur, center_x, center_y, color, alpha, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(pos))
  local x_gap=0+hand_gap*(math.sin(point))
  local y_gap=0-hand_gap*(math.cos(point))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x+x_gap,center_y+y_gap)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_set_line_width (cr,largeur)
  cairo_set_line_cap  (cr, CAIRO_LINE_CAP_ROUND)
  cairo_stroke (cr)
end

Hors ligne

#2061 Le 27/11/2012, à 02:03

Sector11

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

abv7b35y.jpg

The_S11_Clock.lua:

--[[ multiple analogue clocks by mrpeachy - 18 Jun 2012
 21 Jun 2012 - Chronograph modifications by Sector11
 22 Jun 2012 - again with mrpeachy's help day names, numbers and month names
 12 Nov 2012 - memory leak plugged - mrpeachy
 14 Nov 2012 - Personnalisation - Didier-T (forum Ubuntu.fr)
 26 Nov 2012 - The Clock - Sector11 (small version)

use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

 -- INDEX
 -- ### CLOCK POSITION - AND DEFAULTS ###
 -- ### SET BORDER OPTIONS FOR "CLOCKS" ### -- I don't know how to remove this - NOT NEEDED
 --     See lines 39 to 41 for overall size changes
 -- ### START DIAL B ### Day Names Dial ###
 --     See Lines 84 - 87 and 131 for changes
 -- ### START DIAL C ### Month Names Dial ###
 --     See Lines 150 -153 and 198 for changes
 -- ### START DIAL D ### Day Numbers Dial ###
 --     See Lines 234 & 265 for  changes
 -- ### START CLOCK A ###
 --     See Lines  &  and 441 & 467 changes
 -- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
 -- CLOCK A HOUR HAND
 -- CLOCK A MINUTE HAND SETUP
 -- CLOCK A SECOND HAND SETUP

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

require 'cairo'
 -- ### CLOCK POSITION - AND DEFAULTS ##########################################
local init={
center_x=135,
center_y=135,
radius=118,
lang="English", -- English French Greek Spanish
hour=24, -- 12 | 24
second=true, --true | false - Seconds: dots and numbers IF 12HR
line=true, -- true | false - Part Second Hand
color=0xFF0000, --color for day, day number and month IF NO SECOND HAND
alpha=1 --alpha for day, day number and month IF NO SECOND HAND
}

 -- ONLY NEED ONE COPY OF THIS FUNCTION
function rgb_to_r_g_b(col,alp)
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end
local colr, colg, colb, cola=rgb_to_r_g_b(init.color,init.alpha)

function conky_main()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local extents=cairo_text_extents_t:create()
tolua.takeownership(extents)

 -- ### CLOCK 12|24 HR SELECTOR ############################
local clock_type_A=init.hour
 -- ############################ CLOCK 12|24 HR SELECTOR ###

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

 -- ### START DIAL B ### Day Names Dial ####################
 -- DIAL POSITION
local center_x=init.center_x
local center_y=init.center_y
local radius=22
 -- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14)
 -- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Sun","Mon","Tue","Wed","Thr","Fri","Sat",} end
if init.lang == "French" then text_days={"dim","lun","mar","mer","jeu","ven","sam",} end
if init.lang == "Greek" then text_days={"ΔΕΥ","ΤΡΙ","ΤΕΤ","ΠΕΜ","ΠΑΡ","ΣΑΒ","ΚΥΡ",} end
if init.lang == "Spanish" then text_days={"dom","lun","mar","mie","jue","vie","sab",} end

local day_number=tonumber(os.date("%w"))
if init.handday == true then
  for i=1,7 do
 -- work out points
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
else
  for i=1,7 do -- working out points
    if day_number == i-1 then
      cairo_set_source_rgba (cr,0,1,1,1) -- active colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.0) -- non-active day names
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=7
  for i=1,7 do
    if day_number == i-1 then
      cairo_set_source_rgba (cr,0,1,1,1) -- active colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.0) -- non-active
    end
    local point=(math.pi/180)*((360/7)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
 -- ######################################### END DIAL B ###

 -- ### START DIAL C ### Month Names Dial ##################
 -- DIAL POSITION
local center_x=init.center_x --(+85)
local center_y=init.center_y
local radius=53
 -- FONT
cairo_select_font_face (cr, "CorporateMonoExtraBold", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 14)
 -- TABLE OF TEXT -- in order
if init.lang == "English" then text_days={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",} end
if init.lang == "French" then text_days={"jan","fév","mar","avr","mai","jui","jul","aôu","sep","oct","nov","déc",} end
if init.lang == "Greek" then text_days={"ΙΑΝ","ΦΕΒ","ΜΑΡ","ΑΠΡ","ΜΑΙ","ΙΟΥ","ΙΟΥ","ΑΥΓ","ΣΕΠ","ΟΚΤ","ΝΟΕ","ΔΕΚ",} end
if init.lang == "Spanish" then text_days={"ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic",} end

local this_month=tonumber(os.date("%m"))
if init.handmonth == true then
  for i=1,12 do
 -- OUTER POINTS POSTION FOR -- ### START DIAL D ## TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
else
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,0,1,1,1) -- active month colour
    else
      cairo_set_source_rgba (cr,1,1,1,0.0) -- non-active month names
    end
 -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=38
  for i=1,12 do
    if this_month == i then
      cairo_set_source_rgba (cr,0,1,1,1) -- active colour
	 else
      cairo_set_source_rgba (cr,1,1,1,0.0) -- dots for non-active month names
    end
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
end
 -- ######################################### END DIAL C ###

 -- ### START DIAL D ### Day Numbers Dial ##################
 -- GET NUMBER OF DAYS IN CURRENT MONTH
 -- calculate Feb, then set up table
year4num=os.date("%Y")
t1=os.time({year=year4num,month=03,day=01,hour=00,min=0,sec=0});
t2=os.time({year=year4num,month=02,day=01,hour=00,min=0,sec=0});
if init.hour == 12 then
  febdaynum=tonumber((os.difftime(t1,t2))/(12*60*60))
else
  febdaynum=tonumber((os.difftime(t1,t2))/(24*60*60))
end
 -- MONTH TABLE
monthdays={31,febdaynum,31,30,31,30,31,31,30,31,30,31}
this_month=tonumber(os.date("%m"))
number_days=monthdays[this_month]
 -- TEXT positioning
local center_x=init.center_x
local center_y=init.center_y
local radius=85
cairo_select_font_face (cr, "Liquid Crystal", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 20)
local this_day=tonumber(os.date("%d"))
  for i=1,number_days do
 -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    --only print even numbers
    if math.mod(i, 2) == 0 and math.mod(this_day, 2)==0 then
    text=string.format("%02d",i) --formats numbers to double digits
    elseif math.mod(i, 2) ~= 0 and math.mod(this_day, 2)~=0 then
    text=string.format("%02d",i) --formats numbers to double digits
    else
    text=""
    end --odd even matching
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
	if i==this_day then
     cairo_set_source_rgba (cr,0,1,1,1) -- active colour
	else
	cairo_set_source_rgba (cr,1,1,1,0.2) -- dim inactive numbers
	end
     cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
     cairo_show_text (cr, text)
     cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=70
  for i=1,number_days do
    local point=(math.pi/180)*((360/number_days)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
	if i==this_day then
     cairo_set_source_rgba (cr,0,1,1,1) -- active colour
	else
	cairo_set_source_rgba (cr,1,1,1,0.2) -- dim the points
	end
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_stroke (cr)
  end
 -- ######################################### END DIAL D ###

 -- ### START CLOCK A ######################################
 -- SET MARKS ###
 -- MARKS AROUND CLOCK A -- Large Main 24 HR Clock
local number_marks_A=init.hour
 -- set mark length
local m_length_A=0 -- doesn't work but can't delete
 -- set mark width
local m_width_A=0 -- doesn't work but can't delete
 -- set mark line cap type
local m_cap=CAIRO_LINE_CAP_ROUND
 -- set mark color and alpha,red blue green alpha
local mr,mg,mb,ma=1,1,1,0 -- opaque white -- doesn't work but can't delete
 -- SETUP HOUR HANDS ###
 -- CLOCK A HOUR HAND
hh_length_A=66
 -- set hour hand width
hh_width_A=4
 -- set hour hand line cap
hh_cap=CAIRO_LINE_CAP_ROUND
 -- set hour hand color
 -- hhr,hhg,hhb,hha=1,0,1,0 -- fully opaque white --doesn't work
 -- SETUP MINUTE HANDS ###
 -- CLOCK A MINUTE HAND SETUP
 -- set length of minute hand
mh_length_A=100
 -- set minute hand width
mh_width_A=2
 -- set minute hand line cap
mh_cap=CAIRO_LINE_CAP_ROUND
 -- set minute hand color
--mhr,mhg,mhb,mha=1,1,1,0.5 -- fully opaque white --doesn't work

 -- SETUP SECOND HAND ###
 -- CLOCK A SECOND HAND SETUP -- DOESN'T WORK - Why ???????????????????????????
 -- set length of seconds hand -- yes I know it is commented out!
--sh_length_A=150
 -- set hour hand width
--sh_width_A=2
 -- set hour hand line cap
--sh_cap=CAIRO_LINE_CAP_ROUND
 -- set seconds hand color
--shr,shg,shb,sha=1,0,0,1 -- fully opaque red

 -- PART SECOND HAND
--position
--get seconds value
local seconds=tonumber(os.date("%S"))
--calculate rotation of second hand in degrees
if init.line == true then
  local arc=(math.pi/180)*((360/60)*seconds)
  --calculate point 1
  local radius1=100
  local x1=0+radius1*math.sin(arc)
  local y1=0-radius1*math.cos(arc)
  --calculate point 2
  local radius2=107
  local x2=0+radius2*math.sin(arc)
  local y2=0-radius2*math.cos(arc)
  --draw line connecting points
  cairo_move_to (cr, center_x+x1,center_y+y1)
  cairo_line_to (cr, center_x+x2, center_y+y2)
  cairo_set_source_rgba (cr,255/255,0/255,0/255,1) -- PART SECOND HAND
  cairo_stroke (cr)
end

 -- CLOCK A ### 12 HR TIME ###
 -- CLOCK SETTINGS
clock_radius=0 --does not work
clock_centerx=init.center_x -- centre of Clock hands
clock_centery=init.center_y -- centre of Clock hands
 -- DRAWING CODE
 -- DRAW MARKS
 -- stuff that can be moved outside of the loop, needs only be set once
 -- calculate end and start radius for marks
m_end_rad=clock_radius-b_to_m
m_start_rad=m_end_rad-m_length_A -- WHAT IS THIS??
 -- set line cap type
cairo_set_line_cap  (cr, m_cap)
 -- set line width
cairo_set_line_width (cr,m_width_A)
 -- set color and alpha for marks
cairo_set_source_rgba (cr,mr,mg,mb,ma)
 -- START LOOP FOR HOUR MARKS
for i=1,number_marks_A do
 -- drawing code using the value of i to calculate degrees
 -- calculate start point for 12/24 hour mark
radius=m_start_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
 -- set start point for line
cairo_move_to (cr,clock_centerx+x,clock_centery+y)
 -- calculate end point for 12/24 hour mark
radius=m_end_rad
point=(math.pi/180)*((i-1)*(360/number_marks_A))
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
 -- set path for line
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
 -- draw the line
cairo_stroke (cr)
end -- of for loop
 -- HOUR MARKS -- ???????????????????????????????????????????????????????????????
 -- TIME CALCULATIONS CLOCK A
if clock_type_A==12 then
hours=tonumber(os.date("%I"))
 -- convert hours to seconds
h_to_s=hours*60*60
elseif clock_type_A==24 then
hours=tonumber(os.date("%H"))
 -- convert hours to seconds
h_to_s=hours*60*60
end
minutes=tonumber(os.date("%M"))
 -- convert minutes to seconds
m_to_s=minutes*60
 -- get current seconds
seconds=tonumber(os.date("%S"))
 -- DRAW HOUR HAND ###
 -- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
 -- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*clock_type_A)) -- use equation ~ eliminate decimals
 -- set radius to calculate hand points
radius=hh_length_A
 -- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
 -- calculate coordinates for end of hour hand
point=(math.pi/180)*hsec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
 -- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
 -- set up line attributes and draw line
cairo_set_line_width (cr,hh_width_A)
cairo_set_source_rgba (cr,0,1,1,0.7) -- active colour Hour Hand ================
cairo_set_line_cap  (cr, hh_cap)
cairo_stroke (cr)
 -- DRAW MINUTE HAND
 -- get minutes and seconds just as seconds
msecs=m_to_s+seconds
 -- calculate degrees for each second
msec_degs=msecs*0.1
 -- set radius to calculate hand points
radius=mh_length_A
 -- set start line coordinates, the center of the circle
cairo_move_to (cr,clock_centerx,clock_centery)
 -- calculate coordinates for end of minute hand
point=(math.pi/180)*msec_degs
x=0+radius*(math.sin(point))
y=0-radius*(math.cos(point))
 -- describe the line we will draw
cairo_line_to (cr,clock_centerx+x,clock_centery+y)
 -- set up line attributes and draw line
cairo_set_line_width (cr,mh_width_A)
cairo_set_source_rgba (cr,0,1,1,0.7) -- active colour Minute Hand ==============
cairo_set_line_cap  (cr, mh_cap)
cairo_stroke (cr)
 -- ### CLOCK A ###
local center_x=init.center_x -- Centre of the HR / Min Numbers
local center_y=init.center_y -- Centre of the HR / Min Numbers
local radius=init.radius -- 12/24 HR CLOCK Hours/Minutes radius -- seeline 42
cairo_select_font_face (cr, "DS-Digital", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, 22)
cairo_set_source_rgba (cr,1,1,1,1.0) -- HR Clock numbers
 -- TABLE OF TEXT -- in order
if init.hour == 12 then
  text_days={"12","01","02","03","04","05","06","07","08","09","10","11",}
  for i=1,12 do
 -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_set_source_rgba (cr,1,1,1,1.0)
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=101 -- 12 HR Clock
  for i=1,12 do
    local point=(math.pi/180)*((360/12)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_set_source_rgba (cr,1,1,1,0.5)
    cairo_stroke (cr)
  end
end
if init.hour == 24 then
  text_days={"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23",}
  for i=1,24 do
 -- OUTTER POINTS POSTION FOR TEXT
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
    local text=text_days[i]--gets text from table
    cairo_text_extents(cr,text,extents)
    local width=extents.width
    local height=extents.height
    cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
    cairo_show_text (cr, text)
    cairo_stroke (cr)
  end
 -- INNER POINTS POSITION, radius smaller than text circle
  local radius=101 -- 24 HR Clock
  for i=1,24 do
    local point=(math.pi/180)*((360/24)*(i-1))
    local x=0+radius*(math.sin(point))
    local y=0-radius*(math.cos(point))
    cairo_arc (cr,center_x+x,center_y+y,1,0,2*math.pi)
    cairo_set_source_rgba (cr,1,1,1,0.5)
    cairo_stroke (cr)
  end
end

 -- ############################################################################
 -- POSITION FOR TEXT HOUR NUMBERS
  if init.hour == 12 and init.second == true then
    text_days={"","01","02","03","04","","06","07","08","09","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59","",}
 -- INNER POINTS POSITION, radius smaller than text circle
    cairo_set_source_rgba (cr,1,1,1,0.2) -- does not work -- settings moved
    cairo_select_font_face (cr, "monofur", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
    for i=1,60 do
      local radius=100 -- dots for seconds A Clock
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
      if seconds == i-1 then
        cairo_set_source_rgba (cr,255/255,0/255,0/255,0.3) -- does not work - settings moved
      else
        if i-1 == 0 or i-1 == 5 or i-1 == 10 or i-1 == 15 or i-1 == 25 or i-1 == 30 or i-1 == 35 or i-1 == 40 or i-1 == 45 or i-1 == 50 or i-1 == 55 then
          cairo_set_source_rgba (cr,0,1,1,1) -- active colour
        else
          cairo_set_source_rgba (cr,0,1,1,0.5) -- dots for seconds A Clock
        end
      end
      cairo_arc (cr,center_x+x,center_y+y,1/2,0,2*math.pi)
      cairo_stroke (cr)
    end
    radius=radius-3
    cairo_set_font_size (cr, 10)
    for i=1,60 do
 -- OUTTER POINTS POSTION FOR TEXT
      local point=(math.pi/180)*((360/60)*(i-1))
      local x=0+radius*(math.sin(point))
      local y=0-radius*(math.cos(point))
 -- CALCULATE CENTRE OF TEXT
      local text=text_days[i]--gets text from table
      if seconds == tonumber(text) then
      cairo_set_source_rgba (cr,0,1,1,1.0) -- active colour
      else
        cairo_set_source_rgba (cr,1,1,1,0.0) -- seconds numbers
      end
      cairo_text_extents(cr,text,extents)
      local width=extents.width
      local height=extents.height
      cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
      cairo_show_text (cr, text)
      cairo_stroke (cr)
    end
  end
 -- ############################################################################
cairo_stroke (cr)
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
end -- end main function
# killall conky && conky -c ~/Conky/The_Clock.conky &
#
# Thank you:
# Chronograph LUA - mrpeachy (originally 4 clocks - tweaked by Sector11)
# v9000 LUA weather - mrpeachy
# background - londonali1010, mrpeachy, dk75
# mounted.lua - mrpeachy

###  Begin Window Settings  ##################################################
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_colour gray
own_window_class Conky
own_window_title Chronograph TEST

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

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

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

#minimum_size 420 420  ## width, height
#maximum_width 420     ## width

### For use with The-Clock.lua
minimum_size 264 264 ## width, height
maximum_width 264    ## width

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

### alignment values or top_left, bottom_right, etc
# tl, tm, tr
# ml, mm, mr
# bl, bm, br
alignment tl

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

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

uppercase no
######################################################  End Font Settings  ###
###  Color Settings  #########################################################
draw_shades no
default_shade_color black

draw_outline no # amplifies text if yes
default_outline_color black

default_color DCDCDC #220 220 220	Gainsboro
color0 8FBC8F #143 188 143	DarkSeaGreen
color1 C2CCFF # Not a clue - a blue #778899 #119 136 153	LightSlateGray
color2 FF8C00 #255 140   0	DarkOrange
color3 7FFF00 #127 255   0	Chartreuse
color4 FFA07A #255 160 122	LightSalmon
color5 FFDEAD #255 222 173	NavajoWhite
color6 00BFFF #  0 191 255	DeepSkyBlue
color7 00FFFF #  0 255 255	Cyan
color8 FFFF00 #255 255   0	Yellow
color9 B22222 #178  34  34	FireBrick
#####################################################  End Color Settings  ###
###  Borders Section  ########################################################
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_inner_margin 5
border_outer_margin 0
# border width
border_width 0
# graph borders
draw_graph_borders yes #no
#default_graph_size 15 40
#####################################################  End Borders Secton  ###
###  Miscellaneous Section  ##################################################
# Boolean value, if true, Conky will be forked to background when started.
background yes

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

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

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

# change GiB to G and MiB to M
short_units yes

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

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

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


imlib_cache_size 0

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

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

##############################################  End Miscellaneous Section  ###
###  LUA Settings  ###########################################################
## draw-bg.lua
##
lua_load ~/Chrono-TEST/LUA/draw-bg.lua
################### Chronograph ##############################################
lua_load ~/Chrono-TEST/LUA/The_S11_Clock.lua
lua_draw_hook_post main

##############################  End LUA Settings  ###
update_interval 1

TEXT
${lua conky_draw_bg 132 3 3 264 264 0x000000 0.5}
${lua conky_draw_bg 98 37 37 196 196 0xFFFFFF 0.2}
${lua conky_draw_bg 68 67 67 136 136 0x000000 0.4}
${lua conky_draw_bg 35 100 100 70 70 0x000000 0.3}

draw-bg.lua

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

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

so:

Above and After TEXT  (requires a composite manager or it blinks!)

 lua_load ~/wea_conky/draw_bg.lua
 TEXT
 ${lua conky_draw_bg 10 0 0 0 0 0x000000 0.4}

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

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

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

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

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

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

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

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

${lua luacal {settings}}

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

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

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

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


]]

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

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

Hors ligne

#2062 Le 27/11/2012, à 22:40

ferreol

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

Bonjour,
Un petit soucis pour afficher le cours de l'once d'or avec wget. Si quelqu'un peut m'expliquer pourquoi cea ne fonctionne pas je précise je maitrise mal le WGET :

${goto 50}XAU ${execi 3600 wget -q -O - "http://www.forexpros.fr/currencies/xau-usd"|grep "<quotes_summary_secondary_data">"|sed 's/<[^>]*>//g'}

1354049327.png

1354049211.png

Merci par avance de m'expliquer si possible.

Jusque la j'avais réussi en pompant a droite a gauche  EUR / USD , programme TV , Météo

Dernière modification par ferreol (Le 27/11/2012, à 22:49)

Hors ligne

#2063 Le 27/11/2012, à 23:15

ljere

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

je pense que c'est ton grep qui est mal placé pour

wget -q -O - "http://www.forexpros.fr/currencies/xau-usd"|grep "Clôture préc"|sed 's/<[^>]*>//g'
				Clôture préc.: 1748.75
Clôture préc.1748.75Achat1742.10Ecart1740.55 - 1752.05Ouverture1748.75Vente1742.6052 Semaines1522.85 - 1795.95

ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne

#2064 Le 27/11/2012, à 23:46

ferreol

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

merci c 'est mieux en effet et sais tu comment couper le Grep après disons 1748.75

Hors ligne

#2065 Le 28/11/2012, à 00:07

ljere

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

j'utiliserai

| cut -c14-18 |

je te laisse faire


ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne

#2066 Le 28/11/2012, à 00:35

maan

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

Didier-T a écrit :
maan a écrit :

bon ...... bin je doit mal m'y prendre car ça ne marche pas sad

peut tu montrer le retour d'info en Terminal.


bon ce soir c'est repartit tongue

voici le resultat terminal

 conky -c Conkyrc_Clock_Meteo
WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-AcY1X7/pkcs11: No such file or directory
Conky: can't open '/sys/class/hwmon/hwmon2/temp3_input': No such file or directory
please check your device or remove this var from Conky
Conky: Error destroying thread
Conky: Error destroying thread
Conky: Error destroying thread
Conky: Error destroying thread
***** Imlib2 Developer Warning ***** :
	This program is calling the Imlib call:

	imlib_context_free();

	With the parameter:

	context

	being NULL. Please fix your program.

en sachant que les déplacements ne se font qu'à 2 endroits

-- 1ere version                                                  -- 2eme version

-- Core0  hwmon 1 temp 2                                 -- hwmon 2 temp 2
-- Core1  hwmon 1 temp 3                                 -- hwmon 2 temp 3
-- Cpu     hwmon 2 temp 1                                 -- hwmon 1 temp 1
-- M/b      hwmon 2 temp 2                                 -- hwmon 1 temp 2
-- Gpu     hwmon 3 temp 2                                 -- hwmon 3 temp 2
-- Cpu     hwmon 2 fan 1                                    -- hwmon 1 fan 1
--             hwmon 2 fan 3                                    --hwmon 1 fan 3
--             hwmon 2 fan 2                                    -- hwmon 1 fan 2


donc comme vous voyez certains fichiers sont placés au même endroit mais ne correspondent plus à la même valeur ..........
alors les rois du script à vos clavier et surtout à mon aide tongue

Merci.


Ubuntu_studio 14.04

Hors ligne

#2067 Le 28/11/2012, à 07:30

Didier-T

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

maan a écrit :
Didier-T a écrit :
maan a écrit :

bon ...... bin je doit mal m'y prendre car ça ne marche pas sad

peut tu montrer le retour d'info en Terminal.


bon ce soir c'est repartit tongue

voici le resultat terminal

 conky -c Conkyrc_Clock_Meteo
WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-AcY1X7/pkcs11: No such file or directory
Conky: can't open '/sys/class/hwmon/hwmon2/temp3_input': No such file or directory
please check your device or remove this var from Conky
Conky: Error destroying thread
Conky: Error destroying thread
Conky: Error destroying thread
Conky: Error destroying thread
***** Imlib2 Developer Warning ***** :
	This program is calling the Imlib call:

	imlib_context_free();

	With the parameter:

	context

	being NULL. Please fix your program.

en sachant que les déplacements ne se font qu'à 2 endroits

-- 1ere version                                                  -- 2eme version

-- Core0  hwmon 1 temp 2                                 -- hwmon 2 temp 2
-- Core1  hwmon 1 temp 3                                 -- hwmon 2 temp 3
-- Cpu     hwmon 2 temp 1                                 -- hwmon 1 temp 1
-- M/b      hwmon 2 temp 2                                 -- hwmon 1 temp 2
-- Gpu     hwmon 3 temp 2                                 -- hwmon 3 temp 2
-- Cpu     hwmon 2 fan 1                                    -- hwmon 1 fan 1
--             hwmon 2 fan 3                                    --hwmon 1 fan 3
--             hwmon 2 fan 2                                    -- hwmon 1 fan 2


donc comme vous voyez certains fichiers sont placés au même endroit mais ne correspondent plus à la même valeur ..........
alors les rois du script à vos clavier et surtout à mon aide tongue

Merci.

la solution doit se situer aux niveau de if_existing.
Tu pourrai coller tes scripts sur le forum, à moins que tu ne préfère creusé la piste toi même... cool

Dernière modification par Didier-T (Le 28/11/2012, à 07:33)

Hors ligne

#2068 Le 28/11/2012, à 23:03

maan

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

bon j'ai essayer par moi même et c'est pas concluant lol:lol:

alors voilà comment j'ai appliquer le truc

# — Conky settings — #

background yes

update_interval 1
total_run_times 0
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048

# — Window specifications — #

#own_window_class Conky
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

border_inner_margin 0
border_outer_margin 0

minimum_size 300 300
maximum_width 300 300

alignment tm

gap_x -568
gap_y 30


# — Graphics settings — #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# — Text settings — #
use_xft yes
xftfont hooge 05_53:size=6
xftalpha 0.5

default_color FFFFFF

uppercase no
use_spacer right

color0 white
color1 orange
color2 green
color3 yellow

# -- Declaration template -- #
template1 ${lua Meteo_\1 \2 \3 \4 \5 \6} # -- gestion météo --#
template2 ${lua_parse Meteo_\1 \2 \3 \4 60 \5} # -- icones météo -- \2=repertoir icones \3=position \4=taille \5=jour (pour les prévisions) #

# — Lua Load — #
lua_load ~/.conky/conky22/conky/script/meteo.lua
lua_startup_hook init ~/.conky/conky22/conky/script/meteo.cfg
lua_load ~/.conky/conky22/conky/script/clock_rings.lua
lua_draw_hook_pre clock_rings
lua_load ~/.conky/conky22/conky/script/multi_rings.lua
lua_draw_hook_post main

TEXT
${template1 Maj}
${voffset 29}${offset 120}${if_smapi_bat_installed 0}${color3}BAT:${else}    ${endif}
${voffset 17}${goto 65}${font hooge 05_53:size=12}${color1}${time %H:%M}${font}${goto 185}UPTIME:
${voffset 2}${goto 65}${time %a %d %b}${goto 185}${uptime}
${voffset 2}${goto 65}${time %Y}
${voffset -6}${goto 145}${color3}HD
${voffset 12}${alignc}${color1}$fs_free}/${fs_size}
${voffset 36}${goto 91}${cpu cpu0}%${goto 221}${memperc}%
${voffset 10}${goto 76}${color3}CPU${goto 205}MEM
${voffset 20}${goto 90}${font hooge 05_53:size=14}${color1}${template1 TempAct}°${font}${voffset -12}${goto 185}${template1  CondMeteo1se}${voffset 8}${goto 185}VENT:${template1 VentDirP} ${template1 VentForce}km/h${voffset 8}${goto 185}Pluie:${template1 QPrec}mm${font hooge 05_53:style=Bold:size=7.5}${voffset 40}${goto 84}${template1 Jour_Temp 2}°/${template1 Nuit_Temp 2}°${goto 140}${template1 Jour_Temp 3}°/${template1 Nuit_Temp 3}°${goto 190}${template1 Jour_Temp 4}°/${template1 Nuit_Temp 4}°${voffset 7}${goto 85}${template1 Jour %a 2}${goto 140}${template1 Jour %a 3}${goto 190}${template1 Jour %a 4}
########################## AFFICHAGES PROBA PLUIE ################################
${font hooge 05_53:style=Bold:size=9}${voffset -80}${goto 143}${color red}${template1 Jour_ProbOrage 1}%
${font hooge 05_53:style=Bold:size=9}${voffset 30}${goto 92}${color red}${template1 Jour_ProbOrage 2}%${goto 146}${template1 Jour_ProbOrage 3}%${goto 200}${template1 Jour_ProbOrage 4}%
${if_smapi_bat_installed 0}${if_match ${battery_percent BAT1}>0}${if_match ${battery_percent BAT1}<=15}${image $HOME/conky/script/images/Red.png -p 129,18 -s 40x40 -f 60}${endif}${endif}
${if_match ${battery_percent BAT1}>15}${if_match ${battery_percent BAT1}<=20}${image $HOME/conky/script/images/Orange.png -p 129,18 -s 40x40 -f 60}${endif}${endif}
${if_match ${battery_percent BAT1}>20}${if_match ${battery_percent BAT1}<=35}${image $HOME/conky/script/images/Yellow.png -p 129,18 -s 40x40 -f 60}${endif}${endif}
${if_match ${battery_percent BAT1}>35}${if_match ${battery_percent BAT1}<=100}${image $HOME/conky/script/images/Dark_Green.png -p 129,18 -s 40x40 -f 60}${endif}${endif}${endif}
${execpi 1 cat ~/.conky/conky22/conky/script/blinkingLED}
############################ AFFICHAGES ICONES ###################################
${template2 IconeM ~/.conky/conky22/conky/meteo/icones 95,150 110x66}
${template2 Jour_IconeM ~/.conky/conky22/conky/meteo/icones 62,205 70x42 2}
${template2 Jour_IconeM ~/.conky/conky22/conky/meteo/icones 115,205 70x42 3}
${template2 Jour_IconeM ~/.conky/conky22/conky/meteo/icones 168,205 70x42 4}
################################### DATE #########################################
${color FF6600}${voffset -40}${font caviar dreams:size=16}${time %A}${font}${voffset -10}${alignr 50}${color FFFFFF}${font caviar dreams:size=30}${time %e}${font}
${color FFFFFF}${voffset -30}${color FFFFFF}${font caviar dreams:size=18}${time %b}${font}${voffset -3} ${color FFFFFF}${font caviar dreams:size=18}${time %Y}${font}${color FF6600}${hr}
########################### AFFICHAGES PROCESSES #################################
${voffset 135}${goto 155}${color 009900}${font caviar dreams:size=8}Uptime: ${uptime_short}
${goto 175}${color 009900}${font caviar dreams:size=8}Processes: ${processes}
${goto 195}${color 009900}${font caviar dreams:size=8}Running: ${running_processes}
########################### UTILISATION SYSTEME ##################################
${voffset -100}${color FFFFFF}${goto 25}${cpu cpu0}%
${color FF6600}${goto 25}CPU
${color FFFFFF}${goto 45}${voffset 26}${memperc}%
${color FF6600}${goto 45}RAM
${color FFFFFF}${goto 75}${voffset 26}${swapperc}%
${color FF6600}${goto 75}Swap
${color FFFFFF}${goto 100}${voffset 26}${fs_used_perc /}%
${color FF6600}${goto 100}Syst
${color FFFFFF}${goto 120}${voffset 26}${fs_used_perc /home/maan}%
${color FF6600}${goto 120}${font caviar dreams:size=9}Home
${font caviar dreams:size=9}${voffset 20}${color FFFFFF}${goto 200}${downspeed eth0}
${color FFFFFF}${font caviar dreams:size=9}${goto 200}${upspeed eth0}
${color FF6600}${goto 200}Net
########################## VALEUR SYSTEME 1ER VERSION ############################
${if_existing /sys/class/hwmon/hwmon1/device/temp3_input}
${color FF6600}${goto 179}${voffset -355}${font caviar dreams:size=9}Core1
${color FFFFFF}${goto 131}${font caviar dreams:size=8}${hwmon 1 temp 2}°c${color FFFFFF}${goto 183}${hwmon 1 temp 3}°c${goto 235}${hwmon 2 temp 1}°c
${color FF6600}${font caviar dreams:size=9}${goto 130}Core0${color FF6600}${goto 235}Cpu

${color FF6600}${voffset 90}${goto 240}Gpu${color FF6600}${goto 190}${voffset 10}M/b
${color FFFFFF}${goto 188}${font caviar dreams:size=9}${hwmon 2 temp 2}°c${color FFFFFF}${goto 238}${voffset -05}${hwmon 3 temp 2}°c

${color FF6600}${voffset 20}${goto 35}${font caviar dreams:size=10}Cpu
${color CC0000}${hwmon 2 fan 1}${font caviar dreams:size=5} T/m
${color FF6600}${goto 80}${voffset 10}${font caviar dreams:size=13}Fan
${color FFCC00}${goto 105}${voffset 05}${font caviar dreams:size=10}${hwmon 2 fan 3}${font caviar dreams:size=5} T/m
${color 339900}${goto 55}${font caviar dreams:size=10}${hwmon 2 fan 2}${font caviar dreams:size=5} T/m
${endif}
############################# AFFICHAGE KERNEL ###################################
${voffset 45}${color FF6600}${font caviar dreams:size=8}${alignr}${nodename}
${color FF6600}${font caviar dreams:size=8}${alignr}${pre_exec cat /etc/issue.net}$machine
${color FF6600}${font caviar dreams:size=8}${alignr}kernel:${kernel}

jusque là ça fonctionne mais quand je rajoute la 2eme possibilité bin le conky ne démarre plus
donc quand je rajoute

########################## VALEUR SYSTEME 2eme VERSION ###########################
${if_existing /sys/class/hwmon/hwmon2/temp3_input}
${color FF6600}${goto 179}${voffset -355}${font caviar dreams:size=9}Core1
${color FFFFFF}${goto 131}${font caviar dreams:size=8}${hwmon 2 temp 2}°c${color FFFFFF}${goto 183}${hwmon 2 temp 3}°c${goto 235}${hwmon 1 temp 1}°c
${color FF6600}${font caviar dreams:size=9}${goto 130}Core0${color FF6600}${goto 235}Cpu

${color FF6600}${voffset 90}${goto 240}Gpu${color FF6600}${goto 190}${voffset 10}M/b
${color FFFFFF}${goto 188}${font caviar dreams:size=9}${hwmon 1 temp 2}°c${color FFFFFF}${goto 238}${voffset -05}${hwmon 3 temp 2}°c

${color FF6600}${voffset 20}${goto 35}${font caviar dreams:size=10}Cpu
${color CC0000}${hwmon 1 fan 1}${font caviar dreams:size=5} T/m
${color FF6600}${goto 80}${voffset 10}${font caviar dreams:size=13}Fan
${color FFCC00}${goto 105}${voffset 05}${font caviar dreams:size=10}${hwmon 1 fan 3}${font caviar dreams:size=5} T/m
${color 339900}${goto 55}${font caviar dreams:size=10}${hwmon 1 fan 2}${font caviar dreams:size=5} T/m
${endif}

en fait ce qu'il se passe c'est qu'il prend en compte la version 2 et me dit qu'il ne trouve pas le chemin de hwmon 2 temp 3 !!!

voilà donc j'ai du louper quelque chose tongue


Ubuntu_studio 14.04

Hors ligne

#2069 Le 29/11/2012, à 07:49

Didier-T

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

Tu devrais jeter un œil dans le répertoire pour vérifier si il y a ou non le fichier.
J'ai certainement mal compris le message d'erreur, ce que tu as fait aurais du fonctionner.

Hors ligne

#2070 Le 29/11/2012, à 19:42

maan

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

bon je vais parler en version, car au démarrage de l'ordi j'ai deux solutions possibles :

-- 1ere version                                                  -- 2eme version

-- Core0  hwmon 1 temp 2                                 -- hwmon 2 temp 2
-- Core1  hwmon 1 temp 3                                 -- hwmon 2 temp 3
-- Cpu     hwmon 2 temp 1                                 -- hwmon 1 temp 1
-- M/b      hwmon 2 temp 2                                 -- hwmon 1 temp 2
-- Gpu     hwmon 3 temp 2                                 -- hwmon 3 temp 2
-- Cpu     hwmon 2 fan 1                                    -- hwmon 1 fan 1
--             hwmon 2 fan 3                                    --hwmon 1 fan 3
--             hwmon 2 fan 2                                    -- hwmon 1 fan 2

donc comme on peut voir que certaines valeurs se retrouve dans les 2 versions mais n'ont pas le même attribue !!!
La  seule valeur qui peut me permettre que conky choisisse  la bonne version  est la valeur  de Core1.

Donc comme j'ai mis dans mon message précédent j'ai pris ces 2 valeurs pour les {if_existing},
seulement j'ai l'impression que conky prend en compte les deux chemins,
Alors que quand je suis sur la version 1 (Core1= hwmon 1 temp 3), bin (Core1= hwmon 2 temp 3) de la 2eme version n'existe pas, et vice-versa
et c'est là que ça fait tout planter à mon avis !!!

Chais pas si j'ai été clair là lol lol

Une autre question dans mon ring_lua, il faut que je double mes rings avec les valeur adéquat au 2 version ????


Ubuntu_studio 14.04

Hors ligne

#2071 Le 29/11/2012, à 21:01

Phyllinux

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

maan a écrit :

bon je vais parler en version, car au démarrage de l'ordi j'ai deux solutions possibles :

-- 1ere version                                                  -- 2eme version

-- Core0  hwmon 1 temp 2                                 -- hwmon 2 temp 2
-- Core1  hwmon 1 temp 3                                 -- hwmon 2 temp 3
-- Cpu     hwmon 2 temp 1                                 -- hwmon 1 temp 1
-- M/b      hwmon 2 temp 2                                 -- hwmon 1 temp 2
-- Gpu     hwmon 3 temp 2                                 -- hwmon 3 temp 2
-- Cpu     hwmon 2 fan 1                                    -- hwmon 1 fan 1
--             hwmon 2 fan 3                                    --hwmon 1 fan 3
--             hwmon 2 fan 2                                    -- hwmon 1 fan 2

donc comme on peut voir que certaines valeurs se retrouve dans les 2 versions mais n'ont pas le même attribue !!!
La  seule valeur qui peut me permettre que conky choisisse  la bonne version  est la valeur  de Core1.

Donc comme j'ai mis dans mon message précédent j'ai pris ces 2 valeurs pour les {if_existing},
seulement j'ai l'impression que conky prend en compte les deux chemins,
Alors que quand je suis sur la version 1 (Core1= hwmon 1 temp 3), bin (Core1= hwmon 2 temp 3) de la 2eme version n'existe pas, et vice-versa
et c'est là que ça fait tout planter à mon avis !!!

Chais pas si j'ai été clair là lol lol

Une autre question dans mon ring_lua, il faut que je double mes rings avec les valeur adéquat au 2 version ????

Pour t'aider (vu que c'est moi qui t'ai conseillé de faire des rings en double), voici mon fichier clockrings.lua.
Comme je te disais, je suis confronté au même genre de problème avec mon wifi où c'est soit wlan0, soit wlan1 qui est reconnu au démarrage de la machine. Et c'est ainsi que j'avais réglé mon problème :
clocks_rings.lua :

-- 2011 changed by LaGaDesk


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=0x87CEFA,
		-- "bg_alpha" is the alpha value of the base ring.
		bg_alpha=0.6,
		-- "fg_colour" is the colour of the indicator part of the ring.
		fg_colour=0xF61DE0,
		-- "fg_alpha" is the alpha value of the indicator part of the ring.
		fg_alpha=1,
		-- "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=255, y=370,
		-- "radius" is the radius of the ring.
		radius=25,
		-- "thickness" is the thickness of the ring, centred around the radius.
		thickness=2,
		-- "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='cpu',
		arg='cpu0',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.1,
		fg_colour=0xFF0000,
		fg_alpha=0.6,
		x=130, y=380,
		radius=25,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},
	{
		name='cpu',
		arg='cpu1',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.1,
		fg_colour=0xFF0000,
		fg_alpha=0.6,
		x=130, y=380,
		radius=20,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},
	{
		name='memperc',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.2,
		fg_colour=0x38ED24,
		fg_alpha=0.6,
		x=75, y=320,
		radius=25,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},
	{
		name='memperc',
		arg='',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.2,
		fg_colour=0x38ED24,
		fg_alpha=0.6,
		x=75, y=320,
		radius=20,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},
	{
		name='wireless_link_qual',
		arg='wlan1',
		arg='wlan0',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.1,
		fg_colour=0xFFFF00,
		fg_alpha=0.6,
		x=380, y=380,
		radius=25,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},
	{
		name='wireless_link_qual',
		arg='wlan0',
		arg='wlan1',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.1,
		fg_colour=0xFFFF00,
		fg_alpha=0.6,
		x=380, y=380,
		radius=20,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},
	{
		name='downspeedf',
		arg='wlan0',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.1,
		fg_colour=0xDD0EEC,
		fg_alpha=0.6,
		x=435, y=320,
		radius=25,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},
	{
		name='downspeedf',
		arg='wlan1',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.1,
		fg_colour=0xDD0EEC,
		fg_alpha=0.6,
		x=435, y=320,
		radius=25,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},	
	{
		name='upspeedf',
		arg='wlan0',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.1,
		fg_colour=0xF08800,
		fg_alpha=0.6,
		x=435, y=320,
		radius=20,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},	
	{
		name='upspeedf',
		arg='wlan1',
		max=100,
		bg_colour=0xFFFFFF,
		bg_alpha=0.1,
		fg_colour=0xF08800,
		fg_alpha=0.6,
		x=435, y=320,
		radius=20,
		thickness=2,
		start_angle=-90,
		end_angle=180
	},	
}

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

clock_r=25

-- "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=255
clock_y=370

show_seconds=true

require 'cairo'
--------------------------------------------------------------------------------------------------------------------------
--                                                                 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
--------------------------------------------------------------------------------------------------------------------------


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,0.9,0.8,0.1,0.8)
	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_set_source_rgba(cr,0.9,0.1,0.1,0.9)
		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)
		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

Avec ceci, j'ai toujours un affichage, que ce soit wlan0 ou wlan1. En t'en inspirant, pour ton problème de sensors, tu devrais t'en sortir.


The ship is sinking normally...

Hors ligne

#2072 Le 01/12/2012, à 08:10

Didier-T

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

pour ceux qui auraient adopté le Chronographe, voici une petite correction pour le mois de décembre.

--[[ multiple analogue clocks by Didier-T (forum Ubuntu.fr) - 25 Nov 2012
 Basé sur le travail de mrpeachy et Sector11
26 Nov 2012 - ajout hand_gap et hand_larg Didier-T
1 Dec 2012 - correction bug nb_jour Décembre Didier-T
use in conkyrc

lua_load /path/Chronograph.lua
lua_draw_hook_pre main
TEXT

]]

require 'cairo'
--Position et taille horloge
local init={
{text={"Dim","Lun","Mar","Mer","Jeu","Ven","Sam"},
nb=7*24,
formule='jour',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=90,
text_radius=45,
point_radius=32,
hand_gap=0,
hand_larg=1,
hand_length=28,
point_ray=0.5
},
{text={""},
nb="",
formule='jour_num',
police="Century Schoolbook",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=90,
center_y=175,
text_radius=45,
point_radius=35,
hand_gap=0,
hand_larg=1,
hand_length=28,
point_ray=0.5
},
{text={"Jan","Fév","Mar","Avr","Mai","Jui","Jul","Aôu","Sep","Oct","Nov","Déc"},
nb="",
formule='mois',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFF0000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=260,
center_y=175,
text_radius=45,
point_radius=32,
point_ray=1,
hand_gap=0,
hand_larg=1,
hand_length=28
},
{text={"00","01","02","03","04","05","06","07","08","09","10","11"},
nb=12*3600,
formule='heure',
police="Tibetan Machine Uni",
taille=13,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFFFF00,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFFFF00,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=175,
text_radius=165,
point_radius=150,
hand_gap=0,
hand_length=110,
hand_larg=3,
point_ray=1
},
{text={"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""},
nb=3600,
formule='minute',
police="monofur",
taille=9,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xF00000,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xF00000,
point_alpha_current=1,
hand_color=0xFFFFFF,
hand_alpha=0.7,
center_x=175,
center_y=175,
text_radius=170,
point_radius=150,
point_ray=0,
hand_gap=0,
hand_larg=2,
hand_length=135
},
{text={"","01","02","03","04","","06","07","08","09","","11","12","13","14","","16","17","18","19","","21","22","23","24","","26","27","28","29","","31","32","33","34","","36","37","38","39","","41","42","43","44","","46","47","48","49","","51","52","53","54","","56","57","58","59"},
nb=60,
formule='secondes',
police="cmr10",
taille=10,
text_color=0xFFFFFF,
text_alpha=1,
text_color_current=0xFFFFFF,
text_alpha_current=1,
point_color=0xFFFFFF,
point_alpha=1,
point_color_current=0xFF0000,
point_alpha_current=1,
hand_color=0xFF0000,
hand_alpha=0.4,
center_x=175,
center_y=175,
text_radius=160,
point_radius=150,
point_ray=0.5,
hand_gap=150,
hand_larg=4,
hand_length=165
},
}

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 cr = cairo_create(cs)
  local extents=cairo_text_extents_t:create()
  tolua.takeownership(extents)
  local h, min, sec=time()
  local jour, jour_num, mois, nb_jour=date()

  if tonumber(conky_parse('${updates}'))>3 then
    for i in pairs(init) do
      draw(cr, extents, init[i], h, min, sec, jour, jour_num, mois, nb_jour)
    end
  end

  cairo_destroy(cr)
  cairo_surface_destroy(cs)
  cr=nil
  collectgarbage()
end

function draw(cr, extents, value, h, min, sec, jour, jour_num, mois, nb_jour)
  local pos
  local nb=tonumber(table.getn(value.text))
  cairo_select_font_face (cr, value.police, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
  cairo_set_font_size (cr, value.taille)
-- Section Horloge
  if value.formule=="heure" then
    pos=heure(h, min, sec)
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==h then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="minute" then 
    pos=minute(min, sec)
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==min then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="secondes" then
    pos=sec
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if j==sec then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
-- Section date
  elseif value.formule=="mois" then
    value.nb, pos=month()
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if i==mois then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="jour_num" then
    value.nb=nb_jour*24
    nb=nb_jour
    pos=day(jour-1)
    for i=1, nb_jour do
      if math.mod(i, 2) == 0 then
        text=string.format("%02d",i)
      else
        text=""
      end
      local j=i-1
      if i==jour then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
  elseif value.formule=="jour" then
    pos=(jour_num*24)+tonumber(os.date("%H"))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if i==jour_num+1 then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, j, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, j, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, j, cr, value.point_ray)
      end
    end
    
-- Horloge avec personnalisée (non utilisé pour le moment)  
  else
    pos=tonumber(conky_parse(value.formule))
    for i=1, nb do
      local j=i-1
      local text=value.text[i]
      if tonumber(text)==pos then
         texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color_current, value.text_alpha_current, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color_current, value.point_alpha_current, i, cr, value.point_ray)
      else
        texte(value.police, value.taille, text, nb, value.text_radius, value.center_x, value.center_y, value.text_color, value.text_alpha, i, extents, cr)
        point(nb, value.point_radius, value.center_x, value.center_y, value.point_color, value.point_alpha, i, cr, value.point_ray)
      end
    end
  end
  hand(pos, value.nb, value.text_radius, value.hand_length, value.hand_gap, value.hand_larg, value.center_x, value.center_y, value.hand_color, value.hand_alpha, cr)
end

function date()
  local nb_jour
  local jour=tonumber(os.date("%d"))
  local jour_num=tonumber(os.date("%w"))
  local mois=tonumber(os.date("%m"))
  if mois==12 then
    nb_jour=31
  else
    nb_jour=tonumber(conky_parse("${exec echo $(($(date --date '1 month' +%j)-$(date +%j)))}"))
  end
  return jour, jour_num, mois, nb_jour
end

function day(jour)
  local hjour=(jour*24)+tonumber(os.date("%H"))
  return hjour
end

function month()
  local nb_jours_annee=tonumber(conky_parse("${exec echo $(date --date '31 Dec' +%j)}"))
  local jour_annee=tonumber(conky_parse("${exec echo $(date +%j)}"))
  return nb_jours_annee, jour_annee
end

function time()
  local h=tonumber(os.date("%I"))
  local min=tonumber(os.date("%M"))
  local sec=tonumber(os.date("%S"))
  return h, min, sec
end

function heure(h, min, sec)
  local hs=(h*3600)+(min*60)+sec
  return hs
end

function minute(min, sec)
  local m=(min*60)+sec
  return m
end

function rgb_to_r_g_b(col,alp)
  return ((col / 0x10000) % 0x100) / 255, ((col / 0x100) % 0x100) / 255, (col % 0x100) / 255, alp
end

function texte(police, taille, text, nb, radius, center_x, center_y, color, alpha, i, extents, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_text_extents(cr,text,extents)
  local width=extents.width
  local height=extents.height
  cairo_move_to(cr,center_x+x-(width/2),center_y+y+(height/2))
  cairo_show_text (cr, text)
  cairo_stroke (cr)
end

function point(nb, radius, center_x, center_y, color, alpha, i, cr, ray)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(i))
  local x=0+radius*(math.sin(point))
  local y=0-radius*(math.cos(point))
  cairo_arc (cr,center_x+x,center_y+y,ray,0,2*math.pi)
  cairo_stroke (cr)
end

function hand(pos, nb, radius, hand_length, hand_gap, largeur, center_x, center_y, color, alpha, cr)
  cairo_set_source_rgba (cr,rgb_to_r_g_b(color,alpha))
  local point=(math.pi/180)*((360/nb)*(pos))
  local x_gap=0+hand_gap*(math.sin(point))
  local y_gap=0-hand_gap*(math.cos(point))
  local x=0+hand_length*(math.sin(point))
  local y=0-hand_length*(math.cos(point))
  cairo_move_to (cr,center_x+x_gap,center_y+y_gap)
  cairo_line_to (cr,center_x+x,center_y+y)
  cairo_set_line_width (cr,largeur)
  cairo_set_line_cap  (cr, CAIRO_LINE_CAP_ROUND)
  cairo_stroke (cr)
end

Hors ligne

#2073 Le 01/12/2012, à 08:14

Didier-T

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

@ maan,

Tu n'as pas répondu a ma précédente question, quand il y a le bug le fichier /sys/class/hwmon/hwmon2/temp3_input existe t'il ?

Edit : au fait pourquoi ne pas utiliser sensors a la place

si tu veux faire un essais exécute sensors en terminal et donne moi le résultat, je te ferais les lignes pour filtrer les infos, enfin si tu vois les infos que tu cherche après le commande sensors

cher moi sa donne sa.

didier @ didier-P35-DS3R  ~
└─ $ ▶ sensors
adt7473-i2c-2-2e
Adapter: nouveau-0000:01:00.0-2
in1:          +3.00 V  (min =  +0.00 V, max =  +2.99 V)
+3.3V:        +3.39 V  (min =  +2.96 V, max =  +3.61 V)
fan1:         832 RPM  (min =    0 RPM)
fan2:           0 RPM  (min =    0 RPM)
fan3:           0 RPM  (min =  164 RPM)  ALARM
temp1:        +59.2°C  (low  = +65.0°C, high = +85.0°C)  ALARM
                       (crit = +100.0°C, hyst = +98.0°C)
Board Temp:   +52.8°C  (low  = +20.0°C, high = +60.0°C)
                       (crit = +100.0°C, hyst = +96.0°C)
temp3:        +59.2°C  (low  = +80.0°C, high = +105.0°C)  ALARM
                       (crit = +136.0°C, hyst = +132.0°C)

nouveau-pci-0100
Adapter: PCI adapter
temp1:         +0.0°C  (high = +100.0°C, crit = +110.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +48.0°C  (high = +78.0°C, crit = +100.0°C)
Core 1:       +47.0°C  (high = +78.0°C, crit = +100.0°C)

Dernière modification par Didier-T (Le 01/12/2012, à 08:46)

Hors ligne

#2074 Le 01/12/2012, à 16:15

ferreol

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

Excusez moi d'abuser mais je voudrais aussi afficher le cours du caoutchouc RSS_3 en USD depuis  ce site
http://rubberboard.org.in/internationalrubberprice.asp

grace a wget et Grep mais j'ai du mal

J'ai mis cela mais rien

${goto 50}RSS3 ${execi 3600 wget -q -O - "http://rubberboard.org.in/rubberprice.asp?url=internationalrubberprice.asp"|grep "BANGKOK"|sed 's/<[^>]*>//g'}USD

Merci par avance pour votre aide.

Dernière modification par ferreol (Le 01/12/2012, à 16:15)

Hors ligne

#2075 Le 01/12/2012, à 17:54

ljere

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

ben déjà si tu veux progresser il faut commencer par tester par toi même donc on va déjà lancer dans le terminal

wget -q -O - "http://rubberboard.org.in/rubberprice.asp?url=internationalrubberprice.asp"

ensuite tu vas l'envoyer sur un fichier test

wget -q -O - "http://rubberboard.org.in/rubberprice.asp?url=internationalrubberprice.asp" > test

après tu as du comprendre que grep recherche la valeur "BANGKOK"
je te laisse réfléchir un peu et dis moi ce que tu comprend ou ne comprend pas
bon allez je suis sympa je te propose un test avec cette adresse plutot
http://rubberboard.org.in/internationalrubberprice.asp

Dernière modification par ljere (Le 01/12/2012, à 22:28)


ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon

Hors ligne