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.

#1076 Le 11/10/2011, à 18:49

Didier-T

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

Bonjour,
j'ai un peut modifier mon conky, y ai ajouté une animation satellite et aménager un ring.lua pour en faire une horloge qui tourne rond roll

une petite photo pour montrer
1318353126.png

et une animation satellite
111011073506481212.gif

pour ceux que sa pourrais intéresser voici mes scripts :

lauch.sh

#!/bin/bash
sleep 5
killall animate
killall conky
cd
sleep 2
conky -d -c /home/didier/.conkyrc1
sleep 2
conky -d -c ~/.conkyrc2
sleep 2
conky -d -c ~/.conkyrc3
sleep 5
conky -d -c ~/.conkyrc4
sleep 5
conky -d -c ~/.conkyrc5
exit 0

.conkyrc1

# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0

# affiche le texte sur la sortie standard
out_to_console no

# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utilisée
no_buffers yes
text_buffer_size 2048
# cache utiliser pour les images
imlib_cache_size 0

# taux de rafraichissement de la fenêtre (en secondes)
update_interval 2

# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 2
net_avg_samples 2

# taille et positon
alignment tr
minimum_size 320 5
maximum_width 320

# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x 5
gap_y 40

#  afficher les ombres
draw_shades yes
# afficher des contours
draw_outline no
# contours autour des blocs de texte
draw_borders no
# largeur du contour
border_width 1
# largeur des marges
#border_margin 4

#pour que conky tourne en arrière plan background no pour les tests
background yes

# utiliser sa propre fenêtre
own_window yes
#type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type override # normal / override / desktop
#pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes

# Utiliser Xft (polices lissées etc)
use_xft yes
#xftalpha .1
#override_utf8_locale yes # force UTF8

#police a utiliser : use_xft doit être a "yes"
xftfont Comic sans MS:size=8
xftalpha 0.8
# Tout le texte en majuscule
uppercase no

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer right

# Taille de la jauge par défault
default_gauge_size 0 100

# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black

color1 e49c16 
color2 CA0000 #rouge

color6 EEEEEE
color7 DDDDDD
color8 CCCCCC
color9 BBBBBB

#Lua Load
lua_load ~/conky/script/rings2.lua
lua_load ~/conky/script/graph.lua

lua_draw_hook_pre main_rings
lua_draw_hook_post main_graph

TEXT
${time %A %d %B %Y}
${execi 86400 lsb_release -si} : ${execi 86400 lsb_release -sr} ${execi 86400 lsb_release -sc}
$sysname : $kernel $machine ${freq_g} GHz
Uptime : $uptime
Conky version : $conky_version 




${color white}${voffset -26}${alignc}Core 0 : ${cpu 1}% ${exec expr `cat /sys/class/hwmon/hwmon0/device/temp1_input` / 1000}°C




${color white}${voffset -26}${alignc}Core 1 : ${cpu 2}% ${exec expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000}°C
${color white}
#Top 3 des applications les plus gourmandes en CPU avec leur % d’utilisation, leur nom et leur PID (pour pouvoir les killer rapidement si elle s’affolent)
${color1}${top cpu 1}% ${top name 1}${color} ${alignr}${top pid 1}
${color1}${top cpu 2}% ${top name 2}${color} ${alignr}${top pid 2}
${color1}${top cpu 3}% ${top name 3}${color} ${alignr}${top pid 3}

${font Ubuntu\-Title:size=15}RESEAU ${hr 2}${font}
IP Internet : ${execpi 90 /home/didier/conky/script/ip-ext.sh}${if_existing /proc/net/route eth0}
IP Réseau: ${addr eth0}
${offset 138}${voffset 38}UP
${offset 110}${voffset 10}${upspeed eth0}/s
${offset 32}${voffset -35}Down
${offset 15}${voffset 10}${downspeed eth0}/s 


Uploaded: ${alignr}${totalup eth0}
Downloaded: ${alignr}${totaldown eth0}${endif}

.conkyrc2

# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0

# affiche le texte sur la sortie standard
out_to_console no

# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utilisée
no_buffers yes
text_buffer_size 2048

# taux de rafraichissement de la fenêtre (en secondes)
update_interval 1

# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 4
net_avg_samples 4

# taille et positon
alignment tm
minimum_size 5 5
maximum_width 700

# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x 0
gap_y 10

#  afficher les ombres
draw_shades yes
# afficher des contours
draw_outline no
# contours autour des blocs de texte
draw_borders no
# largeur du contour
border_width 1
# largeur des marges
#border_margin 4

#pour que conky tourne en arrière plan background no pour les tests
background no

# utiliser sa propre fenêtre
own_window yes
#type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type override # normal / override / desktop
#pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes

# Utiliser Xft (polices lissées etc)
use_xft yes
#xftalpha .1
#override_utf8_locale yes # force UTF8

#police a utiliser : use_xft doit être a "yes"
xftfont Comic sans MS:size=8
xftalpha 0.8
# Tout le texte en majuscule
uppercase no

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer right

# Taille de la jauge par défault
default_gauge_size 0 10

# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black

color1 e49c16 
color2 CA0000 #rouge

color6 EEEEEE
color7 DDDDDD
color8 CCCCCC
color9 BBBBBB

TEXT


${color red}${font Bitstream Vera Sans Mono:style=Bold:size=14}Météo ${hr 2}${font}
${color white}${font Comic sans MS:size=14}

${execi 300 ~/conky/script/images2.sh}
${voffset -60}${execpi 1800 conkyForecast --location=FRXX0282 --template=/home/didier/conky/script/myweather.template}

.conkyrc3

# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0

# affiche le texte sur la sortie standard
out_to_console no

# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utilisée
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0
imlib_cache_flush_interval 5
# taux de rafraichissement de la fenêtre (en secondes)
update_interval 1

# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 2
net_avg_samples 2

# taille et positon
alignment tl
minimum_size 320 5
maximum_width 320

# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x 5
gap_y 40

#  afficher les ombres
draw_shades no
# afficher des contours
draw_outline no
# contours autour des blocs de texte
draw_borders no
# largeur du contour
border_width 1
# largeur des marges
#border_margin 4

#pour que conky tourne en arrière plan background no pour les tests
background yes

# utiliser sa propre fenêtre
own_window yes
#type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type override # normal / override / desktop
#pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes

# Utiliser Xft (polices lissées etc)
use_xft yes
#xftalpha .1
#override_utf8_locale yes # force UTF8

#police a utiliser : use_xft doit être a "yes"
xftfont Comic sans MS:size=8
xftalpha 0.8
# Tout le texte en majuscule
uppercase no

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer right

# Taille de la jauge par défault
default_gauge_size 0 10

# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black

color1 e49c16 
color2 CA0000 #rouge

color6 EEEEEE
color7 DDDDDD
color8 CCCCCC
color9 BBBBBB

#Lua Load
lua_load ~/conky/script/horloge_ring.lua
lua_draw_hook_pre main_rings
   
TEXT
${voffset 110} ${offset 75}${color white}${font Bitstream Charter:style=Bold:size=45}${time %H:%M}
${font Comic sans MS:size=55}

.conkyrc4

# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0

# affiche le texte sur la sortie standard
out_to_console no

# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utilisée
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0

# taux de rafraichissement de la fenêtre (en secondes)
update_interval 2

# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 2
net_avg_samples 2

# taille et positon
alignment tl
minimum_size 320 5
maximum_width 320

# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x 5
gap_y 40

#  afficher les ombres
draw_shades no
# afficher des contours
draw_outline no
# contours autour des blocs de texte
draw_borders no
# largeur du contour
border_width 1
# largeur des marges
#border_margin 4

#pour que conky tourne en arrière plan background no pour les tests
background yes

# utiliser sa propre fenêtre
own_window yes
#type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type override # normal / override / desktop
#pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes

# Utiliser Xft (polices lissées etc)
use_xft yes
#xftalpha .1
#override_utf8_locale yes # force UTF8

#police a utiliser : use_xft doit être a "yes"
xftfont Comic sans MS:size=8
xftalpha 0.8
# Tout le texte en majuscule
uppercase no

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer right

# Taille de la jauge par défault
default_gauge_size 0 10

# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black

color1 e49c16 
color2 CA0000 #rouge

color6 EEEEEE
color7 DDDDDD
color8 CCCCCC
color9 BBBBBB

#Lua Load
lua_load ~/conky/script/rings.lua
#lua_load ~/conky/script/text.lua
#lua_load ~/conky/script/clock.lua
lua_draw_hook_pre main_rings
#lua_draw_hook_post draw_text
#lua_draw_hook_post clock_rings

#  lua_load ~/conky/script/rings.lua
#  lua_draw_hook_pre ring_stats


#   #   #   #   #   #   #
#   INFOS A AFFICHER    #
#   #   #   #   #   #   #
   
TEXT









${voffset 220}${offset 132}${color red}${font Japan:style=Bold:size=13}MEM
${voffset -22}${offset 32}SSD
${voffset -22}${offset 232}HOME
${voffset 7}${offset 110}${color green}${font Japan:style=Bold:size=10}${memperc}% ${swapperc}%
${voffset -17}${offset 5}${fs_free /}
${voffset -17}${offset 215}${fs_free /media/Stokage}
${voffset 28}${color black}${font Japan:style=Bold:size=8}Procéssus
${offset 120}${voffset -13}Place MEM
${offset 210}${voffset -13}MEM %
${voffset -13}${alignr}Proc %
${font Japan:style=Bold:size=10}${top_mem name 1}
${offset 120}${voffset -16}${top_mem mem_res 1}
${offset 200}${voffset -16}${top_mem mem 1}%
${alignr}${voffset -16}${top_mem cpu 1}%
${font Japan:style=Bold:size=10}${top_mem name 2}
${offset 120}${voffset -16}${top_mem mem_res 2}
${offset 200}${voffset -16}${top_mem mem 2}%
${alignr}${voffset -16}${top_mem cpu 2}%
${font Japan:style=Bold:size=10}${top_mem name 3}
${offset 120}${voffset -16}${top_mem mem_res 3}
${offset 200}${voffset -16}${top_mem mem 3}%
${alignr}${voffset -16}${top_mem cpu 3}%
${voffset 10}

.conkyrc5

# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0

# affiche le texte sur la sortie standard
out_to_console no

# réglage de la mémoire, pour éviter le clignotement
double_buffer no
# Soustraire les mémoires tampons de la mémoire utilisée
no_buffers yes
text_buffer_size 1024

# taux de rafraichissement de la fenêtre (en secondes)
update_interval 1 # 2100 max

# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 2
net_avg_samples 2

# taille et positon
alignment tm
minimum_size 310 0
maximum_width 310

# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x -5
gap_y 420

#pour que conky tourne en arrière plan background no pour les tests
background yes

# utiliser sa propre fenêtre
own_window yes
#type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type normal # normal / override / desktop
#pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager
own_window_title conkyanimate

# Utiliser Xft (polices lissées etc)
use_xft yes
#xftalpha .1
#override_utf8_locale yes # force UTF8

#police a utiliser : use_xft doit être a "yes"
xftfont Comic sans MS:size=8
xftalpha 0.8
# Tout le texte en majuscule
uppercase no

# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer right

# Taille de la jauge par défault
default_gauge_size 0 100

# Couleurs
default_color FFFFFF #blanc
default_shade_color 333333
default_outline_color black

color1 e49c16 
color2 CA0000 #rouge

color6 EEEEEE
color7 DDDDDD
color8 CCCCCC
color9 BBBBBB

TEXT
${voffset 177}${if_updatenr 2}${exec animate -window $(xwininfo -name "conkyanimate" |grep xwininfo |awk '{ print $4 }') -delay 10 -pause 1 ~/conky/images/Traitee/*.jpg}${endif}

graph.lua

--[[ GRAPH widget v1.1 by wlourf (07.01.2011)
    this widget draws some graphs with some effects 
    http://u-scripts.blogspot.com/2010/10/graph-widget.html
    
To call the script in a conky, use, before TEXT
    lua_load /path/to/the/script/graph.lua
    lua_draw_hook_pre main_graph
and add one line (blank or not) after TEXT


Parameters are :
3 parameters are mandatory
name        - the name of the conky variable to display,
              for example for {$cpu cpu0}, just write name="cpu"
arg            - the argument of the above variable,
              for example for {$cpu cpu1}, just write arg="cpu1"
                arg can be a numerical value if name=""
max            - the maximum value the above variable can reach,
              for example for {$cpu cpu1}, just write max=100 or less or more
    
Optional parameters:
x,y         - coordinates of the bottom-left corner of the graph,
              relative to the top-left corner of the conky window 
              default =  bottom-left corner of the conky window
width       - width of the graph, default = 100 pixels
height      - height of the graph, default = 20 pixels
nb_values   - number of values to display in the graph, default=width 
              i.e. 1 pixel for 1 value
autoscale   - if set to true, calculate the max valeu of the y axis and
              doesn't use the max parameter above, default=false
skew_x      - skew graph around x axis, défaut = 0
skew_y      - skew graph around y axis, défaut = 0
angle        - angle of rotation of the graph in degress, default = 0
              i.e. a horizontal graph)
inverse     - if set to true, graph are draw from right to left, default=false
background  - if set to false, background is not drawn, default=true
foreground  - if set to false, foreground is not drawn, default=true
              foreground = plain graph
bg_bd_size  - size of the border of the background, default=0=no border
fg_bd_size  - size of the border of the foreground, default=0=no border


Colours tables below are defined into braces :
{position in the gradient (0 to 1), colour in hexadecimal, alpha (0 to 1)}
example for a single colour table : 
{{0,0xFFAA00,1}} position parameter doesn't matter
example for a two-colours table : 
{{0,0xFFAA00,1},{1,0x00AA00,1}} or {{0.5,0xFFAA00,1},{1,0x00AA00,1}}
example for a three-colours table : 
{{0,0xFFAA00,1},{0.5,0xFF0000,1},{1,0x00AA00,1}}

bg_colour    - colour table for background,
              default = {{0,0x000000,.5},{1,0xFFFFFF,.5}}
fg_colour    - colour table for foreground,
              default = {{0,0x00FFFF,1},{1,0x0000FF,1}}
bg_bd_colour- colour table for background border,
              default = {{1,0xFFFFFF,1}}              
fg_bd_colour- colour table for foreground border,
              default = {{1,0xFFFF00,1}}              

bg_orientation, bg_bd_orientation, fg_orientation, fg_bd_orientation,
            - "orientation" defines the starting point of the gradient,
              default="nn"
              there are 8 available starting points : 
              "nw","nn","ne","ee","se","ss","sw","ww"
              (n for north, w for west ...)
              theses 8 points are the 4 corners + the 4 middles of graph
              so a gradient "nn" will go from "nn" to "ss"
              a gradient "nw" will go from "nw" to "se"

draw_me     - if set to false, graph is not drawn (default = true)
              it can be used with a conky string, if the string returns 1, the graph is drawn :
              example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",
              
v1.0 (31/10/2010) original release
v1.1 (07/01/2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"
                  text is parsed inside the function, not in the array of settings

--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation version 3 (GPLv3)
--     
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--     
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
--      MA 02110-1301, USA.        

]]

require 'cairo'

function set_settings()
    graph_settings={    
    {
        name="cpu",
        arg="cpu1",
        max=100,
        x=6,
        y=111,
        autoscale=false,
        width=318,
        height=23,
        nb_values=500,
        fg_bd_size=1,
        bg_bd_size=1,
        bg_colour = {{0,0x000000,1},{0.5,0x000000,1},{1,0x000000,1}},
        fg_bd_colour = { {0,0xFFFF00,1},{0.5,0xFFFF00,1},{1,0xFFFF00,1}},
        foreground=false,
        background=false,
        },
        {
        name="exec",
        arg='expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000',
        max=80,
        x=5,
        y=112,
        autoscale=false,
        width=320,
        height=25,
        nb_values=500,
        fg_bd_size=1,
        bg_bd_size=1,
        bg_bd_colour = { {0,0xff0000,1},{1,0xff0000,1}},
        fg_bd_colour = { {0,0xe49c16,1},{0.5,0xe49c16,1},{1,0xe49c16,1}},
        foreground=false,
        background=false,
        },            
    {
        name="cpu",
        arg="cpu2",
        max=100,
        x=6,
        y=151,
        autoscale=false,
        width=318,
        height=23,
        nb_values=500,
        fg_bd_size=1,
        bg_bd_size=1,
        bg_colour = {{0,0x000000,1},{0.5,0x000000,1},{1,0x000000,1}},
        fg_bd_colour = {{0,0xFFFF00,1},{0.5,0xFFFF00,1},{1,0xFFFF00,1}},
        foreground=false,
        background=false,
        },
        {
        name="exec",
        arg='expr `cat /sys/class/hwmon/hwmon1/device/temp1_input` / 1000',
        max=80,
        x=5,
        y=152,
        autoscale=false,
        width=320,
        height=25,
        nb_values=500,
        fg_bd_size=1,
        bg_bd_size=1,
        bg_bd_colour = {{0,0xff0000,1},{1,0xff0000,1}},
        fg_bd_colour = {{0,0xe49c16,1},{0.5,0xe49c16,1},{1,0xe49c16,1}},
        foreground=false,
        background=false,
        },             }
end


function check_settings(t)
    --tables are check only when conky start
    if t.name==nil and t.arg==nil then 
        print ("No input values ... use parameters 'name'" .. 
            " with 'arg' or only parameter 'arg' ") 
        return 1
    end

    if t.max==nil then
        print ("No maximum value defined, use 'max'")
        print ("for name=" .. t.name .. " with arg=" .. t.arg)
        return 1
    end
    if t.name==nil then t.name="" end
    if t.arg==nil then t.arg="" end
    return 0
end

function conky_main_graph()

    if conky_window == nil then return end
        
    local w=conky_window.width
    local h=conky_window.height
    local cs=cairo_xlib_surface_create(conky_window.display, 
            conky_window.drawable, conky_window.visual, w, h)
    cr=cairo_create(cs)

    updates=tonumber(conky_parse('${updates}'))
    --start drawing after "updates_gap" updates
    --prevent segmentation error for cpu
    updates_gap=5
    if updates==1 then    
        set_settings()
        
        flagOK=0
        for i in pairs(graph_settings) do
            if graph_settings[i].width==nil then graph_settings[i].width=100 end
            if graph_settings[i].nb_values==nil then  
                graph_settings[i].nb_values= graph_settings[i].width
            end
            --create an empty table to store values
            graph_settings[i]["values"]={}
            --beginning point
            graph_settings[i].beg = graph_settings[i].nb_values
            --graph_settings[i].beg = 0
            for j =1, graph_settings[i].nb_values do
                graph_settings[i].values[j]=0
            end
            graph_settings[i].flag_init=true
            flagOK=flagOK + check_settings(graph_settings[i])

        end
    end

    if flagOK>0 then 
        --abort script if error in one of the tables
        print ("ERROR : Check the graph_setting table")
        return
    end

    --drawing process
    if updates > updates_gap then
        for i in pairs(graph_settings) do
            if graph_settings[i].draw_me==true then graph_settings[i].draw_me = nil end
            if (graph_settings[i].draw_me==nil or conky_parse(tostring(graph_settings[i].draw_me)) == "1") then 
                local nb_values=graph_settings[i].nb_values
                graph_settings[i].automax=0
                for j =1, nb_values do
                    if graph_settings[i].values[j+1]==nil then 
                        graph_settings[i].values[j+1]=0 
                    end
                
                    graph_settings[i].values[j]=graph_settings[i].values[j+1]
                    if j==nb_values then
                        --store value
                        if graph_settings[i].name=="" then
                            value=graph_settings[i].arg
                        else
                            value=tonumber(conky_parse('${' .. 
                                graph_settings[i].name .. " " ..
                                graph_settings[i].arg ..'}'))
                        end
                        graph_settings[i].values[nb_values]=value
                    end
                    graph_settings[i].automax=math.max(graph_settings[i].automax,
                                                       graph_settings[i].values[j])
                    --should stop weird glitches at beginning when no values reported yet for upspeed or diskio
                    if graph_settings[i].automax == 0 then graph_settings[i].automax = 1 end 
                end
                   draw_graph(graph_settings[i])
            end
        end
    end

    cairo_destroy(cr)
    cairo_surface_destroy(cs)
    updates=nil
    updates_gap=nil
end


function draw_graph(t)
    --drawing function

    local function rgb_to_r_g_b(colour)
        return ((colour[2] / 0x10000) % 0x100) / 255., ((colour[2] / 0x100) % 0x100) / 255., (colour[2] % 0x100) / 255., colour[3]
    end
 
    local function linear_orientation(o,w,h)
        --set gradient for bg and bg border
        local p
        if o=="nn" then
            p={w/2,h,w/2,0}
        elseif o=="ne" then
            p={w,h,0,0}
        elseif o=="ww" then
            p={0,h/2,w,h/2}
        elseif o=="se" then
            p={w,0,0,h}
        elseif o=="ss" then
            p={w/2,0,w/2,h}
        elseif o=="ee" then
            p={w,h/2,0,h/2}        
        elseif o=="sw" then
            p={0,0,w,h}
        elseif o=="nw" then
            p={0,h,w,0}
        end
        return p
    end

    local function linear_orientation_inv(o,w,h)
        --set gradient for fg and fg border
        local p
        if o=="ss" then
            p={w/2,h,w/2,0}
        elseif o=="sw" then
            p={w,h,0,0}
        elseif o=="ee" then
            p={0,h/2,w,h/2}
        elseif o=="nw" then
            p={w,0,0,h}
        elseif o=="nn" then
            p={w/2,0,w/2,h}
        elseif o=="ww" then
            p={w,h/2,0,h/2}        
        elseif o=="ne" then
            p={0,0,w,h}
        elseif o=="se" then
            p={0,h,w,0}
        end
        return p
    end


    --set default values
    
    --cancel drawing if not needed
    if t.draw_me~=nil and conky_parse(tostring(t.draw_me)) ~= "1" then 
        return
    end
    

    
    if t.height==nil    then t.height=20 end
    --checked in previous part : width and nb_values
        
    if t.background==nil    then t.background=true end
    if t.bg_bd_size==nil    then t.bg_bd_size=0 end
    if t.x==nil             then t.x=t.bg_bd_size end
    if t.y==nil             then t.y=conky_window.height -t.bg_bd_size end
    if t.bg_colour==nil     then t.bg_colour={{0,0x000000,.5},{1,0xFFFFFF,.5}} end
    if t.bg_bd_colour==nil     then t.bg_bd_colour={{1,0xFFFFFF,1}} end
    
    if t.foreground==nil    then t.foreground=true end
    if t.fg_colour==nil     then t.fg_colour={{0,0x00FFFF,1},{1,0x0000FF,1}} end
    
    if t.fg_bd_size==nil    then t.fg_bd_size=0 end    
    if t.fg_bd_colour==nil  then t.fg_bd_colour={{1,0xFFFF00,1}} end
    
    if t.autoscale==nil     then t.autoscale=false end
    if t.inverse==nil       then t.inverse=false end
    if t.angle==nil         then t.angle=0 end
    
    if t.bg_bd_orientation==nil then t.bg_bd_orientation="nn" end
    if t.bg_orientation==nil then t.bg_orientation="nn" end
    if t.fg_bd_orientation==nil then t.fg_bd_orientation="nn" end
    if t.fg_orientation==nil then t.fg_orientation="nn" end

    --check colours tables
    for i=1, #t.fg_colour do    
        if #t.fg_colour[i]~=3 then 
            print ("error in fg_colour table")
            t.fg_colour[i]={1,0x0000FF,1} 
        end
    end
    
    for i=1, #t.fg_bd_colour do    
        if #t.fg_bd_colour[i]~=3 then 
            print ("error in fg_bd_colour table")
            t.fg_bd_colour[i]={1,0x00FF00,1} 
        end
    end
    
    for i=1, #t.bg_colour do    
        if #t.bg_colour[i]~=3 then 
            print ("error in background color table")
            t.bg_colour[i]={1,0xFFFFFF,0.5} 
        end
    end    

    for i=1, #t.bg_bd_colour do    
        if #t.bg_bd_colour[i]~=3 then 
            print ("error in background border color table")
            t.bg_bd_colour[i]={1,0xFFFFFF,1} 
        end
    end    

    --calculate skew parameters if needed
    if t.flag_init then
        if t.skew_x == nil then 
            t.skew_x=0 
        else
            t.skew_x = math.pi*t.skew_x/180    
        end
        if t.skew_y == nil then 
            t.skew_y=0
        else
            t.skew_y = math.pi*t.skew_y/180    
        end
        t.flag_init=false
    end

    cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
    cairo_set_line_join(cr,CAIRO_LINE_JOIN_ROUND)

    local matrix0 = cairo_matrix_t:create()
    tolua.takeownership(matrix0)
    cairo_save(cr)
    cairo_matrix_init (matrix0, 1,t.skew_y,t.skew_x,1,0,0)
    cairo_transform(cr,matrix0)
    
       local ratio=t.width/t.nb_values

    cairo_translate(cr,t.x,t.y)
    cairo_rotate(cr,t.angle*math.pi/180)
    cairo_scale(cr,1,-1)

    --background
    if t.background then
        local pts=linear_orientation(t.bg_orientation,t.width,t.height)
        local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
        for i=1, #t.bg_colour do
            --print ("i",i,t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
            cairo_pattern_add_color_stop_rgba (pat, t.bg_colour[i][1], rgb_to_r_g_b(t.bg_colour[i]))
        end
        cairo_set_source (cr, pat)
        cairo_rectangle(cr,0,0,t.width,t.height)    
        cairo_fill(cr)    
        cairo_pattern_destroy(pat)
    end
    
    --autoscale
    cairo_save(cr)
    if t.autoscale then
        t.max= t.automax*1.1
    end
    
    local scale_x = t.width/(t.nb_values-1)
    local scale_y = t.height/t.max
    
    --define first point of the graph
    if updates-updates_gap <t.nb_values then 
        t.beg = t.beg - 1
        --next line prevent segmentation error when conky window is redraw 
        --quicly when another window "fly" over it
        if t.beg<0 then t.beg=0 end
    else
        t.beg=0
    end
    if t.inverse then cairo_scale(cr,-1,1)
    cairo_translate(cr,-t.width,0) end

    --graph foreground
    if t.foreground then
        local pts_fg=linear_orientation_inv(t.fg_orientation,t.width,t.height)
        local pat = cairo_pattern_create_linear (pts_fg[1],pts_fg[2],pts_fg[3],pts_fg[4])
        for i=1,#t.fg_colour,1 do
            cairo_pattern_add_color_stop_rgba (pat, 1-t.fg_colour[i][1], rgb_to_r_g_b(t.fg_colour[i]))
        end
        cairo_set_source (cr, pat)

        cairo_move_to(cr,t.beg*scale_x,0)
        cairo_line_to(cr,t.beg*scale_x,t.values[t.beg+1]*scale_y)
        for i=t.beg, t.nb_values-1 do
            cairo_line_to(cr,i*scale_x,t.values[i+1]*scale_y)        
        end
        cairo_line_to(cr,(t.nb_values-1)*scale_x,0)
        cairo_close_path(cr)
        cairo_fill(cr)
        cairo_pattern_destroy(pat)
    end

    --graph_border
    if t.fg_bd_size>0 then
        local pts=linear_orientation_inv(t.fg_bd_orientation,t.width,t.height)
        local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
        for i=1,#t.fg_bd_colour,1 do
            cairo_pattern_add_color_stop_rgba (pat, 1-t.fg_bd_colour[i][1], rgb_to_r_g_b(t.fg_bd_colour[i]))
        end
        cairo_set_source (cr, pat)
        cairo_move_to(cr,t.beg*scale_x,t.values[t.beg+1]*scale_y)
        for i=t.beg, t.nb_values-1 do
            cairo_line_to(cr,i*scale_x,t.values[i+1]*scale_y)        
        end
        cairo_set_line_width(cr,t.fg_bd_size)
        cairo_stroke(cr)
        cairo_pattern_destroy(pat)
    end
    cairo_restore(cr)

    --background border
    if t.bg_bd_size>0 then
        local pts=linear_orientation(t.bg_bd_orientation,t.width,t.height)
        local pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
        for i=1, #t.bg_bd_colour do
            --print ("i",i,t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
            cairo_pattern_add_color_stop_rgba (pat, t.bg_bd_colour[i][1], rgb_to_r_g_b(t.bg_bd_colour[i]))
        end
        cairo_set_source (cr, pat)
        cairo_rectangle(cr,0,0,t.width,t.height)    
        cairo_set_line_width(cr,t.bg_bd_size)
        cairo_stroke(cr)
        cairo_pattern_destroy(pat)    
    end    

    cairo_restore(cr)

end

ring.lua

--[[
Ring Meters by londonali1010 (2009)

This script draws percentage meters as rings. It is fully customisable; all options are described in the script.

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

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

Changelog:
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
 
require 'cairo'
function conky_main_rings()
-- START PARAMETERS HERE
rings_settings={

    {
        name='memperc',
        arg='',
    max=100,
    xc=160,
    yc=360,
    radius=50,
    thickness=10,
    start_angle=270,
    end_angle=570,
    sectors=50,
    gap_sectors=0,
    fill_sector=false,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0XFFFF00,0},{0.5,0xFFFF00,1}, {1,0xFFFF00,0}},
    fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
    },
    {
        name='swapperc',
        arg='',
    max=100,
    xc=160,
    yc=360,
    radius=40,
    thickness=10,
    start_angle=270,
    end_angle=450,
    sectors=23,
    gap_sectors=0,
    fill_sector=false,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0XFFFF00,0},{0.5,0xFFFF00,1}, {1,0xFFFF00,0}},
    fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
    },
    {
        name='fs_used_perc',
        arg='/',
    max=100,
    xc=55,
    yc=360,
    radius=50,
    thickness=10,
    start_angle=270,
    end_angle=570,
    sectors=50,
    gap_sectors=0,
    fill_sector=false,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0XFFFF00,0},{0.5,0xFFFF00,1}, {1,0xFFFF00,0}},
    fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
    },
    {
        name='fs_used_perc',
        arg='/media/Stokage',
    max=100,
    xc=265,
    yc=360,
    radius=50,
    thickness=10,
    start_angle=270,
    end_angle=570,
    sectors=50,
    gap_sectors=0,
    fill_sector=false,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0XFFFF00,0},{0.5,0xFFFF00,1}, {1,0xFFFF00,0}},
    fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
    },

}

--END OF PARAMETERS HERE

--main function

    --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 tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(rings_settings) do
            draw_ring(cr,rings_settings[i])
        end
    end

    cairo_destroy(cr)

end




function draw_ring(cr, t)

    local function rgba_to_r_g_b_a(tcolour)
        local colour,alpha=tcolour[2],tcolour[3]
        return ((colour / 0x10000) % 0x100) / 255., 
            ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
            
            
    local function calc_delta(tcol1,tcol2)
        --calculate deltas P R G B A to table_colour 1

        for x = 1, #tcol1 do
            tcol1[x].dA    = 0
            tcol1[x].dP = 0
             tcol1[x].dR = 0
            tcol1[x].dG = 0
            tcol1[x].dB = 0
            if tcol2~=nil and #tcol1 == #tcol2 then
                local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
                local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
                tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
                 tcol1[x].dR = (r2-r1)/t.sectors
                tcol1[x].dG = (g2-g1)/t.sectors
                tcol1[x].dB = (b2-b1)/t.sectors
                tcol1[x].dA = (a2-a1)/t.sectors        
                
            end
        end
        
        return tcol1
    end

    --check values
    local function setup(t)
        if t.name==nil and t.arg==nil then 
            print ("No input values ... use parameters 'name'" +
                " with 'arg' or only parameter 'arg' ") 
            return
        end

        if t.max==nil then
            print ("No maximum value defined, use 'max'")
            print ("for name=" .. t.name)
            print ("with arg=" .. t.arg)
            return
        end
        if t.name==nil then t.name="" end
        if t.arg==nil then t.arg="" end

        if t.xc==nil then t.xc=conky_window.width/2 end
        if t.yc==nil then t.yc=conky_window.height/2 end
        if t.thickness ==nil then t.thickness = 10 end
        if t.radius ==nil then t.radius =conky_window.width/4 end
        if t.start_angle==nil then t.start_angle =0 end
        if t.end_angle==nil then t.end_angle=360 end
        if t.bg_colour1==nil then 
            t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
        end
        if t.fg_colour1==nil then
            t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
        end
        if t.bd_colour1==nil then
            t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
        end
        if t.sectors==nil then t.sectors=10 end
        if t.gap_sectors==nil then t.gap_sectors=1 end 
        if t.fill_sector==nil then t.fill_sector=false end
        if t.sectors==1 then t.fill_sector=false end
        if t.border_size==nil then t.border_size=0 end
        if t.cap==nil then t.cap="p" end
        --some checks
        if t.thickness>t.radius then t.thickness=t.radius*0.1 end
        t.int_radius = t.radius-t.thickness

        --check colors tables 
        for i=1, #t.bg_colour1 do 
            if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
        end
        for i=1, #t.fg_colour1 do 
            if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
        end
        for i=1, #t.bd_colour1 do 
            if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
        end
    
        if t.bg_colour2~=nil then
            for i=1, #t.bg_colour2 do 
                if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
            end
        end
        if t.fg_colour2~=nil then
            for i=1, #t.fg_colour2 do 
                if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
            end
        end
        if t.bd_colour2~=nil then
            for i=1, #t.bd_colour2 do 
                if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
            end
        end     
        
        if t.start_angle>=t.end_angle then
         local tmp_angle=t.end_angle
         t.end_angle= t.start_angle
         t.start_angle = tmp_angle
         -- print ("inversed angles")
            if t.end_angle-t.start_angle>360 and t.start_angle>0 then
                t.end_angle=360+t.start_angle
                print ("reduce angles")
            end
        
            if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
                t.end_angle=360+t.start_angle
                print ("reduce angles")
            end
        
            if t.int_radius<0 then t.int_radius =0 end
            if t.int_radius>t.radius then
                local tmp_radius=t.radius
                t.radius=t.int_radius
                t.int_radius=tmp_radius
                print ("inversed radius")
            end
            if t.int_radius==t.radius then
                t.int_radius=0
                print ("int radius set to 0")
            end 
        end
        
        t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
        t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
        t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
    end
    
    if t.draw_me == true then t.draw_me = nil end
    if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end    
    --initialize table
    setup(t)
    
    --initialize cairo context
    cairo_save(cr)
    cairo_translate(cr,t.xc,t.yc)
    cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
    cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)

    --get value
    local value = 0
    if t.name ~="" then
        value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
    else
        value = tonumber(t.arg)
    end
    if value==nil then value =0 end

    --initialize sectors
    --angle of a sector :
    local angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
    --value of a sector : 
    local valueA = t.max/t.sectors
    --first angle of a sector : 
    local lastAngle = t.start_angle*math.pi/180


    local function draw_sector(type_arc,angle0,angle,valpc, idx)
     
        --this function draws a portion of arc
         --type of arc, angle0 = strating angle, angle= angle of sector,
         --valpc = percentage inside the sector, idx = sctor number #
         local tcolor
         if type_arc=="bg" then         --background
             if valpc==1 then return end
             tcolor=t.bg_colour1
         elseif type_arc=="fg" then    --foreground
             if valpc==0 then return end
             tcolor=t.fg_colour1
         elseif type_arc=="bd" then    --border
             tcolor=t.bd_colour1
         end 

        --angles equivalents to gap_sector
        local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
        local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))

        --angles of arcs
        local ext_angle=(angle-ext_delta*2)*valpc
        local int_angle=(angle-int_delta*2)*valpc

        --define colours to use for this sector
        if #tcolor==1 then 
            --plain color
            local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
            cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
                                    vG+tcolor[1].dG*idx,
                                    vB+tcolor[1].dB*idx,
                                    vA+tcolor[1].dA*idx    )
        else
            --radient color
            local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
            for i=1, #tcolor do
                local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
                cairo_pattern_add_color_stop_rgba (pat, 
                                    vP+tcolor[i].dP*idx,
                                    vR+tcolor[i].dR*idx,
                                    vG+tcolor[i].dG*idx,
                                    vB+tcolor[i].dB*idx,
                                    vA+tcolor[i].dA*idx    )
            end
            cairo_set_source (cr, pat)
            cairo_pattern_destroy(pat)
        end

        --start drawing
         cairo_save(cr)
        --x axis is parrallel to start of sector
        cairo_rotate(cr,angle0-math.pi/2)

        local ri,re = t.int_radius ,t.radius

        --point A 
        local angle_a
    
        if t.cap == "p" then 
            angle_a = int_delta
            if t.inverse_arc and type_arc ~="bg" then
                angle_a = angle-int_angle-int_delta
            end
            if not(t.inverse_arc) and type_arc =="bg" then
                angle_a = int_delta+int_angle
            end
        else --t.cap=="r"
            angle_a = ext_delta
            if t.inverse_arc and type_arc~="bg" then
                angle_a = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_a = ext_delta+ext_angle
            end
        end
        local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)


        --point B
        local angle_b = ext_delta
        if t.cap == "p" then 
            if t.inverse_arc and type_arc ~="bg" then
                angle_b = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_b = ext_delta+ext_angle
            end
        else
            if t.inverse_arc and type_arc ~="bg" then
                angle_b = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_b = ext_delta+ext_angle
            end
        end
        local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)

        -- EXTERNAL ARC B --> C
        local b0,b1
        if t.inverse_arc then
            if type_arc=="bg" then
                b0,b1= ext_delta, angle-ext_delta-ext_angle
            else
                b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
            end
        else
            if type_arc=="bg" then
                b0,b1= ext_delta+ext_angle, angle-ext_delta
            else
                b0,b1= ext_delta, ext_angle+ext_delta
            end
        end
        
        ---POINT D
        local angle_c, angle_d
        if t.cap == "p" then 
            angle_d = angle-int_delta
            if t.inverse_arc and type_arc=="bg" then
                angle_d = angle-int_delta-int_angle    
            end
            if not(t.inverse_arc) and type_arc~="bg" then
                angle_d=int_delta+int_angle
            end
        else
            angle_d = angle-ext_delta
            if t.inverse_arc and type_arc=="bg" then
                angle_d =angle-ext_delta-ext_angle
            end
            if not(t.inverse_arc) and type_arc~="bg" then
                angle_d = ext_angle+ext_delta
            end
        end
        local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
        
        -- INTERNAL ARC D --> A
        local d0,d1
        if t.cap=="p" then    
            if t.inverse_arc then    
                if type_arc=="bg" then
                    d0,d1= angle-int_delta-int_angle,int_delta
                else
                    d0,d1= angle-int_delta, angle- int_angle-int_delta
                end
            else
                if type_arc=="bg" then
                    d0,d1= angle-int_delta, int_delta+int_angle
                else
                    d0,d1= int_delta+int_angle, int_delta
                end
            end
        else
            if t.inverse_arc then    
                if type_arc=="bg" then    
                    d0,d1= angle-ext_delta-ext_angle,ext_delta
                else
                    d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
                end
            else
                if type_arc=="bg" then    
                    d0,d1= angle-ext_delta,ext_delta+ext_angle
                else    
                    d0,d1= ext_angle+ext_delta, ext_delta
                end
            end            
        end
            
        --draw sector
        cairo_move_to(cr,ax,ay)
        cairo_line_to(cr,bx,by)
        cairo_arc(cr,0,0,re,b0,b1)
        cairo_line_to(cr,dx,dy) 
        cairo_arc_negative(cr,0,0,ri,d0,d1)
         cairo_close_path (cr);

        --stroke or fill sector
         if type_arc=="bd" then
             cairo_set_line_width(cr,t.border_size)
             cairo_stroke(cr)
         else
             cairo_fill(cr)
         end

         cairo_restore(cr)

     end
    --draw sectors
    local n0,n1,n2 = 1,t.sectors,1
    if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
    local index = 0
    for i = n0,n1,n2 do 
        index = index +1
        local valueZ=1
        local cstA, cstB = (i-1),i
        if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
        
        if value>valueA *cstA and value<valueA*cstB then
            if not t.fill_sector then
                valueZ = (value-valueA*cstA)/valueA
            end
        else
            if value<valueA*cstB then valueZ=0 end
        end
        
        local start_angle= lastAngle+(i-1)*angleA
        if t.foreground ~= false then 
            draw_sector("fg",start_angle,angleA,valueZ, index)
        end
        if t.background ~= false then 
            draw_sector("bg",start_angle,angleA,valueZ, i)
        end
        if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
    end

    cairo_restore(cr)
end


--[[END OF RING-SECTORS WIDGET]]

ring2.lua

--[[
Ring Meters by londonali1010 (2009)

This script draws percentage meters as rings. It is fully customisable; all options are described in the script.

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

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

Changelog:
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]

require 'cairo'

function conky_main_rings()
-- START PARAMETERS HERE
rings_settings={
    {
    name='downspeedf',
    arg='eth0',
    max=8000,
    xc=52,
    yc=315,
    radius=30,
    thickness=5,
    start_angle=270,
    end_angle=570,
    sectors=1,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    fg_colour2={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    bd_colour1={{0,0X000000,1},{0.5,0x000000,1}, {1,0x000000,1}},
    },
    {
        name='upspeedf',
        arg='eth0',
    max=8000,
    xc=150,
    yc=315,
    radius=30,
    thickness=5,
    start_angle=270,
    end_angle=570,
    sectors=1,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    fg_colour2={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    bd_colour1={{0,0X000000,1},{0.5,0x000000,1}, {1,0x000000,1}},
    },

}

--END OF PARAMETERS HERE

--main function

    --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 tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(rings_settings) do
            draw_ring(cr,rings_settings[i])
        end
    end

    cairo_destroy(cr)

end




function draw_ring(cr, t)

    local function rgba_to_r_g_b_a(tcolour)
        local colour,alpha=tcolour[2],tcolour[3]
        return ((colour / 0x10000) % 0x100) / 255., 
            ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
            
            
    local function calc_delta(tcol1,tcol2)
        --calculate deltas P R G B A to table_colour 1

        for x = 1, #tcol1 do
            tcol1[x].dA    = 0
            tcol1[x].dP = 0
             tcol1[x].dR = 0
            tcol1[x].dG = 0
            tcol1[x].dB = 0
            if tcol2~=nil and #tcol1 == #tcol2 then
                local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
                local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
                tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
                 tcol1[x].dR = (r2-r1)/t.sectors
                tcol1[x].dG = (g2-g1)/t.sectors
                tcol1[x].dB = (b2-b1)/t.sectors
                tcol1[x].dA = (a2-a1)/t.sectors        
                
            end
        end
        
        return tcol1
    end

    --check values
    local function setup(t)
        if t.name==nil and t.arg==nil then 
            print ("No input values ... use parameters 'name'" +
                " with 'arg' or only parameter 'arg' ") 
            return
        end

        if t.max==nil then
            print ("No maximum value defined, use 'max'")
            print ("for name=" .. t.name)
            print ("with arg=" .. t.arg)
            return
        end
        if t.name==nil then t.name="" end
        if t.arg==nil then t.arg="" end

        if t.xc==nil then t.xc=conky_window.width/2 end
        if t.yc==nil then t.yc=conky_window.height/2 end
        if t.thickness ==nil then t.thickness = 10 end
        if t.radius ==nil then t.radius =conky_window.width/4 end
        if t.start_angle==nil then t.start_angle =0 end
        if t.end_angle==nil then t.end_angle=360 end
        if t.bg_colour1==nil then 
            t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
        end
        if t.fg_colour1==nil then
            t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
        end
        if t.bd_colour1==nil then
            t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
        end
        if t.sectors==nil then t.sectors=10 end
        if t.gap_sectors==nil then t.gap_sectors=1 end 
        if t.fill_sector==nil then t.fill_sector=false end
        if t.sectors==1 then t.fill_sector=false end
        if t.border_size==nil then t.border_size=0 end
        if t.cap==nil then t.cap="p" end
        --some checks
        if t.thickness>t.radius then t.thickness=t.radius*0.1 end
        t.int_radius = t.radius-t.thickness

        --check colors tables 
        for i=1, #t.bg_colour1 do 
            if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
        end
        for i=1, #t.fg_colour1 do 
            if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
        end
        for i=1, #t.bd_colour1 do 
            if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
        end
    
        if t.bg_colour2~=nil then
            for i=1, #t.bg_colour2 do 
                if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
            end
        end
        if t.fg_colour2~=nil then
            for i=1, #t.fg_colour2 do 
                if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
            end
        end
        if t.bd_colour2~=nil then
            for i=1, #t.bd_colour2 do 
                if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
            end
        end     
        
        if t.start_angle>=t.end_angle then
         local tmp_angle=t.end_angle
         t.end_angle= t.start_angle
         t.start_angle = tmp_angle
         -- print ("inversed angles")
            if t.end_angle-t.start_angle>360 and t.start_angle>0 then
                t.end_angle=360+t.start_angle
                print ("reduce angles")
            end
        
            if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
                t.end_angle=360+t.start_angle
                print ("reduce angles")
            end
        
            if t.int_radius<0 then t.int_radius =0 end
            if t.int_radius>t.radius then
                local tmp_radius=t.radius
                t.radius=t.int_radius
                t.int_radius=tmp_radius
                print ("inversed radius")
            end
            if t.int_radius==t.radius then
                t.int_radius=0
                print ("int radius set to 0")
            end 
        end
        
        t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
        t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
        t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
    end
    
    if t.draw_me == true then t.draw_me = nil end
    if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end    
    --initialize table
    setup(t)
    
    --initialize cairo context
    cairo_save(cr)
    cairo_translate(cr,t.xc,t.yc)
    cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
    cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)

    --get value
    local value = 0
    if t.name ~="" then
        value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
    else
        value = tonumber(t.arg)
    end
    if value==nil then value =0 end

    --initialize sectors
    --angle of a sector :
    local angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
    --value of a sector : 
    local valueA = t.max/t.sectors
    --first angle of a sector : 
    local lastAngle = t.start_angle*math.pi/180


    local function draw_sector(type_arc,angle0,angle,valpc, idx)
     
        --this function draws a portion of arc
         --type of arc, angle0 = strating angle, angle= angle of sector,
         --valpc = percentage inside the sector, idx = sctor number #
         local tcolor
         if type_arc=="bg" then         --background
             if valpc==1 then return end
             tcolor=t.bg_colour1
         elseif type_arc=="fg" then    --foreground
             if valpc==0 then return end
             tcolor=t.fg_colour1
         elseif type_arc=="bd" then    --border
             tcolor=t.bd_colour1
         end 

        --angles equivalents to gap_sector
        local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
        local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))

        --angles of arcs
        local ext_angle=(angle-ext_delta*2)*valpc
        local int_angle=(angle-int_delta*2)*valpc

        --define colours to use for this sector
        if #tcolor==1 then 
            --plain color
            local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
            cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
                                    vG+tcolor[1].dG*idx,
                                    vB+tcolor[1].dB*idx,
                                    vA+tcolor[1].dA*idx    )
        else
            --radient color
            local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
            for i=1, #tcolor do
                local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
                cairo_pattern_add_color_stop_rgba (pat, 
                                    vP+tcolor[i].dP*idx,
                                    vR+tcolor[i].dR*idx,
                                    vG+tcolor[i].dG*idx,
                                    vB+tcolor[i].dB*idx,
                                    vA+tcolor[i].dA*idx    )
            end
            cairo_set_source (cr, pat)
            cairo_pattern_destroy(pat)
        end

        --start drawing
         cairo_save(cr)
        --x axis is parrallel to start of sector
        cairo_rotate(cr,angle0-math.pi/2)

        local ri,re = t.int_radius ,t.radius

        --point A 
        local angle_a
    
        if t.cap == "p" then 
            angle_a = int_delta
            if t.inverse_arc and type_arc ~="bg" then
                angle_a = angle-int_angle-int_delta
            end
            if not(t.inverse_arc) and type_arc =="bg" then
                angle_a = int_delta+int_angle
            end
        else --t.cap=="r"
            angle_a = ext_delta
            if t.inverse_arc and type_arc~="bg" then
                angle_a = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_a = ext_delta+ext_angle
            end
        end
        local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)


        --point B
        local angle_b = ext_delta
        if t.cap == "p" then 
            if t.inverse_arc and type_arc ~="bg" then
                angle_b = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_b = ext_delta+ext_angle
            end
        else
            if t.inverse_arc and type_arc ~="bg" then
                angle_b = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_b = ext_delta+ext_angle
            end
        end
        local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)

        -- EXTERNAL ARC B --> C
        local b0,b1
        if t.inverse_arc then
            if type_arc=="bg" then
                b0,b1= ext_delta, angle-ext_delta-ext_angle
            else
                b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
            end
        else
            if type_arc=="bg" then
                b0,b1= ext_delta+ext_angle, angle-ext_delta
            else
                b0,b1= ext_delta, ext_angle+ext_delta
            end
        end
        
        ---POINT D
        local angle_c, angle_d
        if t.cap == "p" then 
            angle_d = angle-int_delta
            if t.inverse_arc and type_arc=="bg" then
                angle_d = angle-int_delta-int_angle    
            end
            if not(t.inverse_arc) and type_arc~="bg" then
                angle_d=int_delta+int_angle
            end
        else
            angle_d = angle-ext_delta
            if t.inverse_arc and type_arc=="bg" then
                angle_d =angle-ext_delta-ext_angle
            end
            if not(t.inverse_arc) and type_arc~="bg" then
                angle_d = ext_angle+ext_delta
            end
        end
        local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
        
        -- INTERNAL ARC D --> A
        local d0,d1
        if t.cap=="p" then    
            if t.inverse_arc then    
                if type_arc=="bg" then
                    d0,d1= angle-int_delta-int_angle,int_delta
                else
                    d0,d1= angle-int_delta, angle- int_angle-int_delta
                end
            else
                if type_arc=="bg" then
                    d0,d1= angle-int_delta, int_delta+int_angle
                else
                    d0,d1= int_delta+int_angle, int_delta
                end
            end
        else
            if t.inverse_arc then    
                if type_arc=="bg" then    
                    d0,d1= angle-ext_delta-ext_angle,ext_delta
                else
                    d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
                end
            else
                if type_arc=="bg" then    
                    d0,d1= angle-ext_delta,ext_delta+ext_angle
                else    
                    d0,d1= ext_angle+ext_delta, ext_delta
                end
            end            
        end
            
        --draw sector
        cairo_move_to(cr,ax,ay)
        cairo_line_to(cr,bx,by)
        cairo_arc(cr,0,0,re,b0,b1)
        cairo_line_to(cr,dx,dy) 
        cairo_arc_negative(cr,0,0,ri,d0,d1)
         cairo_close_path (cr);

        --stroke or fill sector
         if type_arc=="bd" then
             cairo_set_line_width(cr,t.border_size)
             cairo_stroke(cr)
         else
             cairo_fill(cr)
         end

         cairo_restore(cr)

     end
    --draw sectors
    local n0,n1,n2 = 1,t.sectors,1
    if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
    local index = 0
    for i = n0,n1,n2 do 
        index = index +1
        local valueZ=1
        local cstA, cstB = (i-1),i
        if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
        
        if value>valueA *cstA and value<valueA*cstB then
            if not t.fill_sector then
                valueZ = (value-valueA*cstA)/valueA
            end
        else
            if value<valueA*cstB then valueZ=0 end
        end
        
        local start_angle= lastAngle+(i-1)*angleA
        if t.foreground ~= false then 
            draw_sector("fg",start_angle,angleA,valueZ, index)
        end
        if t.background ~= false then 
            draw_sector("bg",start_angle,angleA,valueZ, i)
        end
        if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
    end

    cairo_restore(cr)
end


--[[END OF RING-SECTORS WIDGET]]

conkyForecast.config

# config settings for conkyForecast.py
CACHE_FOLDERPATH = /tmp/
CONNECTION_TIMEOUT = 5
EXPIRY_MINUTES = 30
TIME_FORMAT = %H:%M
DATE_FORMAT = %d-%m-%Y
LOCALE =  fr
XOAP_PARTNER_ID = ########
XOAP_LICENCE_KEY = ############

myweather.template

${voffset 5}${goto 10}${font ConkyWeather:style=Bold:size=60}${image [--datatype=WI] -p 0,40 -s 90x90}${font}
${image $HOME/conky/pix/thermo1.png -p 0,150 -s 40x40}${goto 60}${voffset 15}${font Bitstream Vera Sans Mono:style=Bold:size=16}[--datatype=HT --hideunits --centeredwidth=3]${font}
#/[--datatype=LT --hideunits --centeredwidth=3]
${voffset 10}${goto 10}${image [--datatype=BI] -p 0,205 -s 45x45}${goto 50}${voffset 25}${font Bitstream Vera Sans Mono:style=Bold:size=12}[--datatype=WS --imperial]
${goto 50}${font Bitstream Vera Sans Mono:style=Bold:size=12} [--datatype=WD]${font}  ${voffset -175}${goto 100}${color1}${font Bitstream Vera Sans Mono:style=Bold:size=15 les t}[--datatype=CT]${font}
# datatype OB=Station / CN=Ville
${voffset 20}${goto 120}${color3}Ville : $alignr${color1}[--datatype=CN]
${goto 120}${color3}Précipitations : $alignr${color1}[--datatype=PC --startday=0]
${goto 120}${color3}UV : $alignr${color1}[--datatype=UI] - [--datatype=UT]
${goto 120}${color3}Humidité : $alignr${color1}[--datatype=HM]
${goto 120}${color3}Point de rosée : $alignr${color1}[--datatype=DP]
${goto 120}${color3}Lever/Coucher : $alignr${color1}[--datatype=SR] / [--datatype=SS]
${goto 120}${color3}Pression : $alignr${color1}[--datatype=BR] - [--datatype=BD]
${goto 120}${color3}Lune : $alignr${color1}[--datatype=MP]
${color1}${voffset 80}${goto 25}[--datatype=DW --startday=1 --shortweekday]${offset 64}[--datatype=DW --startday=2 --shortweekday]${offset 64}[--datatype=DW --startday=3 --shortweekday] ${offset 64}[--datatype=DW --startday=4 --shortweekday]
${goto 30}${image [--datatype=WI --startday=1] -p 2,298 -s 60x60}
${goto 30}${image [--datatype=WI --startday=2] -p 85,298 -s 60x60}
${goto 30}${image [--datatype=WI --startday=3] -p 170,298 -s 60x60}
${goto 30}${image [--datatype=WI --startday=4] -p 257,298 -s 60x60}
${goto 18}[--datatype=HT --startday=1 --hideunits --centeredwidth=3]/[--datatype=LT --startday=1 --hideunits --centeredwidth=3]${goto 102}[--datatype=HT --startday=2 --hideunits --centeredwidth=3]/[--datatype=LT --startday=2 --hideunits --centeredwidth=3]${goto 182}[--datatype=HT --startday=3 --hideunits --centeredwidth=3]/[--datatype=LT --startday=3 --hideunits --centeredwidth=3]${goto 272}[--datatype=HT --startday=4 --hideunits --centeredwidth=3]/[--datatype=LT --startday=4 --hideunits --centeredwidth=3]
${image [--datatype=MI] -p 160,215 -s 60x60}
${voffset 5}${goto 5}${color3}Dernière mise à jour météo: ${color1}[--datatype=LU]${font}

ip-ext.sh

#!/bin/sh

# Afficher ip externe
wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1

et enfin les scripts adapter :

horloge_ring.lua

--[[
Ring Meters by londonali1010 (2009)

This script draws percentage meters as rings. It is fully customisable; all options are described in the script.

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

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

Changelog:
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
 
require 'cairo'

function conky_main_rings()

if (os.date("%l"))=='12' then 
    heure=(os.date("%M")/60) 
else 
    heure=(os.date("%l"))+(os.date("%M")/60) 
end

-- START PARAMETERS HERE
local rings_settings={

    {
    name="",
    arg=heure,
    max=11.99,
    xc=160,
    yc=150,
    radius=110,
    thickness=25,
    gap_sectors=5,
    sectors=12,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0xFFFF00,0},{0.5,0xFFFF00,1}, {1,0xFFFF00,0}},
    fg_colour2={{0,0X0FF000,0},{0.5,0x0FF000,1}, {1,0x0FF000,0}},
    bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
    },
    {
    name="",
    arg=(os.date("%M"))+(os.date("%S")/60),
    max=59.99,
    xc=160,
    yc=150,
    radius=130,
    thickness=20,
    start_angle=0,
    end_angle=360,
    gap_sectors=2.5,
    sectors=60,
    fill_sector=false,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0X0FFFF0,0},{0.5,0X0FFFF0,1}, {1,0X0FFFF0,0}},
    fg_colour2={{0,0x00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
    bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
    },
    {
    name="time",
    arg="%S",
    max=60,
    xc=160,
    yc=150,
    radius=150,
    thickness=20,
    start_angle=0,
    end_angle=360,
    sectors=60,
    fill_sector=false,
    bg_colour1={{0,0x999999,0},{0.5,0x999999,1}, {1,0x999999,0}},
    fg_colour1={{0,0XFFF00F,0},{0.5,0xFFF00F,1}, {1,0xFFF00F,0}},
    fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
    bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
    },

}

--END OF PARAMETERS HERE

--main function

    --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 tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(rings_settings) do
            draw_ring(cr,rings_settings[i])
        end
    end

    cairo_destroy(cr)
end



function draw_ring(cr, t)

    local function rgba_to_r_g_b_a(tcolour)
        local colour,alpha=tcolour[2],tcolour[3]
        return ((colour / 0x10000) % 0x100) / 255., 
            ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
    end
            
            
    local function calc_delta(tcol1,tcol2)
        --calculate deltas P R G B A to table_colour 1

        for x = 1, #tcol1 do
            tcol1[x].dA = 0
            tcol1[x].dP = 0
             tcol1[x].dR = 0
            tcol1[x].dG = 0
            tcol1[x].dB = 0
            if tcol2~=nil and #tcol1 == #tcol2 then
                local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
                local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
                tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
                 tcol1[x].dR = (r2-r1)/t.sectors
                tcol1[x].dG = (g2-g1)/t.sectors
                tcol1[x].dB = (b2-b1)/t.sectors
                tcol1[x].dA = (a2-a1)/t.sectors        
                
            end
        end
        
        return tcol1
    end

    --check values
    local function setup(t)
        if t.name==nil and t.arg==nil then 
            print ("No input values ... use parameters 'name'" +
                " with 'arg' or only parameter 'arg' ") 
            return
        end

        if t.max==nil then
            print ("No maximum value defined, use 'max'")
            print ("for name=" .. t.name)
            print ("with arg=" .. t.arg)
            return
        end
        if t.name==nil then t.name="" end
        if t.arg==nil then t.arg="" end

        if t.xc==nil then t.xc=conky_window.width/2 end
        if t.yc==nil then t.yc=conky_window.height/2 end
        if t.thickness ==nil then t.thickness = 10 end
        if t.radius ==nil then t.radius =conky_window.width/4 end
        if t.start_angle==nil then t.start_angle =0 end
        if t.end_angle==nil then t.end_angle=360 end
        if t.bg_colour1==nil then 
            t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
        end
        if t.fg_colour1==nil then
            t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
        end
        if t.bd_colour1==nil then
            t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
        end
        if t.sectors==nil then t.sectors=10 end
        if t.gap_sectors==nil then t.gap_sectors=1 end 
        if t.fill_sector==nil then t.fill_sector=false end
        if t.sectors==1 then t.fill_sector=false end
        if t.border_size==nil then t.border_size=0 end
        if t.cap==nil then t.cap="p" end
        --some checks
        if t.thickness>t.radius then t.thickness=t.radius*0.1 end
        t.int_radius = t.radius-t.thickness

        --check colors tables 
        for i=1, #t.bg_colour1 do 
            if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
        end
        for i=1, #t.fg_colour1 do 
            if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
        end
        for i=1, #t.bd_colour1 do 
            if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
        end
    
        if t.bg_colour2~=nil then
            for i=1, #t.bg_colour2 do 
                if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
            end
        end
        if t.fg_colour2~=nil then
            for i=1, #t.fg_colour2 do 
                if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
            end
        end
        if t.bd_colour2~=nil then
            for i=1, #t.bd_colour2 do 
                if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
            end
        end     
        
        if t.start_angle>=t.end_angle then
         local tmp_angle=t.end_angle
         t.end_angle= t.start_angle
         t.start_angle = tmp_angle
         -- print ("inversed angles")
            if t.end_angle-t.start_angle>360 and t.start_angle>0 then
                t.end_angle=360+t.start_angle
                print ("reduce angles")
            end
        
            if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
                t.end_angle=360+t.start_angle
                print ("reduce angles")
            end
        
            if t.int_radius<0 then t.int_radius =0 end
            if t.int_radius>t.radius then
                local tmp_radius=t.radius
                t.radius=t.int_radius
                t.int_radius=tmp_radius
                print ("inversed radius")
            end
            if t.int_radius==t.radius then
                t.int_radius=0
                print ("int radius set to 0")
            end 
        end
        
        t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
        t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
        t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
    end
    
    if t.draw_me == true then t.draw_me = nil end
    if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end    
    --initialize table
    setup(t)
    
    --initialize cairo context
    cairo_save(cr)
    cairo_translate(cr,t.xc,t.yc)
    cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
    cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)

    --get value
    local value = 0
    if t.name ~="" then
        value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
    else
        value = tonumber(t.arg)
    end
    if value==nil then value =0 end

    --initialize sectors
    --angle of a sector :
    local angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
    --value of a sector : 
    local valueA = t.max/t.sectors
    --first angle of a sector : 
    local lastAngle = t.start_angle*math.pi/180


    local function draw_sector(type_arc,angle0,angle,valpc, idx)
     
        --this function draws a portion of arc
         --type of arc, angle0 = strating angle, angle= angle of sector,
         --valpc = percentage inside the sector, idx = sctor number #
         local tcolor
         if type_arc=="bg" then         --background
             if valpc==1 then return end
             tcolor=t.bg_colour1
         elseif type_arc=="fg" then    --foreground
             if valpc==0 then return end
             tcolor=t.fg_colour1
         elseif type_arc=="bd" then    --border
             tcolor=t.bd_colour1
         end 

        --angles equivalents to gap_sector
        local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
        local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))

        --angles of arcs
        local ext_angle=(angle-ext_delta*2)*valpc
        local int_angle=(angle-int_delta*2)*valpc

        --define colours to use for this sector
        if #tcolor==1 then 
            --plain color
            local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
            cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
                                    vG+tcolor[1].dG*idx,
                                    vB+tcolor[1].dB*idx,
                                    vA+tcolor[1].dA*idx    )
        else
            --radient color
            local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
            for i=1, #tcolor do
                local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
                cairo_pattern_add_color_stop_rgba (pat, 
                                    vP+tcolor[i].dP*idx,
                                    vR+tcolor[i].dR*idx,
                                    vG+tcolor[i].dG*idx,
                                    vB+tcolor[i].dB*idx,
                                    vA+tcolor[i].dA*idx    )
            end
            cairo_set_source (cr, pat)
            cairo_pattern_destroy(pat)
        end

        --start drawing
         cairo_save(cr)
        --x axis is parrallel to start of sector
        cairo_rotate(cr,angle0-math.pi/2)

        local ri,re = t.int_radius ,t.radius

        --point A 
        local angle_a
    
        if t.cap == "p" then 
            angle_a = int_delta
            if t.inverse_arc and type_arc ~="bg" then
                angle_a = angle-int_angle-int_delta
            end
            if not(t.inverse_arc) and type_arc =="bg" then
                angle_a = int_delta+int_angle
            end
        else --t.cap=="r"
            angle_a = ext_delta
            if t.inverse_arc and type_arc~="bg" then
                angle_a = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_a = ext_delta+ext_angle
            end
        end
        local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)


        --point B
        local angle_b = ext_delta
        if t.cap == "p" then 
            if t.inverse_arc and type_arc ~="bg" then
                angle_b = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_b = ext_delta+ext_angle
            end
        else
            if t.inverse_arc and type_arc ~="bg" then
                angle_b = angle-ext_angle-ext_delta
            end
            if not(t.inverse_arc) and type_arc=="bg" then
                angle_b = ext_delta+ext_angle
            end
        end
        local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)

        -- EXTERNAL ARC B --> C
        local b0,b1
        if t.inverse_arc then
            if type_arc=="bg" then
                b0,b1= ext_delta, angle-ext_delta-ext_angle
            else
                b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
            end
        else
            if type_arc=="bg" then
                b0,b1= ext_delta+ext_angle, angle-ext_delta
            else
                b0,b1= ext_delta, ext_angle+ext_delta
            end
        end
        
        ---POINT D
        local angle_c, angle_d
        if t.cap == "p" then 
            angle_d = angle-int_delta
            if t.inverse_arc and type_arc=="bg" then
                angle_d = angle-int_delta-int_angle    
            end
            if not(t.inverse_arc) and type_arc~="bg" then
                angle_d=int_delta+int_angle
            end
        else
            angle_d = angle-ext_delta
            if t.inverse_arc and type_arc=="bg" then
                angle_d =angle-ext_delta-ext_angle
            end
            if not(t.inverse_arc) and type_arc~="bg" then
                angle_d = ext_angle+ext_delta
            end
        end
        local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)
        
        -- INTERNAL ARC D --> A
        local d0,d1
        if t.cap=="p" then    
            if t.inverse_arc then    
                if type_arc=="bg" then
                    d0,d1= angle-int_delta-int_angle,int_delta
                else
                    d0,d1= angle-int_delta, angle- int_angle-int_delta
                end
            else
                if type_arc=="bg" then
                    d0,d1= angle-int_delta, int_delta+int_angle
                else
                    d0,d1= int_delta+int_angle, int_delta
                end
            end
        else
            if t.inverse_arc then    
                if type_arc=="bg" then    
                    d0,d1= angle-ext_delta-ext_angle,ext_delta
                else
                    d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
                end
            else
                if type_arc=="bg" then    
                    d0,d1= angle-ext_delta,ext_delta+ext_angle
                else    
                    d0,d1= ext_angle+ext_delta, ext_delta
                end
            end            
        end
            
        --draw sector
        cairo_move_to(cr,ax,ay)
        cairo_line_to(cr,bx,by)
        cairo_arc(cr,0,0,re,b0,b1)
        cairo_line_to(cr,dx,dy) 
        cairo_arc_negative(cr,0,0,ri,d0,d1)
         cairo_close_path (cr);

        --stroke or fill sector
         if type_arc=="bd" then
             cairo_set_line_width(cr,t.border_size)
             cairo_stroke(cr)
         else
             cairo_fill(cr)
         end

         cairo_restore(cr)

     end
    --draw sectors
    local n0,n1,n2 = 1,t.sectors,1
    if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
    local index = 0
    for i = n0,n1,n2 do 
        index = index +1
        local valueZ=1
        local cstA, cstB = (i-1),i
        if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end
        
        if value>valueA *cstA and value<valueA*cstB then
            if not t.fill_sector then
                valueZ = (value-valueA*cstA)/valueA
            end
        else
            if value<valueA*cstB then valueZ=0 end
        end
        
        local start_angle= lastAngle+(i-1)*angleA
        if t.foreground ~= false then 
            draw_sector("fg",start_angle,angleA,valueZ, index)
        end
        if t.background ~= false then 
            draw_sector("bg",start_angle,angleA,valueZ, i)
        end
        if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
    end

    cairo_restore(cr)
end

--[[END OF RING-SECTORS WIDGET]]

et images2.sh

#! /bin/bash
cd ~/conky/images

miseajour=$(find -maxdepth 1 -mmin -15 -type f)

if [[ -n $miseajour ]]
    then
        # le dernier cliché à moins de 15 minutes pas de mise a jour.
        exit 0
        #----------------------------------
    else

    # Obtention des informations horaire
    
    Heuret=$(date -u +%H)
    Minutet=$(date +%M)
    Jourt=$(date -u +%d)
    Moit=$(date -u +%m)
    Aneet=$(date -u +%Y)

    #----------------------------------

    #Traitement des infos horaire

    case $Minutet in
        01|02|03|04|05|06|07|08|09|10|11|12|13|14)
            Minute=30
            Heure=$(date --date "$Aneet-$Moit-$Jourt $Heuret:00 1 hour ago" +%H)
            Jour=$(date --date "$Aneet-$Moit-$Jourt $Heuret:00 1 hour ago" +%d)
            Moi=$(date --date "$Aneet-$Moit-$Jourt $Heuret:00 1 hour ago" +%m)
            Anee=$(date --date "$Aneet-$Moit-$Jourt $Heuret:00 1 hour ago" +%Y)
        ;;
        15|16|17|18|19|20|21|22|23|24|25|26|27|28|29)
            Minute=45
            Heure=$(date --date "$Aneet-$Moit-$Jourt $Heuret:00 1 hour ago" +%H)
            Jour=$(date --date "$Aneet-$Moit-$Jourt $Heuret:00 1 hour ago" +%d)
            Moi=$(date --date "$Aneet-$Moit-$Jourt $Heuret:00 1 hour ago" +%m)
            Anee=$(date --date "$Aneet-$Moit-$Jourt $Heuret:00 1 hour ago" +%Y)
        ;;
        30|31|32|33|34|35|36|37|38|39|40|41|42|43|44)
            Minute=00
            Heure=$Heuret
            Jour=$Jourt
            Moi=$Moit
            Anee=$Aneet
        ;;
        45|46|47|48|49|50|51|52|53|54|55|56|57|58|59)
            Heure=$Heuret
            Jour=$Jourt
            Moi=$Moit
            Anee=$Aneet
            Minute=15
        ;;    
    esac
    
    
    #----------------------------------
    
    # Récupération des images sur les 24 dernières Heures
    
    compteur=0
    Minute1=$Minute
    Heuret=$Heure
    Jourt=$Jour
    Moit=$Moi
    Aneet=$Anee
    temp=0
    
    while (( $compteur < 96 ))
        do
        fichier=`expr 96 - $compteur`
    
        if [ -f $Anee$Moi$Jour$Heure$Minute1.jpg ]
        then
            if (( $(ls -s $Anee$Moi$Jour$Heure$Minute1.jpg |awk '{ print $1 }') != 4 ))
                then
                if (( $fichier < 10 ))
                    then
                        convert $Anee$Moi$Jour$Heure$Minute1.jpg -resize 320x320 Traitee/0$fichier.jpg
                    else
                        convert $Anee$Moi$Jour$Heure$Minute1.jpg -resize 320x320 Traitee/$fichier.jpg
                fi
                else
                    rm Traitee/$fichier.jpg
            fi
            compteur=`expr $compteur + 1`
            temp=`expr $temp + 15`
            Heure=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%H)
            Jour=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%d)
            Moi=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%m)
            Anee=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%Y)
            Minute1=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%M)
        else
            wget 'http://wofrance.fr/cgi-bin/getpicture?/daten/sat/im02/'$Anee'/'$Moi'/'$Jour'/'$Heure$Minute1'.jpg' --output-document=$Anee$Moi$Jour$Heure$Minute1.jpg
            if (( $(ls -s $Anee$Moi$Jour$Heure$Minute1.jpg |awk '{ print $1 }') != 4 ))
                then
                if (( $fichier < 10 ))
                    then
                        convert $Anee$Moi$Jour$Heure$Minute1.jpg -resize 320x320 Traitee/0$fichier.jpg
                    else
                        convert $Anee$Moi$Jour$Heure$Minute1.jpg -resize 320x320 Traitee/$fichier.jpg
                fi
                else
                    rm Traitee/$fichier.jpg
            fi
            compteur=`expr $compteur + 1`
            temp=`expr $temp + 15`
            Heure=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%H)
            Jour=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%d)
            Moi=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%m)
            Anee=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%Y)
            Minute1=$(date --date "$Aneet-$Moit-$Jourt $Heuret:$Minute $temp minutes ago" +%M)
        fi

    done

    #----------------------------------

    # Purge des fichiers ayant plus de 24 heures

    rm `find . -type f -mtime 1 -name "*.jpg"`
    rm `find . -type f -mtime +1 -name "*.jpg"`

    #----------------------------------
    
    # mise à jour de la vidéo

#    convert ~/conky/images/Traitee/*.jpg ~/conky/images/Traitee/satelite.gif
    killall animate
    exit 0
    #-----------------------------
fi
fi

Je crois que tous y est hmm

édit : il y avais un problème de mise à jour sur l'animation satellite pour le régler j'ai du modifier le conkyrc2, le conkyrc5, le images2.sh et enfin le lauch.sh.

Dernière modification par Didier-T (Le 27/10/2011, à 19:44)

Hors ligne

#1077 Le 11/10/2011, à 19:43

Phyllinux

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

Très sympa !
Mais je pense que le GIF animé est un peu trop gourmand pour un petit netbook. J'en resterai sur une image SAT fixe wink


The ship is sinking normally...

Hors ligne

#1078 Le 11/10/2011, à 20:37

Didier-T

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

Phyllinux a écrit :

Très sympa !
Mais je pense que le GIF animé est un peu trop gourmand pour un petit netbook. J'en resterai sur une image SAT fixe wink

Pas faux, il consomme pas mal de mémoire, par contre pas du tous de processeur (sauf au moment de la création du gif)
D’ailleurs ont le voit très bien placer dans les trois programmes les plus gourmand en mémoire #1 avec une conso de 136 Mo. big_smile

Hors ligne

#1079 Le 11/10/2011, à 23:10

fanou18000

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

Allez hop pour le plaisir mon nouveau desktop big_smile

mini_614377Capturemasque.jpg
Cliquer sur l'image pour l'agrandir

Le même, mais avec bordures png...

mini_457550Capturelast1.png
Cliquer sur l'image pour l'agrandir

Alors,
- Wallpaper par moi même (fierté fierté ^^)
- Nouveau conky fonctionnel à 200% par moi même (refierté refierté ^^) -> Logique ...
- Thème MacOS-X
- Icônes Cylon(Conky Haut) / Icônes Buttonized (Conky Bas)

Dernière modification par fanou18000 (Le 13/10/2011, à 11:09)


"C'est en faisant des erreurs qu'on avance..."
                             Donc ici pour apprendre.
            Ubuntu 10.04 Lucid Lynx et GNOME 2.30.2       (Depuis le 14/12/09)

Hors ligne

#1080 Le 12/10/2011, à 19:11

shamen456

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

Bonjour a tous...

j'aurais besoin de votre aide pour finaliser un conky...
conky vnstat
le conky ci-dessus m'affiche les stats de connexion (en utilisant vnstat) pour la connexion wifi et pour la connexion "3G" (clé USB - ppp0)
le type de connexion s'affiche en vert (ici "Wi-Fi connecté") mais c'est la que le problème se pose...

j'utilise if_up wlan0 ou if_up ppp0 pour changer la couleur et le texte mais comme mon récepteur wi-fi reste allumé en permanence, wlan0 est toujours "up"...

Est-ce que quelqu'un saurait comment faire pour qu'il ne s'active que lorsque je suis réellement connecté à un reseau wi-fi..? (genre if_existing qqch..)
j'utilise  if_gw pour affiche le conky uniquement si une connexion existe (wlan0 ou ppp0)
je suis sur un portable acer aspire (si ca peut avoir une quelconque importance...)
et pour info voici le conkyrc (juste la partie apres TEXT)

TEXT
${font URW Chancery L:style=Bold:size=10}#
${color white}#
${image ./pix/bigpanel3.png  -s 300x197 -p -1,-1}#
#${if_gw}#
Wi-Fi#
    ${if_up wlan0}${color green} Connecté #
    ${else}${color darkgrey} Déconnecté #
    ${endif}#
#${endif}
${color white}#
#${if_gw}#
    Clé 3G   #
    ${if_up ppp0}${color green} Connectée#
    ${else}${color darkgrey} Déconnectée#
    ${endif}#
#${endif}#

${color white}#
#${if_up wlan0}#
${font Liberation Mono:size=8:style=Bold}#
Wi-Fi #
${font Liberation Mono:size=8}#
${goto 60} Today ${goto 140} ${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f8}${goto 220} Total
  up :#
${color darkgrey}${goto 60}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f5}#
${goto 140}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f10}#
${goto 220}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f14}
${color white}down :#
${color darkgrey}${goto 60}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f4}#
${goto 140}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f9}#
${goto 220}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f13}
${font Liberation Mono:size=8:style=Bold}#
${color white}Total:${goto 60}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f6}#
${goto 140}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f11}#
${goto 220}${execi 60 vnstat -i wlan0 --oneline | cut -d\; -f15}

${font Liberation Mono:size=8:style=Bold}#
Clé 3G #
${font Liberation Mono:size=8}#
${goto 60} Today ${goto 140} ${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f8}${goto 220} Total
  up :#
${color darkgrey}${goto 60}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f5}#
${goto 140}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f10}#
${goto 220}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f14}
${color white}down :#
${color darkgrey}${goto 60}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f4}#
${goto 140}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f9}#
${goto 220}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f13}
${font Liberation Mono:size=8:style=Bold}#
${color white}Total:${goto 60}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f6}#
${goto 140}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f11}#
${goto 220}${execi 60 vnstat -i ppp0 --oneline | cut -d\; -f15}


#${execi 30 vnstat}${color grey}#
#${endif}

Bon conky à tous

Hors ligne

#1081 Le 12/10/2011, à 19:54

Didier-T

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

bonsoir shamen456,

Pourquoi ne tenterais tu pas de déterminer ton adresse IP pour savoir si tu es connecté au net ?

Hors ligne

#1082 Le 12/10/2011, à 20:16

torpedolos

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

Didier-T a écrit :

bonsoir shamen456,

Pourquoi ne tenterais tu pas de déterminer ton adresse IP pour savoir si tu es connecté au net ?

???

A mon avis, si il poste sur ce forum, il est connecté a internet ;-)


"La convivialité, c'est pas quand un tuto est bien fait, c'est quand il n'y a pas besoin de tuto !" (moi)
"Je ne suis pas un numéro de hotline !" (ploum) http://ploum.net/post/36-je-ne-suis-pas … geek-libre
"Knowledge belongs to everyone" (Kevin Mitnick)
https://bugs.launchpad.net/ubuntu/+bug/1

Hors ligne

#1083 Le 12/10/2011, à 20:26

Didier-T

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

torpedolos a écrit :
Didier-T a écrit :

bonsoir shamen456,

Pourquoi ne tenterais tu pas de déterminer ton adresse IP pour savoir si tu es connecté au net ?

???

A mon avis, si il poste sur ce forum, il est connecté a internet ;-)

j'aurais du être plus clair je vois, déterminer l'ip (local) du Wi-fi pour voir si il est connecter au net ou a un reseau(le Wi-fi bien sure) tongue

Dernière modification par Didier-T (Le 12/10/2011, à 21:10)

Hors ligne

#1084 Le 12/10/2011, à 21:31

torpedolos

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

smile


"La convivialité, c'est pas quand un tuto est bien fait, c'est quand il n'y a pas besoin de tuto !" (moi)
"Je ne suis pas un numéro de hotline !" (ploum) http://ploum.net/post/36-je-ne-suis-pas … geek-libre
"Knowledge belongs to everyone" (Kevin Mitnick)
https://bugs.launchpad.net/ubuntu/+bug/1

Hors ligne

#1085 Le 13/10/2011, à 07:55

shamen456

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

Bonjour à Tous...

@Didier-T : le fait de reconnaitre si une adresse IP locale est attribuée pourrait etre une maniere...Est-ce que tu sais quelle code employer?? (if_existing qqch...)

Sinon ce que je cherche en fait c'est un moyen de determiner si je suis connecté à un reseau Wi-Fi valide (qui n'est pas necessairement toujours le meme...) afin de pouvoir activer ou desactiver certaines partie des conky en fonction de la connexion..

en gros l'idee est la suivante :
If Wifi then ...else...
If 3G then...else...

Bon Conky a tous...

Hors ligne

#1086 Le 13/10/2011, à 09:32

wlourf

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

@shamen456

un truc comme ça devrait faire l'affaire :

${if_existing /sys/class/net/eth0/operstate up}eth0 up ${endif}
${if_existing /sys/class/net/wlan0/operstate up}wlan0 up ${endif}

Hors ligne

#1087 Le 13/10/2011, à 14:59

shamen456

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

@wlourf : Merci...!!! c'est exactement ce que je cherchais, ca marche au poil...

Hors ligne

#1088 Le 13/10/2011, à 21:16

ArzhurB

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

1318536744.png

Un nouveau .conkyrc, pas forcément révolutionnaire, avec un affichage horizontal et sobre, que je n’ai pas réussi à réaliser avec autre chose que des $goto, ce qui m’a obligé à supprimer mes indentations, rendant le code atroce. Des idées pour écrire ça plus joliment ?

############################################################################
#          Fichier de configuration pour Conky
#
#                             par ArzhurB, 
# fortement inspiré du fichier disponible sur http://doc.ubuntu-fr.org/conky
#                              oct. 2010
#                    Dernière révision : oct. 2011
#
############################################################################

### Affichage
# Couleurs
default_color black
default_shade_color 333333
default_outline_color black
color1 e49c16 
color2 CA0000 #rouge
color6 EEEEEE
color7 DDDDDD
color8 CCCCCC
color9 BBBBBB
# Size & position
alignment bottom
minimum_size 320 5
#maximum_width 200
# écart avec le bord x=gauche ou droit y= haut ou bas
gap_x 210
gap_y 12
#  afficher les ombres
draw_shades no
# afficher des contours
draw_outline no
# contours autour des blocs de texte
draw_borders no
# largeur du contour
border_width 1
# largeur des marges
#border_margin 4
# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 4
net_avg_samples 2
# Utiliser Xft (polices lissées etc)
use_xft yes
xftalpha .1
override_utf8_locale yes # force UTF8
#police a utiliser : use_xft doit être a "yes"
xftfont Fixed:size=8#OCR A Std:size=8
# Tout le texte en majuscule
uppercase no
# Ajoute des espaces après certains objets pour éviter de les faire bouger.
# Fonctionne uniquement avec les polices Fixes
use_spacer right

### Fonctionnement global
# temps pour fermer conky en seconde. 0 = toujours actif 
total_run_times 0
# affiche le texte sur la sortie standard
out_to_console no
# réglage de la mémoire, pour éviter le clignotement
double_buffer yes
# Soustraire les mémoires tampons de la mémoire utilisée
no_buffers yes
text_buffer_size 2048
# nombre d'échantillons à utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 4
net_avg_samples 2
# pour que conky tourne en arrière plan background no pour les tests
background yes
# utiliser sa propre fenêtre
own_window yes
# type de fenêtre : normal(avec le cadre) / override / desktop
own_window_type override
# pseudo transparence si vous avez des icones sous le conky elle ne seront plus accessible une fois conky activé
own_window_transparent yes

############ TEXT #############
TEXT
## SCHÉMA
#L\C    1        2    3        4        5
#1    Date    Système        Ressources    Disques        Réseau
#2    Heure    Distro        Proc %        R:T/L/U        Filaire:IP/D/U
#3            Kernel        Proc bar        R:bar        Filaire:bar
#4            Uptime/charge    RAM %        D:T/L/U        Wifi:IP/D/U
#5            Processus    Ram bar        D:bar        Wifi:bar
#
# Rhythmbox
${if_running rhythmbox}
${exec rhythmbox-client --print-playing-format "%aa"} — ${exec rhythmbox-client --print-playing-format "%at"} — ${exec rhythmbox-client --print-playing-format "%ay"} 
${exec rhythmbox-client --print-playing-format "%tN"} – ${exec rhythmbox-client --print-playing-format "%tt"} $alignr${exec rhythmbox-client --print-playing-format "%te/%td"}
${execbar ~/.conkyscripts/rhythmbox_bar}
$endif
# Horrible morceau de code pour l’affichage horizontal — donne un conky en anglais — colones définies par des ${goto n}, en suivant le schéma ci-dessus.
${time %A %d %B %Y}${goto 135}| System${goto 322}| Resources${goto 438}| Disks${goto 602}| Network
${time %H:%M}${goto 135}| ${execi 86400 lsb_release -si}${execi 86400 lsb_release -sr} – ${nodename}${goto 322}| Proc: ${cpu cpu0} %${goto 438}| Root: ${fs_free /}/${fs_size /}${goto 602}| Eth: ${addr eth0} – Down:${downspeed eth0} – Up:${upspeed eth0}
${goto 135}| $sysname $kernel${goto 322}| ${cpugraph 10,100}${goto 438}| ${fs_bar 5,150 /}${goto 602}| ${downspeedgraph eth0 10,120} ${upspeedgraph eth0 10,120}
${goto 135}| Uptime: $uptime_short – Tasks: $running_processes/$processes${goto 322}| RAM: $memperc %${goto 438}| Data: ${fs_free /media/data}/${fs_size /media/data}${goto 602}| Wifi: ${addr eth1} – Down:${downspeed eth1} – Up:${upspeed eth1}
${goto 135}| Load:$loadavg${goto 322}| ${memgraph 10,100}${goto 438}| ${fs_bar 5,150 /media/data}${goto 602}| ${downspeedgraph eth1 10,120} ${upspeedgraph eth1 10,120}

Le script nécessaire à la barre de progression de Rhythmbox est celui écrit par ph3nix_ et proposé sur la page conky_scripts_multimedia de la doc.

Hors ligne

#1089 Le 14/10/2011, à 13:57

breakolami

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

Un truc curieux :

J'utilise la variable

${execi 1800 aptitude search "~U" | wc -l | tail}

Qui me dit combien j'ai de mises à jour or aujourd'hui ça m'affiche 1734 mises à jour

00054.jpg

Mais sur la fenêtre de mise à niveau ça me dit que ça télécharge 2000 paquets

00055.jpg

D’où peut bien venir cette différence ?


Kubuntu 23.10 sur MSI Katana 17, Intel i7 12ème génération, 1 Nvme M.2 P5 500Go, 1 Nvme M.2 P2 500Go, 16Go de mémoire, Nvidia GeForce RTX 4060
https://www.youtube.com/@ChristopheBrand

Hors ligne

#1090 Le 14/10/2011, à 14:40

kurapika29

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

Breakolami
Dans une mise à niveau il t'installe aussi des logiciels par defaut que tu n'as pas forcément et en supprime si besoin, et il y a une différence entre safe-upgrade et dist-upgrade wink
« U » mise à jour des paquets (aptitude safe-upgrade) trouvé par là sur le forum debian
Par contre je ne connais pas la syntaxe pour le dist-upgrade tongue

Dernière modification par kurapika29 (Le 14/10/2011, à 14:59)


Disponible sur IRC, sur le serveur irc.freenode.net salon ##ubuntu-voyager (et aussi sur plein d'autre serveur/salon)
Venez si vous avec besoin d'aide ou pour causer ;) suffit d'avoir Xchat ou un autre client IRC
Où sinon en cliquant sur se lien http://kiwiirc.com/client/irc.freenode. … tu-voyager

Hors ligne

#1091 Le 14/10/2011, à 15:35

breakolami

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

Ha ok je comprends mieux, merci
C'est vrai que j'avais pas pensé aux logiciels par défaut et comme j'en ai supprimé certains forcement ils n'entrent pas en compte dans les mises à jour puisqu'ils ne sont plus là


Kubuntu 23.10 sur MSI Katana 17, Intel i7 12ème génération, 1 Nvme M.2 P5 500Go, 1 Nvme M.2 P2 500Go, 16Go de mémoire, Nvidia GeForce RTX 4060
https://www.youtube.com/@ChristopheBrand

Hors ligne

#1092 Le 14/10/2011, à 20:57

neecride

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

un autre dédié a darthwound car j'ai chipé l'idée sur son image

1296004682.png

ça donne ça

1318621588.png

Pour l'instant je ne fait que des conky simpliste petite a petit je trouve un truc a faire ça viendra ou pas les gros trucs lua peut être je ne sais pas, en attendant ça m'éclate.

conky

#
#
#darthconky

# Default Fonts
use_xft yes
xftfont Ubuntu:size=9
override_utf8_locale yes

# Performance Settings
double_buffer yes

# Cache Setting
imlib_cache_size 0

# Window Settings
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

# Window border
draw_borders no
draw_shades no
draw_graph_borders no

# Default Color
default_color D3D7CF

# Color Graph
color0 D34E18 #aero 96C7FF,ambiance D34E18,dust CD7B2B,elegant 5D7E80,elementary 597CA2,sonar 3C9500

# Size and position
minimum_size 900 120
gap_x 230
gap_y 647
alignment top_center

#lua_load /home/neecride/darth.lua
#lua_draw_hook_post main

TEXT
${image /home/neecride/icons/darth.png -p 0,10 900x55}${image /home/neecride/icons/system.png -p 100,17 40x40}${image /home/neecride/icons/media.png -p 300,17 40x40}${image /home/neecride/icons/memory-ram.png -p 510,17 40x40}
${voffset}${goto 150}Cpu ${cpu cpu0}% ${goto 195}${cpugraph 8,78 FFFFFF D34E18} ${goto 350}HDD${goto 387}: ${fs_used /} | ${fs_size /}${goto 560}RAM  |  ${memperc 7,138}  |  ${memmax 7,138}${goto 730}${time %A}
${goto 150}${cpubar cpu1 7,128}${goto 350}${fs_bar 7,93}| ${fs_size /home}${goto 560}${membar 7,128}${goto 720}${time %d}-${time %h}-${time %Y}

${image /home/neecride/icons/sep.png -p 285,17}
${image /home/neecride/icons/sep.png -p 499,17}
${image /home/neecride/icons/sep.png -p 703,17}

Hors ligne

#1093 Le 17/10/2011, à 05:40

fanou18000

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

@neecride  Conky simpliste mais très sympa  big_smile


"C'est en faisant des erreurs qu'on avance..."
                             Donc ici pour apprendre.
            Ubuntu 10.04 Lucid Lynx et GNOME 2.30.2       (Depuis le 14/12/09)

Hors ligne

#1094 Le 17/10/2011, à 16:51

Phyllinux

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

Problème de conky suite à passage à Oneiric.
J'ai fait la mise à jour sur mon desktop, et là, surprise, aucun de mes conkys ne se lance.
Je n'ai aucun message d'erreur en console, mais rien ne se passe.
Les scripts liés aux conkys se lancent. Exemple : Pour mon conky météo qui affiche une carte sat, la carte est bien téléchargée et retaillée, mais cela ne va pas plus loin.
voici ce que j'ai dans le terminal :

gilles@ubuntu:~$ conky -c /home/gilles/scripts/Météo/conkyrc
Conky: forked to background, pid is 2945
gilles@ubuntu:~$ 
Conky: desktop window (2400004) is subwindow of root window (b8)
Conky: window type - override
Conky: drawing to created window (0x4600001)
Conky: drawing to double buffer

Le curseur clignote en bas de console, mais rien de plus...
Quelqu'un a t'il une idée ?

Merci


The ship is sinking normally...

Hors ligne

#1095 Le 17/10/2011, à 16:58

Didier-T

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

Bonjour Phyllinux,
tu serais pas en session gnome par hasard ?

Hors ligne

#1096 Le 17/10/2011, à 17:07

Phyllinux

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

Bonjour Didier-T,

Si, j'arrive pas à me faire à Unity roll
Alors j'ai installé les paquets Gnome, pour me retrouver avec mon environnement 'normal'


The ship is sinking normally...

Hors ligne

#1097 Le 17/10/2011, à 17:17

Didier-T

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

Je m'en doutais, j'ai fais la même chose au début, mais gnome 3 semble afficher 2 fois l'image de fond d’écran du coup tes conky sont bien la mais sur le fond en dessous (pas très clair tous sa cool ), pour les voir apparaître il faut mètre le own_window_type sur normal, en gros il te faut faire un truc comme ça :

own_window_type normal 
own_window_transparent yes
own_window_hints undecorated,below,skip_taskbar,skip_pager

mais tu auras le meme soucis que S2S avec son décalage de pixel, en fait je croit que la fenêtre conky nous fait apparaître le premier fond d’écran, perso j’essaie de me faire a Unity, mais c'est une horreur sad

Hors ligne

#1098 Le 17/10/2011, à 17:29

Phyllinux

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

Je vais essayer cela.
Pour voir, je viens de basculer sous Unity, et là, c'est la cata complète :
Effectivement, les conkys se lancent, mais il faut tous les reprendre.
Outre le fait qu'ils étaient alignés à gauche, donc partiellement sous le dash, il y a plein de bugs qui apparaissent par rapport à la version clean sous Natty :
Décalage des lignes du conky,
Caractères supplémentaires,
Bref, un truc horrible et illisible !
Je reste donc sous Natty pour mon netbook


The ship is sinking normally...

Hors ligne

#1099 Le 17/10/2011, à 17:34

Didier-T

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

oui j'ai le soucis avec mon conkyforcast, de toute évidence un problème lié aux polices de caractères, pfff roll

Hors ligne

#1100 Le 17/10/2011, à 20:53

neecride

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

fanou18000 a écrit :

@neecride  Conky simpliste mais très sympa  big_smile

Merci en faite je débute, en voici un peut moins simpliste

si vous voulez le conkyrc get signature

1318880107.png

Dernière modification par neecride (Le 18/10/2011, à 22:18)

Hors ligne