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.

#1726 Le 12/08/2012, à 10:09

Angelius.CXI

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

Je ne suis pas sur de saisir, mais les images que j'ai utilisées son dans l'archive que j'ai fourni avec mon premier post : http://dl.free.fr/j13nmdbUf. elles ne sont pas incluses dans conky à la base

Hors ligne

#1727 Le 12/08/2012, à 13:31

breakolami

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

Salut à tous,

Je suis sous KDE4 et je n'arrive plus à faire démarrer mon conky en même temps que le système
C'est un conky que j'ai créé avec conkycolors
J'ai créé un script conky_start.sh que j'ai placé à la racine de mon /home
Dans ce script il y a ça

#!/bin/bash
killall conky
sleep 2
feh --bg-scale `grep 'wallpaper=' ~/.kde/share/config/plasma-desktop-appletsrc | tail --bytes=+11`
sleep 20
conky -d -c $HOME'/.conkycolors/conkyrc';
sleep 5
exit

Si je clique sur le script manuellement le conky se lance bien

J'ai placé ce script dans le démarrage de KDE et que ce soit en tant que lien symbolique ou en lien direct ça ne se lance pas auriez-vous une idée ? merci

conky_001.jpg


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

#1728 Le 12/08/2012, à 14:45

ti_tux

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

Salut breakolami,

Il me semble avoir déjà eu un souci similaire avec certains scripts, et en plaçant mes scripts dans $HOME/.kde/Autostart/ ça fonctionnait bien alors qu'à la base je les avais mis dans mon dossier de scripts. Donc dans le systemsettings tu l'enlèves du démarrage et tu déplaces ton script dans le dossier Autostart, il va s'ajouter automatiquement dans le systemsettings dans les scripts à démarrer au boot de KDE. Et si ça ne fonctionne toujours pas bah je ne vois pas pourquoi désolé.

Dernière modification par ti_tux (Le 12/08/2012, à 14:46)


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

Hors ligne

#1729 Le 12/08/2012, à 16:47

Didier-T

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

Bonjour a tous,

un petit cadeau pour ceux qui seraient intéresses par le système de barre de Angelius.CXI
Je me suis permis une petite modification, pour créer un script universel.

media.sh

#!/bin/bash
# Barres disque dur pour conky
# A partir des scripts de Angelius.CXI du forum Ubuntu.fr
# Modifié par Didier-T Forum Ubuntu.fr

## Utilisation
## bash media.sh [Type disque] [position de la première barre]
## Type disque = fixe ,amovible où tous


id=$2 # définition de la position de la première barre

function fixe() {
grep ^\/dev/ /etc/mtab | sed '/flush/d' | cut -d" " -f2 | while read line; do
lines=${line//040/" "} # Remplace toute les occurrences 040 qui sont des espaces afin d'afficher correctement le répertoire du média
    df -h "$lines" | cut -d% -f1 | sed '1d;' | while read a b c d percent ; # récupération de la ligne du média avec toutes ses données
    do
    c=$(( $percent*3 ))
	echo '     '${lines##/*/}' : ${fs_used '$lines'} / ${fs_size '$lines'} - ${fs_free_perc '$lines'}% free'
	echo '${image ~/.conky/img/grayline.png -p 25,'$id' -s 300x12 }${if_match ${fs_used_perc '$lines'} >= 70}${image ~/.conky/img/redline.png -p 25,'$id' -s '$c'x12 } $endif ${if_match ${fs_used_perc '$lines'} < 70}${image ~/.conky/img/greenline.png -p 25,'$id' -s '$c'x12 } $endif'
	echo ' '
    done
id=$(($id+39)) # incrémentation de la position
done
}

function amovible() {
grep ^\/dev/ /etc/mtab | grep "flush" | cut -d" " -f2 | while read line; do
lines=${line//040/" "} 
    df -h "$lines" | cut -d% -f1 | sed '1d;' | while read a b c d percent ; 
    do
    c=$(( $percent*3 ))
	echo '     '${lines##/*/}' : ${fs_used '$lines'} / ${fs_size '$lines'} - ${fs_free_perc '$lines'}% free'
	echo '${image ~/.conky/img/grayline.png -p 25,'$id' -s 300x12 }${if_match ${fs_used_perc '$lines'} >= 70}${image ~/.conky/img/redline.png -p 25,'$id' -s '$c'x12 } $endif ${if_match ${fs_used_perc '$lines'} < 70}${image ~/.conky/img/greenline.png -p 25,'$id' -s '$c'x12 } $endif'
	echo ' '
    done
id=$(($id+39)) 
done
}

function tous() {
fixe
amovible
}

$1

pour exemple dans le conky de Angelius.CXI il faudrait faire ceci.

conkyrc

# set to yes if you want Conky to be forked in the background
background yes
cpu_avg_samples 2
net_avg_samples 2
out_to_console no
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont Microsoft YaHei Normal:size=10
# Text alpha when using Xft
xftalpha 0.8
on_bottom yes
# mail spool
mail_spool $MAIL
# Update interval in seconds
update_interval 1
# Create own window instead of using desktop (required in nautilus)
own_window  yes
own_window_transparent yes
own_window_type override
own_window_hints undecorate,sticky,skip_taskbar,skip_pager
own_window_argb_visual no
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 350 900
#maximum_width 1080
# Draw shades?
draw_shades yes
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 0
border_margin 4
border_width 1
default_color white
default_shade_color black
default_outline_color white
draw_graph_borders yes
gap_x 15
gap_y 38
alignment top_right
#alignment bottom_left
#alignment bottom_right
border_inner_margin 0
border_outer_margin 0
# Gap between borders of screen and text
# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer no
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
text_buffer_size 1280
lua_load ~/.conky/lua/ring.lua
lua_draw_hook_pre ring_stats

TEXT

${image ~/.conky/img/background.png}
${offset 15}${font Daniel:size=16}${color}${time %A %d %B %Y}
${voffset -30}${font Ginga>:size=90}${alignr 15}${time %H:%M}${font}

    
${offset 55}${font CloisterBlack:size=20}OS :${font}
${font}
${offset 15}${texeci 3600 lsb_release -si} : ${texeci 3600 lsb_release -sr} ${texeci 3600 lsb_release -sc}
${offset 15}${texeci 3600 head /proc/cpuinfo -q -n5 | grep 'model name' | cut -c14- }
${offset 15}$nodename - $sysname $kernel on $machine
${offset 15}Uptime : $uptime_short


${offset 55}${font CloisterBlack:size=20}System :${font}


${offset 45}${font verdana:size=8}CPU1 : ${hwmon 0 temp 1}°C / ${freq_g cpu1}GHz
${offset 45}${cpu cpu1}%${font}
${voffset -25}${offset 184}${font verdana:size=8}CPU2 : ${hwmon 0 temp 1}°C / ${freq_g cpu2}GHz
${offset 185}${cpu cpu2}%
${voffset 27}${offset 100}Tampon : ${hwmon 0 temp 4}°C
${offset 100}SWAP $swapperc%
${voffset -3}${offset 100}RAM $memperc%

${offset 55}${font CloisterBlack:size=20}Stockage :${font}

${execpi 10 ~/.conky/sh/media.sh fixe 436}

 




${offset 55}${font CloisterBlack:size=20}Network :${font}

${offset 15}IP locale : ${addr wlan0}
${offset 15}Total Down ${alignr 150}${totaldown wlan0}
${offset 15}Total Up ${alignr 150}${totalup wlan0}
${font verdana:size=8}${offset 102}${voffset 6}Downloads :
${offset 102}${downspeedf wlan0}Kb/s
${voffset -22}${offset 252}Uploads :
${offset 252}${upspeedf wlan0}Kb/s


${offset 55}${font CloisterBlack:size=20}Media Amovible :${font}

${execpi 10 ~/.conky/sh/media.sh amovible 728}

${image ~/.conky/img/os.png -s 40x40 -p 10,127}
${image ~/.conky/img/system.png -s 40x40 -p 10,240}
${image ~/.conky/img/hdd.png -s 40x40 -p 10,381}
${image ~/.conky/img/network.png -s 40x40 -p 10,547}
${image ~/.conky/img/amovible.png -s 40x40 -p 10,672}

il y a aussi l'option "tous"

${execpi 10 ~/.conky/sh/media.sh tous 436}

liste tous les médias monté sur le poste.

Amusez vous bien.

Hors ligne

#1730 Le 13/08/2012, à 09:51

breakolami

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

ti_tux a écrit :

Salut breakolami,
tu déplaces ton script dans le dossier Autostart, il va s'ajouter automatiquement dans le systemsettings dans les scripts à démarrer au boot de KDE. Et si ça ne fonctionne toujours pas bah je ne vois pas pourquoi désolé.

Bon y a pas moyen, j'ai essayé de placer mon script dans tous les dossiers autostart que j'ai trouvé mais ça ne démarre pas

Merci quand même wink


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

#1731 Le 15/08/2012, à 12:31

Morita

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

Bonjour ! smile

Je vous propose mon petit conky basé sur plusieurs scripts trouvé ici et la.

capturedcran-15082012-124134.php

conkyrc

background yes
use_xft yes
xftfont Sans Mono:size=9
xftalpha 0.8
update_interval 1.0
double_buffer yes
minimum_size 250 0
maximum_width 250
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
own_window        yes
own_window_transparent    yes
own_window_argb_value 100
own_window_argb_visual yes
own_window_type        desktop
own_window_hints    undecorated,below,sticky,skip_taskbar,skip_pager
alignment top_right
gap_x 30
gap_y 30
no_buffers yes
uppercase no
cpu_avg_samples 2
net_avg_samples 2
use_spacer right

color1 white
# light blue
color2 6892C6
# bleu
color3 5C9CD9
# Bleu foncé
color4 2C4B68 
# blanc
color5 C8C8C8
# bleu turcoise
color6 446057
# vert clair
color7 d3e796
# orange
color8 ff6600
# Vert
color9 339900

text_buffer_size 2048
override_utf8_locale yes

# Lua Load  #
lua_load ~/.conky/seb.lua
lua_draw_hook_pre clock_rings

TEXT
${voffset 65}${goto 50}${color5}Down:
${goto 50}${color9}${downspeed eth0} 
${voffset -4}${goto 120}${color5}Up:
${goto 120}${color8} ${upspeed eth0}

${voffset 60}
${color5}Hier: ${goto 80}${color9}${execi 300 vnstat | grep "yesterday" | awk '{print $2 $3}'}${goto 175}${color8}${execi 300 vnstat | grep "yesterday" | awk '{print $5 $6}'}
${color5}Ce jour: ${goto 80}${color9}${execi 300 vnstat | grep "today" | awk '{print $2 $3}'}${goto 175}${color8}${execi 300 vnstat | grep "today" | awk '{print $5 $6}'}
${color5}Semaine: ${goto 80}${color9}${execi 300 vnstat -w | grep "current week" | awk '{print $3 $4}'}${goto 175}${color8}${execi 300 vnstat -w | grep "current week" | awk '{print $6 $7}'}


${color5}C1:${color8}${cpu cpu1}%
${goto 53}${voffset -25}${color 333333}${cpugraph cpu1 25,145 665D36 665D36} 
${color5}C2:${color8}${cpu cpu2}%
${goto 53}${voffset -25}${color 333333}${cpugraph cpu2 25,145 665D36 665D36}

${voffset -100}
${goto 205}${color8}${top name 1} 
${goto 205}${color4}${top name 2} 
${goto 205}${color6}${top name 3} 
${goto 205}${color6}${top name 4} 

${voffset 25}
${goto 30}${color5} RAM:
${goto 30}${color8} ${top_mem name 1}
${goto 30}${color4} ${top_mem name 2}
${goto 30}${color6} ${top_mem name 3}

${voffset -62}${goto 183}${color5}Swap

${voffset 99}${goto 20}${color5}Home${goto 108}Media1${goto 198}Media2

${if_running amarok}
${font caviar dreams:size=10}
${color1}Artiste : ${color9}${execi 10 ~/.conky/amarok artist}
${color1}Titre :    ${color9}${execi 10 ~/.conky/amarok title}
${color1}Album : ${color9}${execi 10 ~/.conky/amarok album}
${color1}Année : ${color9}${execi 10 ~/.conky/amarok year}
${color8}${execibar 1 ~/.conky/amarok progress}
${font}
$endif

script lua

settings_table = {
        {
        name='downspeedf',
        arg='eth0',
        max=1020,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x339900,
        fg_alpha=0.8,
        x=110, y=105,
        radius=80,
        thickness=15,
        start_angle=-180,
        end_angle=180
    },
        {
        name='upspeedf',
        arg='eth0',
        max=110,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xff6600,
        fg_alpha=0.8,
        x=170, y=100,
        radius=60,
        thickness=5,
        start_angle=-180,
        end_angle=180
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xFF6600,
        fg_alpha=0.8,
        x=65, y=425,
        radius=60,
        thickness=10,
        start_angle=-90,
        end_angle=180
    },
    {
        name='swapperc',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xFE0000,
        fg_alpha=0.8,
        x=200, y=418,
        radius=30,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='fs_used_perc',
        arg='/home',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x5C9CD9,
        fg_alpha=0.8,
        x=40, y=545,
        radius=35,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='fs_used_perc',
        arg='/media1',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xFBDA01,
        fg_alpha=0.8,
        x=130, y=545,
        radius=35,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='fs_used_perc',
        arg='/media2',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x339900,
        fg_alpha=0.8,
        x=220, y=545,
        radius=35,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
}

require 'cairo'

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

function draw_ring(cr,t,pt)
    local w,h=conky_window.width,conky_window.height
    
    local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

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

    -- Draw background ring

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

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

function conky_clock_rings()
    local function setup_rings(cr,pt)
        local str=''
        local value=0
        
        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)
        
        value=tonumber(str)
        pct=value/pt['max']
        
        draw_ring(cr,pct,pt)
    end
    
    -- Check that Conky has been running for at least 5s

    if conky_window==nil then return end
    local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
    
    local cr=cairo_create(cs)    
    
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    
    if update_num>5 then
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
    
end

script amarok

#!/bin/sh

export DISPLAY=:0

NOWPLAYING=`qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.GetMetadata`

if [ $? = 0 ] && [ -n "$NOWPLAYING" ]; then
	case "$1" in
		album ) echo "$NOWPLAYING" | sed -ne 's/^album: \(.*\)$/\1/p' ;;
		artist ) echo "$NOWPLAYING" | sed -ne 's/^artist: \(.*\)$/\1/p' ;;
		genre ) echo "$NOWPLAYING" | sed -ne 's/^genre: \(.*\)$/\1/p' ;;
		rating ) echo "$NOWPLAYING" | sed -ne 's/^rating: \(.*\)$/\1/p' ;;
		title ) echo "$NOWPLAYING" | sed -ne 's/^title: \(.*\)$/\1/p' ;;
		track ) echo "$NOWPLAYING" | sed -ne 's/^tracknumber: \(.*\)$/\1/p' ;;
		year ) echo "$NOWPLAYING" | sed -ne 's/^year: \(.*\)$/\1/p' ;;
		progress)
		    curr=`qdbus org.kde.amarok /Player org.freedesktop.MediaPlayer.PositionGet`
		    tot=`echo "$NOWPLAYING" | sed -ne 's/^mtime: \(.*\)$/\1/p'`
		    echo `expr $curr \* 100  / $tot`
		;;
	esac
fi

J'espère que j'ai tout bon et que j'ai pas fait trop d'erreur (rien vu dans .xsession-errors en tout cas). Par contre, je voudrais savoir comment faire pour le script amarok reste affiché en permanence car dès que que je ferme amarok, le script disparaît a l’écran (ce qui est tout a fait normal).

Dernière modification par Morita (Le 15/08/2012, à 12:42)


Novatux Fregate Black - Xubuntu 12.04

Hors ligne

#1732 Le 16/08/2012, à 06:02

Didier-T

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

Bonjour Morita,

Pour que ton script amarok reste affiché en permanence, il faut supprimer les lignes suivantes dans ton conky :

  1. ${if_running amarok}

  2. $endif

$endif est a la dernière ligne

Par contre, tu devrais surveiller la consommation mémoire de ton conky, il me semble qu'il manque une commande dans le script lua.

Hors ligne

#1733 Le 19/08/2012, à 12:39

ferreol

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

je vous poste mon mien qui change plus trop mais bon. Je voulais en fait rajoutter un cercle avec les infos Net up and down et ip mais je n ai plus le temps.

screenshot
screenshot
desktopqm.jpg

Uploaded with ImageShack.us

ci dessous le .conkyrc

# -- Conky settings -- #
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0

# -- Window specifications -- #

own_window no
#own_window_type below
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 580 850
maximum_width 600

alignment tl
gap_x 1
gap_y 40

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

# -- Text settings -- #
use_xft yes
xftfont sans:size=12
xftalpha 0.8

uppercase no

default_color ffffff

# -- Lua Load -- #
lua_load ~/.conky/conky_widgets.lua
lua_draw_hook_pre widgets

TEXT
${goto 200}${font Coalition:size=16}${time %A}
${goto 220}${font Coalition:size=8}${time %d %B %Y}
${goto 230}${voffset 5}${font coalition:size=20}${time %H:%M:%S}
${goto 220}${font Coalition:size=8}${pre_exec lsb_release -d | cut -f 2| tr "[:upper:]" "[:lower:]"}
${goto 220}$sysname $machine $kernel
${goto 220}${voffset 5}${fs_bar 1,250 /}
${goto 220}${font Coalition:size=11}uptime $uptime
${goto 220}${execi 28800 ~/.conky/maj.sh}
${goto 220}${fs_bar 1,250 /}
${goto 170}${voffset 69}${font Coalition:size=13} CPU ${cpu 0}%
${goto 180}${font Coalition:size=7}hz  ${freq_g cpu0}Ghz
${goto 170}${font Coalition:size=7}${top cpu 1}%  ${top name 1}
${goto 200}${voffset 50}${font Coalition:size=13}MEM ${memperc}%
${goto 200}${font Coalition:size=7}${top_mem mem 1}%  ${top_mem name 1}
${goto 210}$memfree / 1Go free
${goto 170}${voffset 55}${font Coalition:size=13}FS ${fs_used_perc}%
${goto 170}${font Coalition:size=7}/free ${fs_free /}
${goto 170}Data : ${fs_free /media/data}
${voffset 70}
${goto 50}${font Coalition:size=12}IPL: ${addr eth0} IPP: ${execi 6800 wget -q -O - http://ip.tupeux.com | tail}
${goto 50}${font Arrows#1:size=16}Q ${font Coalition:size=10}${totaldown eth0}$alignc ${downspeed eth0}/s
${goto 50}${font ARROWS#1:size=16}P ${font Coalition:size=10}${totalup eth0}  $alignc${upspeed eth0}/s 
${voffset 20}${goto 50}${fs_bar 1,250 /}
${font Coalition:size=10}${goto 50}wifi signal: ${wireless_link_qual wlan0}%
${goto 50}Mac ${wireless_ap wlan0}

clock_rings.lua

--[[
Clock Rings by londonali1010 (2009) Edited by jpope

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

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement 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/clock_rings.lua
    lua_draw_hook_pre clock_rings

Changelog:
+ v1.0 -- Original release (30.09.2009)
   v1.1p -- Jpope edit (05.10.2009)
]]

settings_table = {
    {
        -- Edit this table to customise your rings.
        -- You can create more rings simply by adding more elements to settings_table.
        -- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
        name='time',
        -- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
        arg='%I.%M',
        -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
        max=12,
        -- "bg_colour" is the colour of the base ring.
        bg_colour=0xffffff,
        -- "bg_alpha" is the alpha value of the base ring.
        bg_alpha=0.8,
        -- "fg_colour" is the colour of the indicator part of the ring.
        fg_colour=0xBFBFBF,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
        fg_alpha=0.2,
        -- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
        x=100, y=150,
        -- "radius" is the radius of the ring.
        radius=50,
        -- "thickness" is the thickness of the ring, centred around the radius.
        thickness=5,
        -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
        start_angle=0,
        -- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
        end_angle=360
    },
    {
        name='time',
        arg='%M.%S',
        max=60,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xE5E5E5,
        fg_alpha=0.6,
        x=100, y=150,
        radius=56,
        thickness=5,
        start_angle=0,
        end_angle=360
    },
    {
        name='time',
        arg='%S',
        max=-1,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0xffffff,
        fg_alpha=0.8,
        x=100, y=150,
        radius=62,
        thickness=5,
        start_angle=0,
        end_angle=360
    },
}

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

clock_r=65

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

clock_x=100
clock_y=150

show_seconds=true

require 'cairo'

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

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

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

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

    -- Draw background ring

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

    -- Draw indicator ring

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

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

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

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

    -- Draw hour hand

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

    cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
    cairo_set_line_width(cr,5)
    cairo_set_source_rgba(cr,0.3,0.7,1,0.6)
    cairo_stroke(cr)

    -- Draw minute hand

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

    cairo_set_line_width(cr,3)
    cairo_stroke(cr)

    -- Draw seconds hand

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

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

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

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

        value=tonumber(str)
        if pt['max'] == -1 then
            pct=1
        else
            pct=value/pt['max']
        end

        draw_ring(cr,pct,pt)
    end

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

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

    local cr=cairo_create(cs)

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

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

    draw_clock_hands(cr,clock_x,clock_y)
end

conky_widgets.lua

--[[
Conky Widgets by londonali1010 (2009)

This script is meant to be a "shell" to hold a suite of widgets for use in Conky.

To configure:
+ Copy the widget's code block (will be framed by --(( WIDGET NAME )) and --(( END WIDGET NAME )), with "[" instead of "(") somewhere between "require 'cairo'" and "function conky_widgets()", ensuring not to paste into another widget's code block
+ To call the widget, add the following just before the last "end" of the entire script:
	cr = cairo_create(cs)
	NAME_OF_FUNCTION(cr, OPTIONS)
	cairo_destroy(cr)
+ Replace OPTIONS with the options for your widget (should be specified in the widget's code block) 

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/conky_widgets.lua):
	lua_load ~/scripts/conky_widgets.lua
	lua_draw_hook_pre widgets
	
Changelog:
+ v1.0 -- Original release (17.10.2009)
]]

require 'cairo'

--[[ AIR CLOCK WIDGET ]]
--[[ Options (xc, yc, size):
	"xc" and "yc" are the x and y coordinates of the centre of the clock, in pixels, relative to the top left of the Conky window
	"size" is the total size of the widget, in pixels ]]

function air_clock(cr, xc, yc, size)
	local offset = 0
	
	shadow_width = size * 0.03
	shadow_xoffset = 0
	shadow_yoffset = size * 0.01
	
	if shadow_xoffset >= shadow_yoffset then
		offset = shadow_xoffset
	else offset = shadow_yoffset
	end
	
	local clock_r = (size - 2 * offset) / (2 * 1.25)
		
	show_seconds=true
	
	-- Grab time
	
	local hours=os.date("%I")
	local mins=os.date("%M")
	local secs=os.date("%S")
	
	secs_arc=(2*math.pi/60)*secs
	mins_arc=(2*math.pi/60)*mins
	hours_arc=(2*math.pi/12)*hours+mins_arc/12
	
	-- Drop shadow
	
	local ds_pat=cairo_pattern_create_radial(xc+shadow_xoffset,yc+shadow_yoffset,clock_r*1.25,xc+shadow_xoffset,yc+shadow_yoffset,clock_r*1.25+shadow_width)
	cairo_pattern_add_color_stop_rgba(ds_pat,0,0,0,0,0.2)
	cairo_pattern_add_color_stop_rgba(ds_pat,1,0,0,0,0)
	
	cairo_move_to(cr,0,0)
	cairo_line_to(cr,conky_window.width,0)
	cairo_line_to(cr,conky_window.width, conky_window.height)
	cairo_line_to(cr,0,conky_window.height)
	cairo_close_path(cr)
	cairo_new_sub_path(cr)
	cairo_arc(cr,xc,yc,clock_r*1.25,0,2*math.pi)
	cairo_set_source(cr,ds_pat)
	cairo_set_fill_rule(cr,CAIRO_FILL_RULE_EVEN_ODD)
	cairo_fill(cr)
	
	-- Glassy border
	
	cairo_arc(cr,xc,yc,clock_r*1.25,0,2*math.pi)
	cairo_set_source_rgba(cr,0.5,0.5,0.5,0.2)
	cairo_set_line_width(cr,1)
	cairo_stroke(cr)
	
	local border_pat=cairo_pattern_create_linear(xc,yc-clock_r*1.25,xc,yc+clock_r*1.25)
	
	cairo_pattern_add_color_stop_rgba(border_pat,0,1,1,1,0.7)
	cairo_pattern_add_color_stop_rgba(border_pat,0.3,1,1,1,0)
	cairo_pattern_add_color_stop_rgba(border_pat,0.5,1,1,1,0)
	cairo_pattern_add_color_stop_rgba(border_pat,0.7,1,1,1,0)
	cairo_pattern_add_color_stop_rgba(border_pat,1,1,1,1,0.7)
	cairo_set_source(cr,border_pat)
	cairo_arc(cr,xc,yc,clock_r*1.125,0,2*math.pi)
	cairo_close_path(cr)
	cairo_set_line_width(cr,clock_r*0.25)
	cairo_stroke(cr)
	
	-- Set clock face
	
	cairo_arc(cr,xc,yc,clock_r,0,2*math.pi)
	cairo_close_path(cr)
	
	local face_pat=cairo_pattern_create_radial(xc,yc-clock_r*0.75,0,xc,yc,clock_r)
	
	cairo_pattern_add_color_stop_rgba(face_pat,0,1,1,1,0.9)
	cairo_pattern_add_color_stop_rgba(face_pat,0.5,1,1,1,0.9)
	cairo_pattern_add_color_stop_rgba(face_pat,1,0.9,0.9,0.9,0.9)
	cairo_set_source(cr,face_pat)
	cairo_fill_preserve(cr)
	cairo_set_source_rgba(cr,0.5,0.5,0.5,0.2)
	cairo_set_line_width(cr, 1)
	cairo_stroke (cr)
	
	-- Draw hour hand
	
	xh=xc+0.7*clock_r*math.sin(hours_arc)
	yh=yc-0.7*clock_r*math.cos(hours_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xh,yh)
	
	cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
	cairo_set_line_width(cr,5)
	cairo_set_source_rgba(cr,0,0,0,0.5)
	cairo_stroke(cr)
	
	-- Draw minute hand
	
	xm=xc+0.9*clock_r*math.sin(mins_arc)
	ym=yc-0.9*clock_r*math.cos(mins_arc)
	cairo_move_to(cr,xc,yc)
	cairo_line_to(cr,xm,ym)
	
	cairo_set_line_width(cr,3)
	cairo_stroke(cr)
	
	-- Draw seconds hand
	
	if show_seconds then
		xs=xc+0.9*clock_r*math.sin(secs_arc)
		ys=yc-0.9*clock_r*math.cos(secs_arc)
		cairo_move_to(cr,xc,yc)
		cairo_line_to(cr,xs,ys)
	
		cairo_set_line_width(cr,1)
		cairo_stroke(cr)
	end
end

--[[ END AIR CLOCK WIDGET ]]

--[[ RING WIDGET ]]
--[[ Options (name, arg, max, bg_colour, bg_alpha, xc, yc, radius, thickness, start_angle, end_angle):
	"name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
	"arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
	"max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
	"bg_colour" is the colour of the base ring.
	"bg_alpha" is the alpha value of the base ring.
	"fg_colour" is the colour of the indicator part of the ring.
	"fg_alpha" is the alpha value of the indicator part of the ring.
	"x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
	"radius" is the radius of the ring.
	"thickness" is the thickness of the ring, centred around the radius.
	"start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
	"end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle. ]]

function ring(cr, name, arg, max, bgc, bga, fgc, fga, xc, yc, r, t, sa, ea)
	local function rgb_to_r_g_b(colour,alpha)
		return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
	end
	
	local function draw_ring(pct)
		local angle_0=sa*(2*math.pi/360)-math.pi/2
		local angle_f=ea*(2*math.pi/360)-math.pi/2
		local pct_arc=pct*(angle_f-angle_0)

		-- Draw background ring

		cairo_arc(cr,xc,yc,r,angle_0,angle_f)
		cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
		cairo_set_line_width(cr,t)
		cairo_stroke(cr)
	
		-- Draw indicator ring

		cairo_arc(cr,xc,yc,r,angle_0,angle_0+pct_arc)
		cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
		cairo_stroke(cr)
	end
	
	local function setup_ring()
		local str = ''
		local value = 0
		
		str = string.format('${%s %s}', name, arg)
		str = conky_parse(str)
		
		value = tonumber(str)
		if value == nil then value = 0 end
		pct = value/max
		
		draw_ring(pct)
	end	
	
	local updates=conky_parse('${updates}')
	update_num=tonumber(updates)
	
	if update_num>5 then setup_ring() end
end

--[[ END RING WIDGET ]]

function conky_widgets()
	if conky_window == nil then return end
	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
	
	cr = cairo_create(cs)
	air_clock(cr, 120, 120, 200) -- options: xc, yc, size
	cairo_destroy(cr)
	
	cr = cairo_create(cs)
	ring(cr, 'cpu', 'CPU0', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.8, 220, 300, 50, 10, 0, 180) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
	cairo_destroy(cr)
	
	cr = cairo_create(cs)
	ring(cr, 'memperc', '', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.8, 220, 400, 50, 10, 180, 360) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
	cairo_destroy(cr)	
	
	cr = cairo_create(cs)
	ring(cr, 'fs_used_perc', '/', 100, 0xFFFFFF, 0.2, 0xFFFFFF, 0.8, 220, 500, 50, 10, 0, 180) -- options: name, arg, max, bg_colour, bg_alpha, fg_colour, fg_alpha, xc, yc, radius, thickness, start_angle, end_angle
	cairo_destroy(cr)
end

le script des Majs

#!/bin/bash
# Conky script for displaying available updates
# in Debian. This script assumes you are in the
# sudo group and require no password for root
# access. Add something as such to your conkyrc:
#${color}APT: ${color D7D3C5}${execi 28800 ~/bin/debupdates.sh}

sudo apt-get -qy update > /dev/null
NUMOFUPDATES=$(aptitude search "~U" | wc -l)
echo $NUMOFUPDATES Updates Available

le tout à mettre dans un dossier /home/xxxxxxxxxxxx/.conky (xxxxxxxxxx est votre user)

enfin ci dessous dans home le conky.sh

#!/bin/bash
sleep 20 && conky -c /home/eee/.conky/.conkyrc ;

Dernière modification par ferreol (Le 19/08/2012, à 12:44)

Hors ligne

#1734 Le 21/08/2012, à 08:36

chepioq

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

Bonjour,
j'avais vu cela quelque part, mais je ne le retrouve plus :
Comment afficher une image avec un script lua, j'ai une image fg.png, et je voudrais l'afficher avec conky, mais par l'intermédiaire d'un script lua (je sais le faire directement avec conky, mais je préférerai le faire avec un script lua).
Quelqu'un a une idée ?


Tout est dans tout et réciproquement....

Hors ligne

#1735 Le 21/08/2012, à 16:41

RegisBurin

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

Salut all

Salut chepioq

chepioq a écrit :

Bonjour,
j'avais vu cela quelque part, mais je ne le retrouve plus :
Comment afficher une image avec un script lua, j'ai une image fg.png, et je voudrais l'afficher avec conky, mais par l'intermédiaire d'un script lua (je sais le faire directement avec conky, mais je préférerai le faire avec un script lua).
Quelqu'un a une idée ?

Comme ça ?

require 'imlib2'

en en_tête du fichier LUA, puis:

image = imlib_load_image("/chemin/vers/image.png")
imlib_context_set_image(image)
imlib_render_image_on_drawable(810,495)
imlib_free_image()

à la fin...

En révisant, bien entendu, le chemin de l'image, et les valeurs de placement wink

>> Source <<

@+

Dernière modification par RegisBurin (Le 21/08/2012, à 16:44)


Config (M-AUDIO Delta44/Wacom CTH661-Phone ZTE OpenC-FFOS2.1) | BabyBox[WIP]
Moi sur le web / Moi, IRL mais sur le web / Ma maison sur le web

Hors ligne

#1736 Le 21/08/2012, à 17:01

chepioq

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

Merci Regis, c'est ce que je cherchais et cela fonctionne...


Tout est dans tout et réciproquement....

Hors ligne

#1737 Le 22/08/2012, à 08:35

chepioq

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

1345617009.jpg

Voila ce que je voulais avec ce que j'ai demandé à régis.
Le script lua associé:

require 'cairo'
require 'imlib2'
function rgb_to_r_g_b(colour)
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255.
end
    

function conky_sun()
    if conky_window == nil then return end
    
    image = imlib_load_image("/home/dominique/.conkyrc/conky-soleil1/fg2.png")
imlib_context_set_image(image)
imlib_render_image_on_drawable(0,0)
imlib_free_image()
--Vous pouvez changer ces paramètres
--couleur du texte à afficher
    local text_color={50,50,0}
--localisation du lieu à afficher
     local text_l= conky_parse("${exec sunwait -p 43.2882N 5.5778E | grep rises | awk '{print $3}'}")
     local text_c= conky_parse("${exec sunwait -p 43.2882N 5.5778E | grep rises | awk '{print $6}'}")
     local text_z= conky_parse("${exec sunwait -p 43.2882N 5.5778E | grep meridian | awk '{print$4}'}")
--Police à utiliser
     local font= "URW Chancery L"
     local font_size= 18
--fin des paramétres

    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable,
        conky_window.visual, conky_window.width,conky_window.height)
    cr=cairo_create(cs)

    cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
                               CAIRO_FONT_WEIGHT_NORMAL)
    cairo_set_font_size (cr, font_size)
    cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)


    cairo_move_to (cr, 20.0, 143.0)
    cairo_show_text (cr, "Lever")

    cairo_move_to (cr, 20.0, 163.0)
    cairo_show_text (cr, text_l)


    cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
                               CAIRO_FONT_WEIGHT_NORMAL)
    cairo_set_font_size (cr, font_size)
    cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)

    cairo_move_to (cr, 165.0, 143.0)
    cairo_show_text (cr, "Coucher")

    cairo_move_to (cr, 173.0, 163.0)
    cairo_show_text (cr, text_c)


    cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL,
                               CAIRO_FONT_WEIGHT_NORMAL)
    cairo_set_font_size (cr, font_size)
    cairo_set_source_rgba (cr, text_color[1]/255, text_color[2]/255, text_color[3]/255,1)

    cairo_move_to (cr, 93.0, 43.0)
    cairo_show_text (cr, "Zenith")

    cairo_move_to (cr, 95.0, 63.0)
    cairo_show_text (cr, text_z)

    cairo_destroy(cr)
end

Tout est dans tout et réciproquement....

Hors ligne

#1738 Le 23/08/2012, à 18:59

Sfroumptch

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

Bonsoir.
Après quelques jours de galère smile et de réglage, voici mon conky librement inspiré des votres.
Je suis ouvert à toute critiques constructives.
1345740853.png
1345741017.png

Par contre, j'aimerais intégrer la météo sans lua, ou script python (deux choses que je ne maitrise pas).
Est-ce que c'est possible?

Edit: Est-ce qu'il est possible d'avoir, sur les conky, la semi-transparence que j'ai sur tilda?

Dernière modification par Sfroumptch (Le 23/08/2012, à 19:02)


S'il n'y a pas de solution, c'est qu'il n'y a pas de problème!

Hors ligne

#1739 Le 23/08/2012, à 19:18

chepioq

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

Sfroumptch a écrit :

Edit: Est-ce qu'il est possible d'avoir, sur les conky, la semi-transparence que j'ai sur tilda?

C'est possible si tu utilises la variable (dans la partie avant TEXT)  own_window_argb_visual
il faut mettre cette variable avec la valeur yes et lui associer une autre variable qui règle la transparence : own_window_argb_value avec une valeur allant de 0 (totalement transparent) à 255 (totalement opaque) .
Par exemple :

own_window_argb_visual yes
own_window_argb_value 100

A toi de faire des essais pour voir la valeur qui te convient

Dernière modification par chepioq (Le 23/08/2012, à 19:18)


Tout est dans tout et réciproquement....

Hors ligne

#1740 Le 25/08/2012, à 00:32

Donar2.0

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

Bonjour, j' ai un petit soucis avec les T° Disk dans conky,  les attributions  sdb, sdb etc.. demeurent aléatoire
malgré que mes  fstab sont renseigner avec les UUID,

J'ai essayé de remplacer sans succès:

${hddtemp /dev/sdc}

par

${/dev/disk/by-uuid/dd8cafb5-81eb-4c0d-b7dc-302c1fee5686}°C

Dernière modification par Donar2.0 (Le 25/08/2012, à 10:05)

#1741 Le 25/08/2012, à 12:28

sunkart

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

Même problème dont je n'ai jamais trouvé de solution. Si tu boot avec des disques USB la distribution sda, sdb, etc. change et ça te fout en l'air le conky.
Si tu trouves un contournement je serai preneur smile


Cyril

Hors ligne

#1742 Le 25/08/2012, à 18:14

Donar2.0

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

Cela fait un moment que je cherchais aussi... en attendant de trouver je fais ceci:

sdb${color white} / ${hddtemp /dev/sdb}°C  ${alignr}sdd${color white} / ${hddtemp /dev/sdd}°C 
sdc${color white} / ${hddtemp /dev/sdc}°C  ${alignr}sdh${color white} / ${hddtemp /dev/sdh}°C 

C'est pas mal car cela permet de voir toutes les T° des devices pluggés wink
La racine et le home séparés restent en sda!

#1743 Le 26/08/2012, à 20:50

wansprl

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

Bonjour,
Juste pour ceux qui ont envie de changer les couleurs par exemple des températures suivant vert orange rouge.
Je me suis amusé.
Mon conky

alignment bottom_right
background yes
border_width 1
cpu_avg_samples 2
default_color yellow
default_outline_color yellow
default_shade_color yellow
double_buffer yes
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
gap_x 40
gap_y 75
max_port_monitor_connections 64
max_specials 512
max_user_text 16384
minimum_size 275 275
maximum_width 275
net_avg_samples 2
no_buffers yes
out_to_console no
wm_class_name Conky
own_window_colour yellow
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type normal
own_window yes
own_window_argb_visual yes
stippled_borders 2
update_interval 2
uppercase no
use_spacer yes
use_xft yes
text_buffer_size 1024
xftalpha 0.8
xftfont Bitstream Vera Sans Mono:size=10

TEXT
${color #0077ff}${time %A %d %B %Y}
${color #0077ff}${font style=Bold:pixelsize=30}${time %H:%M:%S}${font}${color}
${color #0077ff}$sysname $kernel
${color #0077ff}Uptime:${color} $uptime
${color #0077ff}CPU:$color ${cpu}% ${color}${cpubar 5,120} ${color Yellow}${cpugraph 13,93 00FF00 FF0000}
#${color #0077ff}${cpugraph cpu 25,135 00FF00 FF0000}
#$alignr${cpugraph cpu2 25,135  00FF00 FF0000}${color #0077ff}${cpugraph cpu3 25,135 00FF00 FF0000}$alignr${cpugraph cpu4 25,135  00FF00 FF0000}
${color #0077ff}RAM Usage:$color $mem${color #0077ff}/${color} $memmax $memperc% ${membar 6}
${color #0077ff}Swap Usage:$color $swap${color #0077ff}/${color} $swapmax $swapperc% ${swapbar 6}
$hr
${color #0077ff}Disk I/O: $color${diskio} ${diskiograph 13,150  00FF00 FF0000}
${color #0077ff}Samsung 250Gb:${if_match ${hddtemp /dev/sda}<=30}${color green}${hddtemp /dev/sda}$else${if_match ${hddtemp /dev/sda}<=33}${color orange}${hddtemp /dev/sda}$else${color red}${hddtemp /dev/sda}$endif$endif°C${color Yellow}${alignr}${diskiograph /dev/sda 13,135 00FF00 FF0000}
${fs_free /}/${fs_size /}${fs_bar 3,100} ${diskio /dev/sda}
${color #0077ff}Western 500Gb:${if_match ${hddtemp /dev/sdb}<=32}${color green}${hddtemp /dev/sdb}$else${if_match ${hddtemp /dev/sdb}<=36}${color orange}${hddtemp /dev/sdb}$else${color red}${hddtemp /dev/sdb}$endif$endif°C${color Yellow}${alignr}${diskiograph /dev/sdb 13,135 00FF00 FF0000}
${fs_free /home/}/${fs_size /home/}${fs_bar 3,100 /home/} ${diskio /dev/sdb}
${color #0077ff}Seagate 500Gb:${if_match ${hddtemp /dev/sdc}<=32}${color green}${hddtemp /dev/sdc}$else${if_match ${hddtemp /dev/sdc}<=36}${color orange}${hddtemp /dev/sdc}$else${color red}${hddtemp /dev/sdc}$endif$endif°C${color Yellow}${alignr}${diskiograph /dev/sdc 13,135 00FF00 FF0000}
${fs_free /media/1e22e645-768e-49f4-a762-20fadcfab4ac_/}/${fs_size /media/1e22e645-768e-49f4-a762-20fadcfab4ac_/}${fs_bar 3,100 /media/1e22e645-768e-49f4-a762-20fadcfab4ac_/} ${diskio /dev/sdc}
${color #0077ff}Seagate 250Gb:${if_match ${hddtemp /dev/sdd}<=32}${color green}${hddtemp /dev/sdd}$else${if_match ${hddtemp /dev/sdd}<=36}${color orange}${hddtemp /dev/sdd}$else${color red}${hddtemp /dev/sdd}$endif$endif°C${color Yellow}${alignr}${diskiograph /dev/sdd 13,135 00FF00 FF0000}
${fs_free /media/df533133-cc07-480e-b336-15573a83aaef_/}/${fs_size /media/df533133-cc07-480e-b336-15573a83aaef_/}${fs_bar 3,100 /media/df533133-cc07-480e-b336-15573a83aaef_/} ${diskio /dev/sdd}
${color #0077ff}Samsung 250Gb:${if_match ${hddtemp /dev/sde}<=30}${color green}${hddtemp /dev/sde}$else${if_match ${hddtemp /dev/sde}<=33}${color orange}${hddtemp /dev/sde}$else${color red}${hddtemp /dev/sde}$endif$endif°C${color Yellow}${alignr}${diskiograph /dev/sde 13,135 00FF00 FF0000}
${fs_free /media/c3d95c81-0872-48fe-9a8b-8d59da8117db_/}/${fs_size /media/c3d95c81-0872-48fe-9a8b-8d59da8117db_/}${fs_bar 3,100 /media/c3d95c81-0872-48fe-9a8b-8d59da8117db_/} ${diskio /dev/sde}
${color #0077ff}Western 1000Gb:${if_match ${hddtemp /dev/sdf}<=32}${color green}${hddtemp /dev/sdf}$else${if_match ${hddtemp /dev/sdf}<=36}${color orange}${hddtemp /dev/sdf}$else${color red}${hddtemp /dev/sdf}$endif$endif°C${color Yellow}${alignr}${diskiograph /dev/sdf 13,135 00FF00 FF0000}
${fs_free /media/Elements/}/${fs_size /media/Elements/}${fs_bar 3,100} ${diskio /dev/sdf}
#${color #0077ff}Externe Hdd  :${if_match ${hddtemp /dev/sdf}<=27}${color yellow}${hddtemp /dev/sdf}$else${color red}${hddtemp /dev/sdf}$endif°C${color Yellow}${alignr}${diskiograph /dev/sdf 13,135 00FF00 FF0000}
${color #0077ff}${exec nvidia-settings -q gpus |grep '0] (' | cut -d '(' -f 2,2 | sed -e 's/.\{1\}$//'} $color${if_match ${nvidia temp}<=40}${color green}${nvidia temp} $else${if_match ${nvidia temp}<=50}${color orange}${nvidia temp}$else${color red}${nvidia temp}$endif$endif${goto 150}°C ${color #0077ff}Ventillo ${color}${exec nvidia-smi -a | grep Fan | cut -c34-39}
#${alignr}${color white}${exec nvidia-settings -q NvidiaDriverVersion |grep ‘):’ | cut -d ‘ ‘ -f 6,6}
${color #0077ff}Mem utilisée: ${color}${exec nvidia-smi -a | grep 'Used' | cut -c35-41} ${color #0077ff}Mem total: ${color}${exec nvidia-smi -a | grep 'Free' | cut -c35-41}
${color #0077ff}Frequency (in MHz):$color $freq
${color #0077ff}Intel Core 00:${if_match ${exec sensors|grep 'Core 0'| cut -c16-19}<=35.0}${color green}${exec sensors|grep 'Core 0'| cut -c16-19}$else${if_match ${exec sensors|grep 'Core 0'| cut -c16-19}<=50.0}${color orange}${exec sensors|grep 'Core 0'| cut -c16-19}$else${color red}${exec sensors|grep 'Core 0'| cut -c16-19}$endif$endif°C ${color #0077ff}Intel Core 01:${if_match ${exec sensors|grep 'Core 1'| cut -c16-19}<=35.0}${color green}${exec sensors|grep 'Core 1'| cut -c16-19}$else${if_match ${exec sensors|grep 'Core 1'| cut -c16-19}<=50.0}${color orange}${exec sensors|grep 'Core 1'| cut -c16-19}$else${color red}${exec sensors|grep 'Core 1'| cut -c16-19}$endif$endif°C
${color #0077ff}Intel Core 02:${if_match ${exec sensors|grep 'Core 2'| cut -c16-19}<=35.0}${color green}${exec sensors|grep 'Core 2'| cut -c16-19}$else${if_match ${exec sensors|grep 'Core 2'| cut -c16-19}<=50.0}${color orange}${exec sensors|grep 'Core 2'| cut -c16-19}$else${color red}${exec sensors|grep 'Core 2'| cut -c16-19}$endif$endif°C ${color #0077ff}Intel Core 03:${if_match ${exec sensors|grep 'Core 3'| cut -c16-19}<=35.0}${color green}${exec sensors|grep 'Core 3'| cut -c16-19}$else${if_match ${exec sensors|grep 'Core 3'| cut -c16-19}<=50.0}${color orange}${exec sensors|grep 'Core 3'| cut -c16-19}$else${color red}${exec sensors|grep 'Core 3'| cut -c16-19}$endif$endif°C 
${color #0077ff}Carte Mère Tp:$color${if_match ${exec sensors|grep 'temp1'| cut -c16-19}<=29.0}${color green}${exec sensors|grep 'temp1'| cut -c16-19}$else${if_match ${exec sensors|grep 'temp1'| cut -c16-19}<=40.0}${color orange}${exec sensors|grep 'temp1'| cut -c16-19}$else${color red}${exec sensors|grep 'temp1'| cut -c16-19}$endif$endif°C${color #0077ff} Carte Mère Tp:$color${if_match ${exec sensors|grep 'temp3'| cut -c16-19}<=29.0}${color green}${exec sensors|grep 'temp3'| cut -c16-19}$else${if_match ${exec sensors|grep 'temp3'| cut -c16-19}<=40.0}${color orange}${exec sensors|grep 'temp3'| cut -c16-19}$else${color red}${exec sensors|grep 'temp3'| cut -c16-19}$endif$endif°C
${color #0077ff}Vitesse Fan 1:$color${exec sensors|grep 'fan1'| cut -c14-22}
$color$hr
${color #0077ff}IP ${color}${addr eth0}
#${color #0077ff}wan:${color}${texeci 3600 wget [url]http://checkip.dyndns.org[/url] -O - -o /dev/null | cut -d : -f 2 | cut -d \< -f 1} 
#IP Publique ${execi 60 wget -O - [url]http://ip.tupeux.com[/url] | tail}
${color #0077ff}Net Down:${goto 80}$color ${downspeed eth0} ${color #0077ff}Net Up:$color ${upspeed eth0} 
${color}${downspeedgraph eth0 25,135 00FF00 FF0000} ${alignr}${color}${upspeedgraph eth0 25,135 00FF00 FF0000}
${color #0077ff}Tot Down:${goto 80}$color ${totaldown eth0} ${color #0077ff}Tot Up:$color ${totalup eth0}
${color #0077ff}Jour :${goto 80}$color${execi 300 vnstat -i eth0 | grep "today" | awk '{print $2 $3}'}${goto 140}${color #0077ff}Jour :$color${goto 205}${execi 300 vnstat -i eth0 | grep "today" | awk '{print $5 $6}'}  
${color #0077ff}Semaine :${goto 80}$color${execi 300 vnstat -w -i eth0 | grep "current week" | awk '{print $3 $4}'}${goto 140}${color #0077ff}Semaine :$color${goto 205}${execi 300 vnstat -w -i eth0 | grep "current week" | awk '{print $6 $7}'} 
${color #0077ff}Mois :${goto 80}$color${execi 300 vnstat -m -i eth0 | grep "`date +"%b '%y"`" | awk '{print $3 $4}'}${goto 140}${color #0077ff}Mois :$color${goto 205}${execi 300 vnstat -m -i eth0 | grep "`date +"%b '%y"`" | awk '{print $6 $7}'}
$color$hr
#${execi 30 tail -n3 /var/log/ulog/syslogemu.log | fold -w50}
${color #0077ff}Port(s)${alignr}${color #0077ff}Entrées : $color${tcp_portmon 1 32767 count}${color #0077ff} Sorties :$color ${tcp_portmon 32768 61000 count}${color #0077ff} ALL : $color${tcp_portmon 1 65535 count}
${color #0077ff}Connections Out${alignr} Service / Port$color
${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
${tcp_portmon 32768 61000 rhost 4} ${alignr} ${tcp_portmon 32768 61000 rservice 4}
${tcp_portmon 32768 61000 rhost 5} ${alignr} ${tcp_portmon 32768 61000 rservice 5}
${color #0077ff}Connections In${alignr} Service / Port$color
${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
${tcp_portmon 1 32767 rhost 3} ${alignr} ${tcp_portmon 1 32767 lservice 3}
${tcp_portmon 1 32767 rhost 4} ${alignr} ${tcp_portmon 1 32767 lservice 4}
${tcp_portmon 1 32767 rhost 5} ${alignr} ${tcp_portmon 1 32767 lservice 5}
$hr
${color}Top Processes:
${color #0077ff}Processes:$color $processes  ${color #0077ff}Running:$color $running_processes
${color #0077ff}Name             PID    CPU%   MEM%
$color${top name 1}${top pid 1} ${top cpu 1} ${top mem 1}
$color${top name 2}${top pid 2} ${top cpu 2} ${top mem 2}
$color${top name 3}${top pid 3} ${top cpu 3} ${top mem 3}
$color${top name 4}${top pid 4} ${top cpu 4} ${top mem 4}
$color${top name 5}${top pid 5} ${top cpu 5} ${top mem 5}
$hr
[code]merci de penser à utiliser les balises code[/code]

Dernière modification par ljere (Le 26/08/2012, à 21:14)

Hors ligne

#1744 Le 29/08/2012, à 16:54

Yoannjap

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

Bonojour forumers !
Je suis plutôt débutant dans Ubuntu (je l'utilise depuis début juillet).
Et question conky, je me suis installé conky colors pour avoir le conky Cairo (en théorie comme ici) :
http://3.bp.blogspot.com/_GqNzhC59hJM/T … -cairo.png

Sauf que j'ai un écran de définition 1980*1080. Et du coup je trouvais la police de 8pts trop illisible pour je jeter un œil rapidement au conky.
Je suis donc allé dans le fichier conkycr du répertoire caché .conkycolors pour modifier la taille des polices et deux ou trois options mineures tel que :

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

imlib_cache_size 0
double_buffer yes
no_buffers yes

format_human_readable

#####################
# - Text settings - #
#####################
use_xft yes
xftfont Ubuntu:size=12
override_utf8_locale yes
text_buffer_size 2048

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



alignment bottom_right
gap_x 0
gap_y 40
minimum_size 182 0
maximum_width 182

default_bar_size 40 8

#########################
# - Graphics settings - #
#########################
draw_shades yes

default_color E2DACB

color0 F0EBE2
color1 77216F
color2 E6E6E6 # Blanc
color3 2C001E
color4 FF9933 # Jaune ocre
color5 99CCFF # Bleu pastel
color6 FF6699 # rose-vermillon pastel


lua_load /usr/share/conkycolors/scripts/conkyCairo.lua
lua_draw_hook_post conky_main white 77216F 2 on bigcairo Rhythmbox cairocover off 0

TEXT
${voffset 10}
##############
# - SYSTEM - #
##############
# |--CPU
${goto 50}${font Ubuntu:style=Bold:size=12}${color2}${freq_g 1}${color} GHZ${font}
${goto 50}CPU1: ${font Ubuntu:style=Bold:size=12}${color5}${cpu cpu1}%${color}${font}
${goto 50}Temp: ${font Ubuntu:style=Bold:size=12}${color4}${execi 30 sensors | grep 'Core 0' |awk '{print $3}' | sed 's/+//' | sed 's/\.0//g'}${color}${font}
${voffset 10}
${goto 50}${font Ubuntu:style=Bold:size=12}${color2}${freq_g 2}${color} GHZ${font}
${goto 50}CPU2: ${font Ubuntu:style=Bold:size=12}${color5}${cpu cpu2}%${color}${font}
${goto 50}Temp: ${font Ubuntu:style=Bold:size=12}${color4}${execi 30 sensors | grep 'Core 1' |awk '{print $3}' | sed 's/+//' | sed 's/\.0//g'}${color}${font}
# |--MEM
${voffset 10}
${goto 50}RAM: ${font Ubuntu:style=Bold:size=12}${color5}$memperc%${color}${font}
${goto 50}Free: ${font Ubuntu:style=Bold:size=12}${color2}${memeasyfree}${color}${font}
${goto 50}Used: ${font Ubuntu:style=Bold:size=12}${color2}${mem}${color}${font}
# |--SWAP
${voffset 10}
${goto 50}SWAP: ${font Ubuntu:style=Bold:size=12}${color5}$swapperc%${color}${font}
${goto 50}Free: ${font Ubuntu:style=Bold:size=12}${color2}${swapmax}${color}${font}
${goto 50}Used: ${font Ubuntu:style=Bold:size=12}${color2}${swap}${color}${font}
#############
# - CLOCK - #
#############
${voffset 92}
##########
# - HD - #
##########
${voffset 15}
${goto 50}Root: ${font Ubuntu:style=Bold:size=12}${color5}${fs_free_perc /}%${color}${font}
${goto 50}Free: ${font Ubuntu:style=Bold:size=12}${color2}${fs_free /}${color}${font}
${goto 50}Used: ${font Ubuntu:style=Bold:size=12}${color2}${fs_used /}${color}${font}
${voffset 15}
${goto 50}Home: ${font Ubuntu:style=Bold:size=12}${color5}${fs_free_perc /home}%${color}${font}
${goto 50}Free: ${font Ubuntu:style=Bold:size=12}${color2}${fs_free /home}${color}${font}
${goto 50}Used: ${font Ubuntu:style=Bold:size=12}${color2}${fs_used /home}${color}${font}
####################
# - MEDIA PLAYER - #
####################
${voffset 0}
${execi 6 /home/yoannj/.conkycolors/bin/conkyCover}${execpi 10 /usr/share/conkycolors/bin/conkyRhythmbox -t /home/yoannj/.conkycolors/templates/conkyPlayer.template}${voffset -10}
###############
# - NETWORK - #
###############
${voffset 4}
# |--WLAN0
${if_up wlan0}
${goto 60}Up: ${font Ubuntu:style=Bold:size=12}${color5}${upspeed wlan0}${color}${font}
${goto 65}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totalup wlan0}${color}${font}
${goto 60}Down: ${font Ubuntu:style=Bold:size=12}${color5}${downspeed wlan0}${color}${font}
${goto 65}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totaldown wlan0}${color}${font}
${goto 60}Signal: ${font Ubuntu:style=Bold:size=10}${color4}${wireless_link_qual wlan0}%${color}${font}
# |--ETH0
${else}${if_up eth0}
${goto 60}Up: ${font Ubuntu:style=Bold:size=12}${color5}${upspeed eth0}${color}${font}
${goto 65}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totalup eth0}${color}${font}
${goto 60}Down: ${font Ubuntu:style=Bold:size=12}${color5}${downspeed eth0}${color}${font}
${goto 65}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totaldown eth0}${color}${font}
# |--PPP0
${else}${if_up ppp0}
${goto 60}Up: ${font Ubuntu:style=Bold:size=12}${color5}${upspeed ppp0}${color}${font}
${goto 65}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totalup ppp0}${color}${font}
${goto 60}Down: ${font Ubuntu:style=Bold:size=12}${color5}${downspeed ppp0}${color}${font}
${goto 65}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totaldown ppp0}${color}${font}
${endif}${endif}${endif}

Toutefois, les textes sont en décalages avec les icônes d'utilisation à droite, et avec l'horloge, comme cet impr écran le montre :
http://dl.dropbox.com/u/45469283/Captur … 9%3A43.png

Du coup, quelqu'un aurait-il une idée sur le moyen de "remettre en place" les icônes en demi cercle à côté de chaque "bloc de texe" et de remettre l'horloge à sa place ?
Ou au moins du nom du fichier à modifier, voire quoi modifier ?

Merci beaucoup à ceux qui me liront et mille merci à ceux qui pourront m'aider !

modération: merci de mettre des miniatures ou les liens

Dernière modification par ljere (Le 29/08/2012, à 19:50)

Hors ligne

#1745 Le 29/08/2012, à 17:07

chepioq

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

@Yoannjap
Il serait peut-être plus simple de modifier le script lua associé à ce conky...


Tout est dans tout et réciproquement....

Hors ligne

#1746 Le 29/08/2012, à 17:15

Yoannjap

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

@ Chepioq : Merci pour ta réponse. Est-ce que tu parles du fhichier conkyCairo.lua ?
Si c'est celui_là, ça rentre dans les tréfonds de mon ignorance, car devant ce fichier je suis un peu perdu. Que pourrais-je y changer ? (cf ci-dessous le fichier conkyCairo.lua)

--[[
-- This code is mostly by londonali1010, mrpeachy, VinDSL, Wlourf and SLK
-- Conky-Colors by helmuthdu
-- license : Distributed under the terms of GNU GPL version 2 or later
]]

require 'cairo'

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

-------------------------------------------------------------------------------
--                                                                 get_user_dir
-- return user dir
--
function get_user_dir()
	local f = assert(io.popen("conky-colors --localdir"))
	local s = assert(f:read('*l'))
	f:close()
	return s
end

-------------------------------------------------------------------------------
--                                                             get_weather_info
-- return yahoo weather info
--
function get_yahoo_weather_info(dataType, dataLocation, dataUnit)
	local f = assert(io.popen("conky-colors --systemdir"))
	local s = assert(f:read('*l'))
	f:close()
	f = assert(io.popen("sh " .. s .. "/bin/conkyYahooWeather " .. dataType .. " " .. dataLocation .. " " .. dataUnit)) -- runs command
	s = assert(f:read('*l'))
	f:close()
	return s
end

-------------------------------------------------------------------------------
--                                                                 get_day_name
-- return day name
--
function get_day_name(format, day)
	local f = assert(io.popen("date " .. format .. " --date=" .. day)) -- runs command
	local s = assert(f:read('*l'))
	f:close()
	return s
end
-------------------------------------------------------------------------------
--                                                            get_music_percent
-- return music percent
--
function get_music_percent (player)
	local f = assert(io.popen("conky-colors --systemdir"))
	local s = assert(f:read('*l'))
	f:close()
	f = assert(io.popen("sh " .. s .. "/bin/conky" .. player .. " --datatype=PP")) -- runs command
	s = assert(f:read('*a'))
	f:close()
	return s
end

-------------------------------------------------------------------------------
--                                                                      weather
-- dispay text
--
function display_text(data)

	local txt = data.txt
	local x, y = data.x, data.y
	local txt_weight, txt_size = data.txt_weight, data.txt_size
	local txt_fg_colour, txt_fg_alpha = data.txt_fg_colour, data.txt_fg_alpha
	if data.font==nil then data.font = "ubuntu" end
	cairo_select_font_face (cr, data.font, CAIRO_FONT_SLANT_NORMAL, txt_weight)
	cairo_set_font_size (cr, txt_size)
	cairo_set_source_rgba (cr, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
	cairo_move_to (cr, x - (txt_size / 2), y)
	cairo_show_text (cr, txt)
	cairo_stroke (cr)
end

-------------------------------------------------------------------------------
--                                                                  clock_hands
-- display clock hands
--
function clock_hands(data)

	local xc = data.xc
	local yc = data.yc
	local colour = data.colour
	local alpha = data.alpha
	local show_secs = data.show_secs
	local size = data.size
	local secs,mins,hours,secs_arc,mins_arc,hours_arc
	local xh,yh,xm,ym,xs,ys

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

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

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

	cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
	cairo_set_line_width(cr,5)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(colour,alpha))
	cairo_stroke(cr)

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

	cairo_set_line_width(cr,3)
	cairo_stroke(cr)

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

		cairo_set_line_width(cr,1)
		cairo_stroke(cr)
	end

	cairo_set_line_cap(cr,CAIRO_LINE_CAP_BUTT)
end

-------------------------------------------------------------------------------
--                                                              draw_clock_ring
-- displays clock
--
function draw_clock_ring(data)
	local value = data.value
	local value_max = data.value_max
	local x, y = data.x, data.y
	local graph_radius = data.graph_radius
	local graph_thickness, graph_unit_thickness = data.graph_thickness, data.graph_unit_thickness
	local graph_unit_angle = data.graph_unit_angle
	local graph_bg_colour, graph_bg_alpha = data.graph_bg_colour, data.graph_bg_alpha
	local graph_fg_colour, graph_fg_alpha = data.graph_fg_colour, data.graph_fg_alpha

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

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

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

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

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

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

	if value == nil then value=0  end

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

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

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

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

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

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

-------------------------------------------------------------------------------
--                                                                    draw_ring
-- simple rings
--
function draw_ring(data)

	local value = data.value
	local value_max = data.value_max
	local bgc = data.bg_colour
	local bga = data.bg_alpha
	local fgc = data.fg_colour
	local fga = data.fg_alpha
	local xc, yc = data.x, data.y
	local radius = data.radius
	local thickness = data.thickness
	local sa = data.start_angle
	local ea = data.end_angle
	local lr = data.lr
	if value == nil then value=0  end
	local pct = value/value_max

	local angle_0 = sa * math.pi/180 - math.pi/2
	local angle_f = ea * math.pi/180 - math.pi/2
	local pct_arc = pct * (angle_f - angle_0)

	-- Draw background ring
	cairo_arc(cr, xc, yc, radius, angle_0, angle_f)
	cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
	cairo_set_line_width(cr, thickness)
	cairo_stroke(cr)

	-- Draw indicator ring
	cairo_arc(cr, xc, yc, radius, angle_0, angle_0 + pct_arc)
	cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
	cairo_stroke(cr)
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_bars
-- display gauge
--
function draw_gauge_bars(data)
	local x=data.x
	local y=data.y
	local divisions=data.divisions
	local div_width=data.div_width
	local div_height=data.div_height
	local div_gap=data.div_gap
	local br,bg,bb,ba=rgb_to_r_g_b(data.bg_color, data.bg_alpha)
	local sr,sg,sb,sa=rgb_to_r_g_b(data.st_color, data.fg_alpha)
	local mr,mg,mb,ma=rgb_to_r_g_b(data.mid_color, data.fg_alpha)
	local er,eg,eb,ea=rgb_to_r_g_b(data.end_color, data.fg_alpha)

	if data.value==nil then value=0 else value=data.value end

	local value_max=data.value_max
	local value_divs=(value/value_max)*divisions

	cairo_set_line_width (cr,div_width)

	for i=1,divisions do
		if i<(divisions/2) and i<=value_divs then
			colr=((mr-sr)*(i/(divisions/2)))+sr
			colg=((mg-sg)*(i/(divisions/2)))+sg
			colb=((mb-sb)*(i/(divisions/2)))+sb
			cola=((ma-sa)*(i/(divisions/2)))+sa
		elseif i>=(divisions/2) and i<=value_divs then
			colr=((er-mr)*((i-(divisions/2))/(divisions/2)))+mr
			colg=((eg-mg)*((i-(divisions/2))/(divisions/2)))+mg
			colb=((eb-mb)*((i-(divisions/2))/(divisions/2)))+mb
			cola=((ea-ma)*((i-(divisions/2))/(divisions/2)))+ma
		else
			colr=br
			colg=bg
			colb=bb
			cola=ba
		end

		cairo_set_source_rgba (cr,colr,colg,colb,cola)
		if data.orientation == "horizontal" then
			cairo_move_to (cr,x+((div_width+div_gap)*i-1),y)
		else
			cairo_move_to (cr,x,y-((div_width+div_gap)*i-1))
		end
		cairo_rel_line_to (cr,0,div_height)
		cairo_stroke (cr)
	end
end--function bars


-------------------------------------------------------------------------------
--                                                                     draw_box
-- display background
--

--[[BOX WIDGET v1.1 by Wlourf 27/01/2011
This widget can drawn some boxes, even circles in your conky window
http://u-scripts.blogspot.com/2011/01/box-widget.html)

Inspired by Background by londonali1010 (2009), thanks ;-)

The parameters (all optionals) are :
x           - x coordinate of top-left corner of the box, default = 0 = (top-left corner of conky window)
y           - y coordinate of top-left corner of the box, default = 0 = (top-left corner of conky window)
w           - width of the box, default = width of the conky window
h           - height of the box, default = height of the conky window
corners     - corners is a table for the four corners in this order : top-left, top-right,bottom-right, bottom-left
              each corner is defined in a table with a shape and a radius, available shapes are : "curve","circle","line"
              example for the same shapes for all corners:
              { {"circle",10} }
              example for first corner different from the three others
              { {"circle",10}, {"circle",5}  }
              example for top corners differents from bottom corners
              { {"circle",10}, {"circle",10}, {"line",0}  }
              default = { {"line",0} } i.e=no corner
operator    - set the compositing operator (needs in the conkyrc : own_window_argb_visual yes)
              see http://cairographics.org/operators/
              available operators are :
              "clear","source","over","in","out","atop","dest","dest_over","dest_in","dest_out","dest_atop","xor","add","saturate"
              default = "over"
border      - if border>0, the script draws only the border, like a frame, default=0
dash        - if border>0 and dash>0, the border is draw with dashes, default=0
skew_x      - skew box around x axis, default = 0
skew_y      - skew box around y axis, default = 0
scale_x     - rescale the x axis, default=1, useful for drawing elipses ...
scale_y     - rescale the x axis, default=1
angle	    - angle of rotation of the box in degrees, default = 0
              i.e. a horizontal graph
rot_x       - x point of rotation's axis, default = 0,
              relative to top-left corner of the box, (not the conky window)
rot_y       - y point of rotation's axis, default = 0
              relative to top-left corner of the box, (not the conky window)
draw_me     - if set to false, box is not drawn (default = true or 1)
              it can be used with a conky string, if the string returns 1, the box is drawn :
              example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",

linear_gradient - table with the coordinates of two points to define a linear gradient,
                  points are relative to top-left corner of the box, (not the conky window)
                  {x1,y1,x2,y2}
radial_gradient - table with the coordinates of two circle to define a radial gradient,
                  points are relative to top-left corner of the box, (not the conky window)
                  {x1,y1,r1,x2,y2,r2} (r=radius)
colour      - table of colours, default = plain white {{1,0xFFFFFF,0.5}}
              this table contains one or more tables with format {P,C,A}
              P=position of gradient (0 = start of the gradient, 1= end of the gradient)
              C=hexadecimal colour
              A=alpha (opacity) of color (0=invisible,1=opacity 100%)
              Examples :
              for a plain color {{1,0x00FF00,0.5}}
              for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}}        {x=80,y=150,w=20,h=20,
        radial_gradient={20,20,0,20,20,20},
        colour={{0.5,0xFFFFFF,1},{1,0x000000,0}},
              or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle
              for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
              and so on ...



To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
    lua_load ~/scripts/box.lua
    lua_draw_hook_pre main_box

And leave one line blank or not after TEXT
]]

function draw_box(data)

	if data.draw_me == true then data.draw_me = nil end
	if data.draw_me ~= nil and conky_parse(tostring(data.draw_me)) ~= "1" then return end

	local table_corners={"circle","curve","line"}

	local t_operators={
		clear     = CAIRO_OPERATOR_CLEAR,
		source    = CAIRO_OPERATOR_SOURCE,
		over      = CAIRO_OPERATOR_OVER,
		["in"]    = CAIRO_OPERATOR_IN,
		out       = CAIRO_OPERATOR_OUT,
		atop      = CAIRO_OPERATOR_ATOP,
		dest      = CAIRO_OPERATOR_DEST,
		dest_over = CAIRO_OPERATOR_DEST_OVER,
		dest_in   = CAIRO_OPERATOR_DEST_IN,
		dest_out  = CAIRO_OPERATOR_DEST_OUT,
		dest_atop = CAIRO_OPERATOR_DEST_ATOP,
		xor       = CAIRO_OPERATOR_XOR,
		add       = CAIRO_OPERATOR_ADD,
		saturate  = CAIRO_OPERATOR_SATURATE,
	}

	function rgba_to_r_g_b_a(tc)
		--tc={position,colour,alpha}
		local colour = tc[2]
		local alpha = tc[3]
		return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
	end

	function table.copy(data)
		local t2 = {}
		for k,v in pairs(data) do
			t2[k] = {v[1],v[2]}
		end
		return t2
	end

	function draw_corner(num,t)
		local shape=t[1]
		local radius=t[2]
		local x,y = t[3],t[4]
		if shape=="line" then
			if num == 1 then cairo_line_to(cr,radius,0)
			elseif num == 2 then cairo_line_to(cr,x,radius)
			elseif num == 3 then cairo_line_to(cr,x-radius,y)
			elseif num == 4 then cairo_line_to(cr,0,y-radius)
			end
		end
		if shape=="circle" then
			local PI = math.pi
			if num == 1 then cairo_arc(cr,radius,radius,radius,-PI,-PI/2)
			elseif num == 2 then cairo_arc(cr,x-radius,y+radius,radius,-PI/2,0)
			elseif num == 3 then cairo_arc(cr,x-radius,y-radius,radius,0,PI/2)
			elseif num == 4 then cairo_arc(cr,radius,y-radius,radius,PI/2,-PI)
			end
		end
		if shape=="curve" then
			if num == 1 then cairo_curve_to(cr,0,radius ,0,0 ,radius,0)
			elseif num == 2 then cairo_curve_to(cr,x-radius,0, x,y, x,radius)
			elseif num == 3 then cairo_curve_to(cr,x,y-radius, x,y, x-radius,y)
			elseif num == 4 then cairo_curve_to(cr,radius,y, x,y, 0,y-radius)
			end
		end
	end

	--check values and set default values
	if data.x == nil then data.x = 0 end
	if data.y == nil then data.y = 0 end
	if data.w == nil then data.w = conky_window.width end
	if data.h == nil then data.h = conky_window.height end
	if data.radius == nil then data.radius = 0 end
	if data.border == nil then data.border = 0 end
	if data.colour==nil then data.colour={{1,0x000000,0.5}} end
	if data.linear_gradient ~= nil then
		if #data.linear_gradient ~= 4 then
			data.linear_gradient = {data.x,data.y,data.width,data.height}
		end
	end
	if data.angle==nil then data.angle = 0 end

	if data.skew_x == nil then data.skew_x=0  end
	if data.skew_y == nil then  data.skew_y=0 end
	if data.scale_x==nil then data.scale_x=1 end
	if data.scale_y==nil then data.scale_y=1 end
	if data.rot_x == nil then data.rot_x=0  end
	if data.rot_y == nil then  data.rot_y=0 end

	if data.operator == nil then data.operator = "over" end
	if (t_operators[data.operator]) == nil then
		print ("wrong operator :",data.operator)
		data.operator = "over"
	end

	if data.radial_gradient ~= nil then
		if #data.radial_gradient ~= 6 then
			data.radial_gradient = {data.x,data.y,0, data.x,data.y, data.width}
		end
	end

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

	if data.corners == nil then data.corners={ {"line",0} } end
	local data_corners = {}
	local data_corners = table.copy(data.corners)
	--don't use data_corners=data.corners otherwise data.corners is altered

	--complete the data_corners table if needed
	for i=#data_corners+1,4 do
		data_corners[i]=data_corners[#data_corners]
		local flag=false
		for j,v in pairs(table_corners) do flag=flag or (data_corners[i][1]==v) end
		if not flag then print ("error in corners table :",data_corners[i][1]);data_corners[i][1]="curve"  end
	end

	--this way :
	--    data_corners[1][4]=x
	--    data_corners[2][3]=y
	--doesn't work
	data_corners[1]={data_corners[1][1],data_corners[1][2],0,0}
	data_corners[2]={data_corners[2][1],data_corners[2][2],data.w,0}
	data_corners[3]={data_corners[3][1],data_corners[3][2],data.w,data.h}
	data_corners[4]={data_corners[4][1],data_corners[4][2],0,data.h}

	data.no_gradient = (data.linear_gradient == nil ) and (data.radial_gradient == nil )

	cairo_save(cr)
	cairo_translate(cr, data.x, data.y)
	if data.rot_x~=0 or data.rot_y~=0 or data.angle~=0 then
		cairo_translate(cr,data.rot_x,data.rot_y)
		cairo_rotate(cr,data.angle*math.pi/180)
		cairo_translate(cr,-data.rot_x,-data.rot_y)
	end
	if data.scale_x~=1 or data.scale_y~=1 or data.skew_x~=0 or data.skew_y~=0 then
		local matrix0 = cairo_matrix_t:create()
		tolua.takeownership(matrix0)
		cairo_matrix_init (matrix0, data.scale_x,math.pi*data.skew_y/180	, math.pi*data.skew_x/180	,data.scale_y,0,0)
		cairo_transform(cr,matrix0)
	end

	local tc=data_corners
	cairo_move_to(cr,tc[1][2],0)
	cairo_line_to(cr,data.w-tc[2][2],0)
	draw_corner(2,tc[2])
	cairo_line_to(cr,data.w,data.h-tc[3][2])
	draw_corner(3,tc[3])
	cairo_line_to(cr,tc[4][2],data.h)
	draw_corner(4,tc[4])
	cairo_line_to(cr,0,tc[1][2])
	draw_corner(1,tc[1])

	if data.no_gradient then
		cairo_set_source_rgba(cr,rgba_to_r_g_b_a(data.colour[1]))
	else
		if data.linear_gradient ~= nil then
			pat = cairo_pattern_create_linear (data.linear_gradient[1],data.linear_gradient[2],data.linear_gradient[3],data.linear_gradient[4])
		elseif data.radial_gradient ~= nil then
			pat = cairo_pattern_create_radial (data.radial_gradient[1],data.radial_gradient[2],data.radial_gradient[3],
			data.radial_gradient[4],data.radial_gradient[5],data.radial_gradient[6])
		end
		for i=1, #data.colour do
			cairo_pattern_add_color_stop_rgba (pat, data.colour[i][1], rgba_to_r_g_b_a(data.colour[i]))
		end
		cairo_set_source (cr, pat)
		cairo_pattern_destroy(pat)
	end

	cairo_set_operator(cr,t_operators[data.operator])

	if data.border>0 then
		cairo_close_path(cr)
		if data.dash ~= nil then cairo_set_dash(cr, data.dash, 1, 0.0) end
		cairo_set_line_width(cr,data.border)
		cairo_stroke(cr)
	else
		cairo_fill(cr)
	end

	cairo_restore(cr)
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main(color, theme, n_cpu, swap, clock_theme, player, player_theme)

	if conky_window == nil then return end

	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)

	cr = cairo_create(cs)

	local updates=tonumber(conky_parse('${updates}'))
	if updates>5 then

	if color == "white" then
		bgc = 0xffffff -- the colour of the base ring.
		fgc = 0xffffff -- the colour of the indicator part of the ring.
		bga = 0.2 --the alpha value of the base ring.
		fga = 0.8 -- the alpha value of the indicator part of the ring.
	else
		bgc = 0x1e1c1a -- the colour of the base ring.
		fgc = 0x1e1c1a -- the colour of the indicator part of the ring.
		bga = 0.6 -- the alpha value of the base ring.
		fga = 0.8 -- the alpha value of the indicator part of the ring.
	end

	local theme = ("0x" .. theme)
	local w = conky_window.width
	local h = conky_window.height
	local hori_space = 190
	local vert_space = 46
	local xp = hori_space
	local yp = vert_space

	-- CPU
	for i=1,n_cpu do
		cpu_number = ("cpu" .. i)
		settings = {--CPU GRAPH CPU1
			value=tonumber(conky_parse("${cpu " .. cpu_number .. "}")),
			value_max=100              ,
			x=xp                       , y=yp                        ,
			graph_radius=20            ,
			graph_thickness=10         ,
			graph_start_angle=180      ,
			graph_unit_angle=1.85      , graph_unit_thickness=2.7    ,
			graph_bg_colour=bgc        , graph_bg_alpha=bga          ,
			graph_fg_colour=fgc        , graph_fg_alpha=fga          ,
			hand_fg_colour=fgc         , hand_fg_alpha=0.0           ,
			txt_radius=35              ,
			txt_weight=1               , txt_size=8.0                ,
			txt_fg_colour=fgc          , txt_fg_alpha=0              ,
			graduation_radius=28       ,
			graduation_thickness=0     , graduation_mark_thickness=1 ,
			graduation_unit_angle=27   ,
			graduation_fg_colour=theme , graduation_fg_alpha=0.3     ,
			caption=''                 ,
			caption_weight=1           , caption_size=10.0           ,
			caption_fg_colour=fgc      , caption_fg_alpha=fga        ,
		};draw_gauge_ring(settings)
		yp = yp + 64
	end

	-- MEMORY
	settings = {--MEMPERC GRAPH
		value=tonumber(conky_parse("${memperc}")),
		value_max=100            ,
		x=xp                     , y=yp                        ,
		graph_radius=20          ,
		graph_thickness=10       ,
		graph_start_angle=180    ,
		graph_unit_angle=1.85    , graph_unit_thickness=2.7    ,
		graph_bg_colour=bgc      , graph_bg_alpha=bga          ,
		graph_fg_colour=fgc      , graph_fg_alpha=fga          ,
		hand_fg_colour=fgc       , hand_fg_alpha=0.0           ,
		txt_radius=35            ,
		txt_weight=1             , txt_size=8.0                ,
		txt_fg_colour=fgc        , txt_fg_alpha=0.0            ,
		graduation_radius=22     ,
		graduation_thickness=0   , graduation_mark_thickness=2 ,
		graduation_unit_angle=27 ,
		graduation_fg_colour=fgc , graduation_fg_alpha=0.5     ,
		caption=''               ,
		caption_weight=1         , caption_size=10.0           ,
		caption_fg_colour=fgc    , caption_fg_alpha=fga        ,
	};draw_gauge_ring(settings)

	-- SWAP
	if swap == "on" then
		yp = yp + 64
		settings = {--SWAP FILESYSTEM USED GRAPH
			value=tonumber(conky_parse("${swapperc}")),
			value_max=100            ,
			x=xp                     , y=yp                        ,
			graph_radius=20          ,
			graph_thickness=10       ,
			graph_start_angle=180    ,
			graph_unit_angle=1.85    , graph_unit_thickness=2.7    ,
			graph_bg_colour=bgc      , graph_bg_alpha=bga          ,
			graph_fg_colour=fgc      , graph_fg_alpha=fga          ,
			hand_fg_colour=fgc       , hand_fg_alpha=0.0           ,
			txt_radius=35            ,
			txt_weight=1             , txt_size=8.0                ,
			txt_fg_colour=fgc        , txt_fg_alpha=0              ,
			graduation_radius=22     ,
			graduation_thickness=0   , graduation_mark_thickness=2 ,
			graduation_unit_angle=27 ,
			graduation_fg_colour=fgc , graduation_fg_alpha=0.5     ,
			caption=''               ,
			caption_weight=1         , caption_size=10.0           ,
			caption_fg_colour=fgc    , caption_fg_alpha=fga        ,
		};draw_gauge_ring(settings)
	end

	-- CLOCK
	if clock_theme == "cairo" then
		yp = yp + 64
		settings = {--CLOCK HANDS
			xc = 154          ,
			yc = yp           ,
			colour = bgc      ,
			alpha = 1         ,
			show_secs = false ,
			size = 30         ,
		};clock_hands(settings)
		settings = {--SECONDS
			value=tonumber(conky_parse("${time %S}")),
			value_max = 60  ,
			x = 154         , y = yp          ,
			bg_colour = bgc , bg_alpha = bga  ,
			fg_colour = fgc , fg_alpha = fga  ,
			radius =20      , thickness = 5   ,
			start_angle = 0 , end_angle = 360 ,
			lr = 0          ,
		};draw_ring(settings)
	elseif clock_theme == "bigcairo" then
		yp = yp + 64 + 20
		settings = {--CLOCK HANDS
			xc = 124         ,
			yc = yp          ,
			colour = bgc     ,
			alpha = 1        ,
			show_secs = true ,
			size = 60        ,
		};clock_hands(settings)
		settings = {--DAYS
			value=tonumber(conky_parse("${time %d}")),
			value_max = 31    ,
			x = 124           , y = yp          ,
			bg_colour = bgc   , bg_alpha = bga  ,
			fg_colour = fgc   , fg_alpha = fga  ,
			radius =50        , thickness = 5   ,
			start_angle = 215 , end_angle = 325 ,
			lr = 0            ,
		};draw_ring(settings)
		settings = {--MONTHS
			value=tonumber(conky_parse("${time %m}")),
			value_max = 12   ,
			x = 124          , y = yp          ,
			bg_colour = bgc  , bg_alpha = bga  ,
			fg_colour = fgc  , fg_alpha = fga  ,
			radius = 50      , thickness = 5   ,
			start_angle = 35 , end_angle = 145 ,
			lr = 0           ,
		};draw_ring(settings)
		settings = {--SECONDS
			value=tonumber(conky_parse("${time %S}")),
			value_max = 60  ,
			x = 124         , y = yp          ,
			bg_colour = bgc , bg_alpha = bga  ,
			fg_colour = fgc , fg_alpha = fga  ,
			radius =40      , thickness = 10  ,
			start_angle = 0 , end_angle = 360 ,
			lr = 0          ,
		};draw_ring(settings)
		yp = yp + 22
	end

	yp = yp + 64
	-- DISKS
	disks = {'/', '/home'}
	for i, partitions in ipairs(disks) do
		settings = {--FILESYSTEM USED GRAPH
			value=tonumber(conky_parse("${fs_used_perc " .. partitions .. "}")),
			value_max=100            ,
			x=xp                     , y=yp                        ,
			graph_radius=20          ,
			graph_thickness=10       ,
			graph_start_angle=180    ,
			graph_unit_angle=1.85    , graph_unit_thickness=2.7    ,
			graph_bg_colour=bgc      , graph_bg_alpha=bga          ,
			graph_fg_colour=fgc      , graph_fg_alpha=fga          ,
			hand_fg_colour=fgc       , hand_fg_alpha=0.0           ,
			txt_radius=35            ,
			txt_weight=1             , txt_size=8.0                ,
			txt_fg_colour=fgc        , txt_fg_alpha=0              ,
			graduation_radius=23     ,
			graduation_thickness=0   , graduation_mark_thickness=2 ,
			graduation_unit_angle=27 ,
			graduation_fg_colour=fgc , graduation_fg_alpha=0.5     ,
			caption=''               ,
			caption_weight=1         , caption_size=10.0           ,
			caption_fg_colour=fgc    , caption_fg_alpha=fga        ,
		};draw_gauge_ring(settings)
		yp = yp + 64
	end

	-- PLAYERS
	if player == "Banshee" or player == "Clementine" or player == "Rhythmbox" then
		if player_theme == "cairo" then
			settings = {
				value=get_music_percent(player) ,
				value_max = 100   ,
				x = 154           , y = yp          ,
				bg_colour = bgc   , bg_alpha = bga  ,
				fg_colour = theme , fg_alpha = fga  ,
				radius =10        , thickness = 20  ,
				start_angle = 0   , end_angle = 360 ,
				lr = 0            ,
			};draw_ring(settings)
			settings = {
				value=get_music_percent(player),
				value_max = 100 ,
				x = 154         , y = yp          ,
				bg_colour = bgc , bg_alpha = 0.4  ,
				fg_colour = fgc , fg_alpha = 0.2  ,
				radius =20      , thickness = 1   ,
				start_angle = 0 , end_angle = 360 ,
				lr = 0          ,
			};draw_ring(settings)
		elseif player_theme == "cairocover" then
			settings = {
				value=get_music_percent(player),
				value_max = 100   ,
				x = 174           , y = yp-18       ,
				bg_colour = bgc   , bg_alpha = 0.4  ,
				fg_colour = theme , fg_alpha = 1    ,
				radius =5         , thickness = 11  ,
				start_angle = 0   , end_angle = 360 ,
				lr = 0            ,
			};draw_ring(settings)
			settings = {
				value=get_music_percent(player),
				value_max = 100 ,
				x = 174         , y = yp-18       ,
				bg_colour = bgc , bg_alpha = 0.6  ,
				fg_colour = fgc , fg_alpha = 0.2  ,
				radius =11      , thickness = 2   ,
				start_angle = 0 , end_angle = 360 ,
				lr = 0          ,
			};draw_ring(settings)
		else
		settings = {--PLAYERS
			value=get_music_percent(player),
			value_max=100            ,
			x=xp                     , y=yp                        ,
			graph_radius=20          ,
			graph_thickness=10       ,
			graph_start_angle=180    ,
			graph_unit_angle=1.85    , graph_unit_thickness=2.7    ,
			graph_bg_colour=bgc      , graph_bg_alpha=bga          ,
			graph_fg_colour=fgc      , graph_fg_alpha=fga          ,
			hand_fg_colour=fgc       , hand_fg_alpha=0.0           ,
			txt_radius=35            ,
			txt_weight=1             , txt_size=8.0                ,
			txt_fg_colour=fgc        , txt_fg_alpha=0              ,
			graduation_radius=23     ,
			graduation_thickness=0   , graduation_mark_thickness=2 ,
			graduation_unit_angle=27 ,
			graduation_fg_colour=fgc , graduation_fg_alpha=0.5     ,
			caption=''               ,
			caption_weight=1         , caption_size=10.0           ,
			caption_fg_colour=fgc    , caption_fg_alpha=fga        ,
		};draw_gauge_ring(settings)
		end
	end

	end-- if updates>5
	cairo_destroy(cr)
	cairo_surface_destroy(cs)
	cr=nil
end-- end main function

Hors ligne

#1747 Le 29/08/2012, à 17:18

Phyllinux

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

@ Yoannjap :

Pour expliciter un peu ce que te dit chepioq :
Ton conky est en fait composé de 2 fichiers séparés :
Le conkyrc (que tu as modifié) qui t'affiche les données demandées (en l’occurrence du texte)
Un script lua qui va afficher les différents graphes.

Les modifications du conkyrc n'ont aucune incidence sur l'affichage des graphiques du script lua.
Donc pour remettre les graphes en face des données, il te faut maintenant modifier le fichier lua.

Bon conky wink


The ship is sinking normally...

Hors ligne

#1748 Le 29/08/2012, à 17:35

Yoannjap

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

@  Phyllinux : D'acc, tu confirmes ce que je pensais smile
Mais il y a foule de fichier .lua avec "conky" lorsque je fait une recherche... tu as une idée duquel ça pourrait être ?

Hors ligne

#1749 Le 29/08/2012, à 17:42

chepioq

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

C'est le fichier que tu nous as fournis, il faut modifier les x et les y dans les setting de la fin (et peut-être aussi les txt_size ).
Mais là c'est un peu du tâtonnement, faut que tu testes différentes valeurs...


Tout est dans tout et réciproquement....

Hors ligne

#1750 Le 29/08/2012, à 19:05

Yoannjap

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

Ça y est ! j'ai le conky exactment comme je le voulais : sobre, lisible (enfin, ça dépend du fond d'écran hein).
Merci à Chepioq et Phyllinux pour leur aide smile
Et voici ce que ça donne :
http://dl.dropbox.com/u/45469283/Captur … 7%3A28.png
Pour ceux que ça interesserait, il faut donc éditer tout d'abord le fichier conkycairo.lua (en gksudo nautilus) qui se trouve dans /usr/share/conkycolors/scripts, tel que :

--[[
-- This code is mostly by londonali1010, mrpeachy, VinDSL, Wlourf and SLK
-- Conky-Colors by helmuthdu
-- license : Distributed under the terms of GNU GPL version 2 or later
]]

require 'cairo'

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

-------------------------------------------------------------------------------
--                                                                 get_user_dir
-- return user dir
--
function get_user_dir()
	local f = assert(io.popen("conky-colors --localdir"))
	local s = assert(f:read('*l'))
	f:close()
	return s
end

-------------------------------------------------------------------------------
--                                                             get_weather_info
-- return yahoo weather info
--
function get_yahoo_weather_info(dataType, dataLocation, dataUnit)
	local f = assert(io.popen("conky-colors --systemdir"))
	local s = assert(f:read('*l'))
	f:close()
	f = assert(io.popen("sh " .. s .. "/bin/conkyYahooWeather " .. dataType .. " " .. dataLocation .. " " .. dataUnit)) -- runs command
	s = assert(f:read('*l'))
	f:close()
	return s
end

-------------------------------------------------------------------------------
--                                                                 get_day_name
-- return day name
--
function get_day_name(format, day)
	local f = assert(io.popen("date " .. format .. " --date=" .. day)) -- runs command
	local s = assert(f:read('*l'))
	f:close()
	return s
end
-------------------------------------------------------------------------------
--                                                            get_music_percent
-- return music percent
--
function get_music_percent (player)
	local f = assert(io.popen("conky-colors --systemdir"))
	local s = assert(f:read('*l'))
	f:close()
	f = assert(io.popen("sh " .. s .. "/bin/conky" .. player .. " --datatype=PP")) -- runs command
	s = assert(f:read('*a'))
	f:close()
	return s
end

-------------------------------------------------------------------------------
--                                                                      weather
-- dispay text
--
function display_text(data)

	local txt = data.txt
	local x, y = data.x, data.y
	local txt_weight, txt_size = data.txt_weight, data.txt_size
	local txt_fg_colour, txt_fg_alpha = data.txt_fg_colour, data.txt_fg_alpha
	if data.font==nil then data.font = "ubuntu" end
	cairo_select_font_face (cr, data.font, CAIRO_FONT_SLANT_NORMAL, txt_weight)
	cairo_set_font_size (cr, txt_size)
	cairo_set_source_rgba (cr, rgb_to_r_g_b(txt_fg_colour, txt_fg_alpha))
	cairo_move_to (cr, x - (txt_size / 2), y)
	cairo_show_text (cr, txt)
	cairo_stroke (cr)
end

-------------------------------------------------------------------------------
--                                                                  clock_hands
-- display clock hands
--
function clock_hands(data)

	local xc = data.xc
	local yc = data.yc
	local colour = data.colour
	local alpha = data.alpha
	local show_secs = data.show_secs
	local size = data.size
	local secs,mins,hours,secs_arc,mins_arc,hours_arc
	local xh,yh,xm,ym,xs,ys

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

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

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

	cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
	cairo_set_line_width(cr,5)
	cairo_set_source_rgba(cr,rgb_to_r_g_b(colour,alpha))
	cairo_stroke(cr)

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

	cairo_set_line_width(cr,3)
	cairo_stroke(cr)

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

		cairo_set_line_width(cr,1)
		cairo_stroke(cr)
	end

	cairo_set_line_cap(cr,CAIRO_LINE_CAP_BUTT)
end

-------------------------------------------------------------------------------
--                                                              draw_clock_ring
-- displays clock
--
function draw_clock_ring(data)
	local value = data.value
	local value_max = data.value_max
	local x, y = data.x, data.y
	local graph_radius = data.graph_radius
	local graph_thickness, graph_unit_thickness = data.graph_thickness, data.graph_unit_thickness
	local graph_unit_angle = data.graph_unit_angle
	local graph_bg_colour, graph_bg_alpha = data.graph_bg_colour, data.graph_bg_alpha
	local graph_fg_colour, graph_fg_alpha = data.graph_fg_colour, data.graph_fg_alpha

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

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

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

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

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

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

	if value == nil then value=0  end

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

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

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

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

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

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

-------------------------------------------------------------------------------
--                                                                    draw_ring
-- simple rings
--
function draw_ring(data)

	local value = data.value
	local value_max = data.value_max
	local bgc = data.bg_colour
	local bga = data.bg_alpha
	local fgc = data.fg_colour
	local fga = data.fg_alpha
	local xc, yc = data.x, data.y
	local radius = data.radius
	local thickness = data.thickness
	local sa = data.start_angle
	local ea = data.end_angle
	local lr = data.lr
	if value == nil then value=0  end
	local pct = value/value_max

	local angle_0 = sa * math.pi/180 - math.pi/2
	local angle_f = ea * math.pi/180 - math.pi/2
	local pct_arc = pct * (angle_f - angle_0)

	-- Draw background ring
	cairo_arc(cr, xc, yc, radius, angle_0, angle_f)
	cairo_set_source_rgba(cr, rgb_to_r_g_b(bgc, bga))
	cairo_set_line_width(cr, thickness)
	cairo_stroke(cr)

	-- Draw indicator ring
	cairo_arc(cr, xc, yc, radius, angle_0, angle_0 + pct_arc)
	cairo_set_source_rgba(cr, rgb_to_r_g_b(fgc, fga))
	cairo_stroke(cr)
end

-------------------------------------------------------------------------------
--                                                              draw_gauge_bars
-- display gauge
--
function draw_gauge_bars(data)
	local x=data.x
	local y=data.y
	local divisions=data.divisions
	local div_width=data.div_width
	local div_height=data.div_height
	local div_gap=data.div_gap
	local br,bg,bb,ba=rgb_to_r_g_b(data.bg_color, data.bg_alpha)
	local sr,sg,sb,sa=rgb_to_r_g_b(data.st_color, data.fg_alpha)
	local mr,mg,mb,ma=rgb_to_r_g_b(data.mid_color, data.fg_alpha)
	local er,eg,eb,ea=rgb_to_r_g_b(data.end_color, data.fg_alpha)

	if data.value==nil then value=0 else value=data.value end

	local value_max=data.value_max
	local value_divs=(value/value_max)*divisions

	cairo_set_line_width (cr,div_width)

	for i=1,divisions do
		if i<(divisions/2) and i<=value_divs then
			colr=((mr-sr)*(i/(divisions/2)))+sr
			colg=((mg-sg)*(i/(divisions/2)))+sg
			colb=((mb-sb)*(i/(divisions/2)))+sb
			cola=((ma-sa)*(i/(divisions/2)))+sa
		elseif i>=(divisions/2) and i<=value_divs then
			colr=((er-mr)*((i-(divisions/2))/(divisions/2)))+mr
			colg=((eg-mg)*((i-(divisions/2))/(divisions/2)))+mg
			colb=((eb-mb)*((i-(divisions/2))/(divisions/2)))+mb
			cola=((ea-ma)*((i-(divisions/2))/(divisions/2)))+ma
		else
			colr=br
			colg=bg
			colb=bb
			cola=ba
		end

		cairo_set_source_rgba (cr,colr,colg,colb,cola)
		if data.orientation == "horizontal" then
			cairo_move_to (cr,x+((div_width+div_gap)*i-1),y)
		else
			cairo_move_to (cr,x,y-((div_width+div_gap)*i-1))
		end
		cairo_rel_line_to (cr,0,div_height)
		cairo_stroke (cr)
	end
end--function bars


-------------------------------------------------------------------------------
--                                                                     draw_box
-- display background
--

--[[BOX WIDGET v1.1 by Wlourf 27/01/2011
This widget can drawn some boxes, even circles in your conky window
http://u-scripts.blogspot.com/2011/01/box-widget.html)

Inspired by Background by londonali1010 (2009), thanks ;-)

The parameters (all optionals) are :
x           - x coordinate of top-left corner of the box, default = 0 = (top-left corner of conky window)
y           - y coordinate of top-left corner of the box, default = 0 = (top-left corner of conky window)
w           - width of the box, default = width of the conky window
h           - height of the box, default = height of the conky window
corners     - corners is a table for the four corners in this order : top-left, top-right,bottom-right, bottom-left
              each corner is defined in a table with a shape and a radius, available shapes are : "curve","circle","line"
              example for the same shapes for all corners:
              { {"circle",10} }
              example for first corner different from the three others
              { {"circle",10}, {"circle",5}  }
              example for top corners differents from bottom corners
              { {"circle",10}, {"circle",10}, {"line",0}  }
              default = { {"line",0} } i.e=no corner
operator    - set the compositing operator (needs in the conkyrc : own_window_argb_visual yes)
              see http://cairographics.org/operators/
              available operators are :
              "clear","source","over","in","out","atop","dest","dest_over","dest_in","dest_out","dest_atop","xor","add","saturate"
              default = "over"
border      - if border>0, the script draws only the border, like a frame, default=0
dash        - if border>0 and dash>0, the border is draw with dashes, default=0
skew_x      - skew box around x axis, default = 0
skew_y      - skew box around y axis, default = 0
scale_x     - rescale the x axis, default=1, useful for drawing elipses ...
scale_y     - rescale the x axis, default=1
angle	    - angle of rotation of the box in degrees, default = 0
              i.e. a horizontal graph
rot_x       - x point of rotation's axis, default = 0,
              relative to top-left corner of the box, (not the conky window)
rot_y       - y point of rotation's axis, default = 0
              relative to top-left corner of the box, (not the conky window)
draw_me     - if set to false, box is not drawn (default = true or 1)
              it can be used with a conky string, if the string returns 1, the box is drawn :
              example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",

linear_gradient - table with the coordinates of two points to define a linear gradient,
                  points are relative to top-left corner of the box, (not the conky window)
                  {x1,y1,x2,y2}
radial_gradient - table with the coordinates of two circle to define a radial gradient,
                  points are relative to top-left corner of the box, (not the conky window)
                  {x1,y1,r1,x2,y2,r2} (r=radius)
colour      - table of colours, default = plain white {{1,0xFFFFFF,0.5}}
              this table contains one or more tables with format {P,C,A}
              P=position of gradient (0 = start of the gradient, 1= end of the gradient)
              C=hexadecimal colour
              A=alpha (opacity) of color (0=invisible,1=opacity 100%)
              Examples :
              for a plain color {{1,0x00FF00,0.5}}
              for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}}        {x=80,y=150,w=20,h=20,
        radial_gradient={20,20,0,20,20,20},
        colour={{0.5,0xFFFFFF,1},{1,0x000000,0}},
              or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle
              for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
              and so on ...



To call this script in Conky, use (assuming you have saved this script to ~/scripts/):
    lua_load ~/scripts/box.lua
    lua_draw_hook_pre main_box

And leave one line blank or not after TEXT
]]

function draw_box(data)

	if data.draw_me == true then data.draw_me = nil end
	if data.draw_me ~= nil and conky_parse(tostring(data.draw_me)) ~= "1" then return end

	local table_corners={"circle","curve","line"}

	local t_operators={
		clear     = CAIRO_OPERATOR_CLEAR,
		source    = CAIRO_OPERATOR_SOURCE,
		over      = CAIRO_OPERATOR_OVER,
		["in"]    = CAIRO_OPERATOR_IN,
		out       = CAIRO_OPERATOR_OUT,
		atop      = CAIRO_OPERATOR_ATOP,
		dest      = CAIRO_OPERATOR_DEST,
		dest_over = CAIRO_OPERATOR_DEST_OVER,
		dest_in   = CAIRO_OPERATOR_DEST_IN,
		dest_out  = CAIRO_OPERATOR_DEST_OUT,
		dest_atop = CAIRO_OPERATOR_DEST_ATOP,
		xor       = CAIRO_OPERATOR_XOR,
		add       = CAIRO_OPERATOR_ADD,
		saturate  = CAIRO_OPERATOR_SATURATE,
	}

	function rgba_to_r_g_b_a(tc)
		--tc={position,colour,alpha}
		local colour = tc[2]
		local alpha = tc[3]
		return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
	end

	function table.copy(data)
		local t2 = {}
		for k,v in pairs(data) do
			t2[k] = {v[1],v[2]}
		end
		return t2
	end

	function draw_corner(num,t)
		local shape=t[1]
		local radius=t[2]
		local x,y = t[3],t[4]
		if shape=="line" then
			if num == 1 then cairo_line_to(cr,radius,0)
			elseif num == 2 then cairo_line_to(cr,x,radius)
			elseif num == 3 then cairo_line_to(cr,x-radius,y)
			elseif num == 4 then cairo_line_to(cr,0,y-radius)
			end
		end
		if shape=="circle" then
			local PI = math.pi
			if num == 1 then cairo_arc(cr,radius,radius,radius,-PI,-PI/2)
			elseif num == 2 then cairo_arc(cr,x-radius,y+radius,radius,-PI/2,0)
			elseif num == 3 then cairo_arc(cr,x-radius,y-radius,radius,0,PI/2)
			elseif num == 4 then cairo_arc(cr,radius,y-radius,radius,PI/2,-PI)
			end
		end
		if shape=="curve" then
			if num == 1 then cairo_curve_to(cr,0,radius ,0,0 ,radius,0)
			elseif num == 2 then cairo_curve_to(cr,x-radius,0, x,y, x,radius)
			elseif num == 3 then cairo_curve_to(cr,x,y-radius, x,y, x-radius,y)
			elseif num == 4 then cairo_curve_to(cr,radius,y, x,y, 0,y-radius)
			end
		end
	end

	--check values and set default values
	if data.x == nil then data.x = 0 end
	if data.y == nil then data.y = 0 end
	if data.w == nil then data.w = conky_window.width end
	if data.h == nil then data.h = conky_window.height end
	if data.radius == nil then data.radius = 0 end
	if data.border == nil then data.border = 0 end
	if data.colour==nil then data.colour={{1,0x000000,0.5}} end
	if data.linear_gradient ~= nil then
		if #data.linear_gradient ~= 4 then
			data.linear_gradient = {data.x,data.y,data.width,data.height}
		end
	end
	if data.angle==nil then data.angle = 0 end

	if data.skew_x == nil then data.skew_x=0  end
	if data.skew_y == nil then  data.skew_y=0 end
	if data.scale_x==nil then data.scale_x=1 end
	if data.scale_y==nil then data.scale_y=1 end
	if data.rot_x == nil then data.rot_x=0  end
	if data.rot_y == nil then  data.rot_y=0 end

	if data.operator == nil then data.operator = "over" end
	if (t_operators[data.operator]) == nil then
		print ("wrong operator :",data.operator)
		data.operator = "over"
	end

	if data.radial_gradient ~= nil then
		if #data.radial_gradient ~= 6 then
			data.radial_gradient = {data.x,data.y,0, data.x,data.y, data.width}
		end
	end

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

	if data.corners == nil then data.corners={ {"line",0} } end
	local data_corners = {}
	local data_corners = table.copy(data.corners)
	--don't use data_corners=data.corners otherwise data.corners is altered

	--complete the data_corners table if needed
	for i=#data_corners+1,4 do
		data_corners[i]=data_corners[#data_corners]
		local flag=false
		for j,v in pairs(table_corners) do flag=flag or (data_corners[i][1]==v) end
		if not flag then print ("error in corners table :",data_corners[i][1]);data_corners[i][1]="curve"  end
	end

	--this way :
	--    data_corners[1][4]=x
	--    data_corners[2][3]=y
	--doesn't work
	data_corners[1]={data_corners[1][1],data_corners[1][2],0,0}
	data_corners[2]={data_corners[2][1],data_corners[2][2],data.w,0}
	data_corners[3]={data_corners[3][1],data_corners[3][2],data.w,data.h}
	data_corners[4]={data_corners[4][1],data_corners[4][2],0,data.h}

	data.no_gradient = (data.linear_gradient == nil ) and (data.radial_gradient == nil )

	cairo_save(cr)
	cairo_translate(cr, data.x, data.y)
	if data.rot_x~=0 or data.rot_y~=0 or data.angle~=0 then
		cairo_translate(cr,data.rot_x,data.rot_y)
		cairo_rotate(cr,data.angle*math.pi/180)
		cairo_translate(cr,-data.rot_x,-data.rot_y)
	end
	if data.scale_x~=1 or data.scale_y~=1 or data.skew_x~=0 or data.skew_y~=0 then
		local matrix0 = cairo_matrix_t:create()
		tolua.takeownership(matrix0)
		cairo_matrix_init (matrix0, data.scale_x,math.pi*data.skew_y/180	, math.pi*data.skew_x/180	,data.scale_y,0,0)
		cairo_transform(cr,matrix0)
	end

	local tc=data_corners
	cairo_move_to(cr,tc[1][2],0)
	cairo_line_to(cr,data.w-tc[2][2],0)
	draw_corner(2,tc[2])
	cairo_line_to(cr,data.w,data.h-tc[3][2])
	draw_corner(3,tc[3])
	cairo_line_to(cr,tc[4][2],data.h)
	draw_corner(4,tc[4])
	cairo_line_to(cr,0,tc[1][2])
	draw_corner(1,tc[1])

	if data.no_gradient then
		cairo_set_source_rgba(cr,rgba_to_r_g_b_a(data.colour[1]))
	else
		if data.linear_gradient ~= nil then
			pat = cairo_pattern_create_linear (data.linear_gradient[1],data.linear_gradient[2],data.linear_gradient[3],data.linear_gradient[4])
		elseif data.radial_gradient ~= nil then
			pat = cairo_pattern_create_radial (data.radial_gradient[1],data.radial_gradient[2],data.radial_gradient[3],
			data.radial_gradient[4],data.radial_gradient[5],data.radial_gradient[6])
		end
		for i=1, #data.colour do
			cairo_pattern_add_color_stop_rgba (pat, data.colour[i][1], rgba_to_r_g_b_a(data.colour[i]))
		end
		cairo_set_source (cr, pat)
		cairo_pattern_destroy(pat)
	end

	cairo_set_operator(cr,t_operators[data.operator])

	if data.border>0 then
		cairo_close_path(cr)
		if data.dash ~= nil then cairo_set_dash(cr, data.dash, 1, 0.0) end
		cairo_set_line_width(cr,data.border)
		cairo_stroke(cr)
	else
		cairo_fill(cr)
	end

	cairo_restore(cr)
end

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main(color, theme, n_cpu, swap, clock_theme, player, player_theme)

	if conky_window == nil then return end

	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)

	cr = cairo_create(cs)

	local updates=tonumber(conky_parse('${updates}'))
	if updates>5 then

	if color == "blue" then
		bgc = 0xffffff -- the colour of the base ring.
		fgc = 0xffffff -- the colour of the indicator part of the ring.
		bga = 0.1 --the alpha value of the base ring.
		fga = 1.0 -- the alpha value of the indicator part of the ring.
	else
		bgc = 0x1e1c1a -- the colour of the base ring.
		fgc = 0x1e1c1a -- the colour of the indicator part of the ring.
		bga = 0.1 -- the alpha value of the base ring.
		fga = 1.0 -- the alpha value of the indicator part of the ring.
	end

	local theme = ("0x" .. theme)
	local w = conky_window.width
	local h = conky_window.height
	local hori_space = 190
	local vert_space = 46
	local xp = hori_space
	local yp = vert_space

	-- CPU
	for i=1,n_cpu do
		cpu_number = ("cpu" .. i)
		settings = {--CPU GRAPH CPU1
			value=tonumber(conky_parse("${cpu " .. cpu_number .. "}")),
			value_max=100              ,
			x=xp                       , y=yp + 15                  ,
			graph_radius=28            ,
			graph_thickness=15         ,
			graph_start_angle=180      ,
			graph_unit_angle=1.85      , graph_unit_thickness=2.7    ,
			graph_bg_colour=bgc        , graph_bg_alpha=bga          ,
			graph_fg_colour=fgc        , graph_fg_alpha=fga          ,
			hand_fg_colour=fgc         , hand_fg_alpha=0.0           ,
			txt_radius=35              ,
			txt_weight=1               , txt_size=8.0                ,
			txt_fg_colour=fgc          , txt_fg_alpha=0              ,
			graduation_radius=28       ,
			graduation_thickness=0     , graduation_mark_thickness=1 ,
			graduation_unit_angle=27   ,
			graduation_fg_colour=theme , graduation_fg_alpha=0.3     ,
			caption=''                 ,
			caption_weight=1           , caption_size=10.0           ,
			caption_fg_colour=fgc      , caption_fg_alpha=fga        ,
		};draw_gauge_ring(settings)
		yp = yp + 95
	end

	-- MEMORY
	settings = {--MEMPERC GRAPH
		value=tonumber(conky_parse("${memperc}")),
		value_max=100            ,
		x=xp                     , y=256                       ,
		graph_radius=28          ,
		graph_thickness=15       ,
		graph_start_angle=180    ,
		graph_unit_angle=1.85    , graph_unit_thickness=2.7    ,
		graph_bg_colour=bgc      , graph_bg_alpha=bga          ,
		graph_fg_colour=fgc      , graph_fg_alpha=fga          ,
		hand_fg_colour=fgc       , hand_fg_alpha=0.0           ,
		txt_radius=35            ,
		txt_weight=1             , txt_size=8.0                ,
		txt_fg_colour=fgc        , txt_fg_alpha=0.0            ,
		graduation_radius=22     ,
		graduation_thickness=0   , graduation_mark_thickness=2 ,
		graduation_unit_angle=27 ,
		graduation_fg_colour=fgc , graduation_fg_alpha=0.5     ,
		caption=''               ,
		caption_weight=1         , caption_size=10.0           ,
		caption_fg_colour=fgc    , caption_fg_alpha=fga        ,
	};draw_gauge_ring(settings)

	-- SWAP
	if swap == "on" then
		yp = yp + 64
		settings = {--SWAP FILESYSTEM USED GRAPH
			value=tonumber(conky_parse("${swapperc}")),
			value_max=100            ,
			x=xp                     , y=352                        ,
			graph_radius=28          ,
			graph_thickness=15       ,
			graph_start_angle=180    ,
			graph_unit_angle=1.85    , graph_unit_thickness=2.7    ,
			graph_bg_colour=bgc      , graph_bg_alpha=bga          ,
			graph_fg_colour=fgc      , graph_fg_alpha=fga          ,
			hand_fg_colour=fgc       , hand_fg_alpha=0.0           ,
			txt_radius=35            ,
			txt_weight=1             , txt_size=8.0                ,
			txt_fg_colour=fgc        , txt_fg_alpha=0              ,
			graduation_radius=22     ,
			graduation_thickness=0   , graduation_mark_thickness=2 ,
			graduation_unit_angle=27 ,
			graduation_fg_colour=fgc , graduation_fg_alpha=0.5     ,
			caption=''               ,
			caption_weight=1         , caption_size=10.0           ,
			caption_fg_colour=fgc    , caption_fg_alpha=fga        ,
		};draw_gauge_ring(settings)
	end

	-- CLOCK
	if clock_theme == "cairo" then
		yp = yp + 64
		settings = {--CLOCK HANDS
			xc = 154          ,
			yc = yp           ,
			colour = bgc      ,
			alpha = 1         ,
			show_secs = false ,
			size = 30         ,
		};clock_hands(settings)
		settings = {--SECONDS
			value=tonumber(conky_parse("${time %S}")),
			value_max = 60  ,
			x = 154         , y = yp          ,
			bg_colour = bgc , bg_alpha = bga  ,
			fg_colour = fgc , fg_alpha = fga  ,
			radius =20      , thickness = 5   ,
			start_angle = 0 , end_angle = 360 ,
			lr = 0          ,
		};draw_ring(settings)
	elseif clock_theme == "bigcairo" then
		yp = yp + 64 + 20
		settings = {--CLOCK HANDS
			xc = 100         ,
			yc = 450          ,
			colour = bgc     ,
			alpha = 1        ,
			show_secs = true ,
			size = 60        ,
		};clock_hands(settings)
		settings = {--DAYS
			value=tonumber(conky_parse("${time %d}")),
			value_max = 31    ,
			x = 100           , y = 450          ,
			bg_colour = bgc   , bg_alpha = bga  ,
			fg_colour = fgc   , fg_alpha = fga  ,
			radius =50        , thickness = 0   ,
			start_angle = 215 , end_angle = 325 ,
			lr = 0            ,
		};draw_ring(settings)
		settings = {--MONTHS
			value=tonumber(conky_parse("${time %m}")),
			value_max = 12   ,
			x = 100          , y = 450          ,
			bg_colour = bgc  , bg_alpha = bga  ,
			fg_colour = fgc  , fg_alpha = fga  ,
			radius = 50      , thickness = 0   ,
			start_angle = 35 , end_angle = 145 ,
			lr = 0           ,
		};draw_ring(settings)
		settings = {--SECONDS
			value=tonumber(conky_parse("${time %S}")),
			value_max = 60  ,
			x = 100         , y = 450          ,
			bg_colour = bgc , bg_alpha = bga  ,
			fg_colour = fgc , fg_alpha = fga  ,
			radius =40      , thickness = 10  ,
			start_angle = 0 , end_angle = 360 ,
			lr = 0          ,
		};draw_ring(settings)
		yp = yp + 22
	end

	yp = yp + 64
	-- DISKS
	disks = {'/', '/home'}
	for i, partitions in ipairs(disks) do
		settings = {--FILESYSTEM USED GRAPH
			value=tonumber(conky_parse("${fs_used_perc " .. partitions .. "}")),
			value_max=100            ,
			x=xp                     , y=yp + 90                        ,
			graph_radius=28          ,
			graph_thickness=15       ,
			graph_start_angle=180    ,
			graph_unit_angle=1.85    , graph_unit_thickness=2.7    ,
			graph_bg_colour=bgc      , graph_bg_alpha=bga          ,
			graph_fg_colour=fgc      , graph_fg_alpha=fga          ,
			hand_fg_colour=fgc       , hand_fg_alpha=0.0           ,
			txt_radius=35            ,
			txt_weight=1             , txt_size=8.0                ,
			txt_fg_colour=fgc        , txt_fg_alpha=0              ,
			graduation_radius=23     ,
			graduation_thickness=0   , graduation_mark_thickness=2 ,
			graduation_unit_angle=27 ,
			graduation_fg_colour=fgc , graduation_fg_alpha=0.5     ,
			caption=''               ,
			caption_weight=1         , caption_size=10.0           ,
			caption_fg_colour=fgc    , caption_fg_alpha=fga        ,
		};draw_gauge_ring(settings)
		yp = yp + 95
	end

	-- PLAYERS
	if player == "Banshee" or player == "Clementine" or player == "Rhythmbox" then
		if player_theme == "cairo" then
			settings = {
				value=get_music_percent(player) ,
				value_max = 100   ,
				x = 154           , y = yp          ,
				bg_colour = bgc   , bg_alpha = bga  ,
				fg_colour = theme , fg_alpha = fga  ,
				radius =10        , thickness = 20  ,
				start_angle = 0   , end_angle = 360 ,
				lr = 0            ,
			};draw_ring(settings)
			settings = {
				value=get_music_percent(player),
				value_max = 100 ,
				x = 154         , y = yp          ,
				bg_colour = bgc , bg_alpha = 0.4  ,
				fg_colour = fgc , fg_alpha = 0.2  ,
				radius =20      , thickness = 1   ,
				start_angle = 0 , end_angle = 360 ,
				lr = 0          ,
			};draw_ring(settings)
		elseif player_theme == "cairocover" then
			settings = {
				value=get_music_percent(player),
				value_max = 100   ,
				x = 80           , y = yp + 165       ,
				bg_colour = bgc   , bg_alpha = 0.4  ,
				fg_colour = theme , fg_alpha = 1    ,
				radius =10         , thickness = 12  ,
				start_angle = 0   , end_angle = 360 ,
				lr = 0            ,
			};draw_ring(settings)
			settings = {
				value=get_music_percent(player),
				value_max = 100 ,
				x = 80         , y = yp + 165       ,
				bg_colour = bgc , bg_alpha = 0.6  ,
				fg_colour = fgc , fg_alpha = 0.2  ,
				radius =22      , thickness = 5   ,
				start_angle = 0 , end_angle = 360 ,
				lr = 0          ,
			};draw_ring(settings)
		else
		settings = {--PLAYERS
			value=get_music_percent(player),
			value_max=100            ,
			x=xp                     , y=yp                        ,
			graph_radius=20          ,
			graph_thickness=10       ,
			graph_start_angle=180    ,
			graph_unit_angle=1.85    , graph_unit_thickness=2.7    ,
			graph_bg_colour=bgc      , graph_bg_alpha=bga          ,
			graph_fg_colour=fgc      , graph_fg_alpha=fga          ,
			hand_fg_colour=fgc       , hand_fg_alpha=0.0           ,
			txt_radius=35            ,
			txt_weight=1             , txt_size=8.0                ,
			txt_fg_colour=fgc        , txt_fg_alpha=0              ,
			graduation_radius=23     ,
			graduation_thickness=0   , graduation_mark_thickness=2 ,
			graduation_unit_angle=27 ,
			graduation_fg_colour=fgc , graduation_fg_alpha=0.5     ,
			caption=''               ,
			caption_weight=1         , caption_size=10.0           ,
			caption_fg_colour=fgc    , caption_fg_alpha=fga        ,
		};draw_gauge_ring(settings)
		end
	end

	end-- if updates>5
	cairo_destroy(cr)
	cairo_surface_destroy(cs)
	cr=nil
end-- end main function

Enregistrer le fichier, le fermer, puis éditer le fichier conkyrc qui se trouve dans /home, puis faire CTRL+H pour afficher les dossiers cachés, et ouvrir le dossier .conkycolors et ouvrir conkyrc, et l'éditer tel que :

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

imlib_cache_size 0
double_buffer yes
no_buffers yes

format_human_readable

#####################
# - Text settings - #
#####################
use_xft yes
xftfont Ubuntu:size=12
override_utf8_locale yes
text_buffer_size 2048

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



alignment bottom_right
gap_x 0
gap_y 40
minimum_size 182 0
maximum_width 182

default_bar_size 40 8

#########################
# - Graphics settings - #
#########################
draw_shades yes

default_color E2DACB

color0 F0EBE2
color1 77216F
color2 E6E6E6 # Blanc
color3 2C001E
color4 FF9933 # Jaune ocre
color5 99CCFF # Bleu pastel
color6 FF6699 # rose-vermillon pastel


lua_load /usr/share/conkycolors/scripts/conkyCairo.lua
lua_draw_hook_post conky_main white 77216F 2 on bigcairo Rhythmbox cairocover off 0

TEXT
${voffset 10}
##############
# - SYSTEM - #
##############
# |--CPU
${goto 35}${font Ubuntu:style=Bold:size=12}${color2}${freq_g 1}${color} GHZ${font}
${goto 35}CPU1: ${font Ubuntu:style=Bold:size=12}${color5}${cpu cpu1}%${color}${font}
${goto 35}Temp: ${font Ubuntu:style=Bold:size=12}${color4}${execi 30 sensors | grep 'Core 0' |awk '{print $3}' | sed 's/+//' | sed 's/\.0//g'}${color}${font}
${voffset 10}
${goto 35}${font Ubuntu:style=Bold:size=12}${color2}${freq_g 2}${color} GHZ${font}
${goto 35}CPU2: ${font Ubuntu:style=Bold:size=12}${color5}${cpu cpu2}%${color}${font}
${goto 35}Temp: ${font Ubuntu:style=Bold:size=12}${color4}${execi 30 sensors | grep 'Core 1' |awk '{print $3}' | sed 's/+//' | sed 's/\.0//g'}${color}${font}
# |--MEM
${voffset 10}
${goto 35}RAM: ${font Ubuntu:style=Bold:size=12}${color5}$memperc%${color}${font}
${goto 35}Free: ${font Ubuntu:style=Bold:size=12}${color2}${memeasyfree}${color}${font}
${goto 35}Used: ${font Ubuntu:style=Bold:size=12}${color2}${mem}${color}${font}
# |--SWAP
${voffset 10}
${goto 35}SWAP: ${font Ubuntu:style=Bold:size=12}${color5}$swapperc%${color}${font}
${goto 35}Free: ${font Ubuntu:style=Bold:size=12}${color2}${swapmax}${color}${font}
${goto 35}Used: ${font Ubuntu:style=Bold:size=12}${color2}${swap}${color}${font}
#############
# - CLOCK - #
#############
${voffset 92}
##########
# - HD - #
##########
${voffset 15}
${goto 35}Root: ${font Ubuntu:style=Bold:size=12}${color5}${fs_free_perc /}%${color}${font}
${goto 35}Free: ${font Ubuntu:style=Bold:size=12}${color2}${fs_free /}${color}${font}
${goto 35}Used: ${font Ubuntu:style=Bold:size=12}${color2}${fs_used /}${color}${font}
${voffset 15}
${goto 35}Home: ${font Ubuntu:style=Bold:size=12}${color5}${fs_free_perc /home}%${color}${font}
${goto 35}Free: ${font Ubuntu:style=Bold:size=12}${color2}${fs_free /home}${color}${font}
${goto 35}Used: ${font Ubuntu:style=Bold:size=12}${color2}${fs_used /home}${color}${font}
####################
# - MEDIA PLAYER - #
####################
${voffset 0}
${execi 6 /home/yoannj/.conkycolors/bin/conkyCover}${execpi 10 /usr/share/conkycolors/bin/conkyRhythmbox -t /home/yoannj/.conkycolors/templates/conkyPlayer.template}${voffset -10}
###############
# - NETWORK - #
###############
${voffset 4}
# |--WLAN0
${if_up wlan0}
${goto 35}Up: ${font Ubuntu:style=Bold:size=12}${color5}${upspeed wlan0}${color}${font}
${goto 40}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totalup wlan0}${color}${font}
${goto 35}Down: ${font Ubuntu:style=Bold:size=12}${color5}${downspeed wlan0}${color}${font}
${goto 40}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totaldown wlan0}${color}${font}
${goto 35}Signal: ${font Ubuntu:style=Bold:size=12}${color4}${wireless_link_qual wlan0}%${color}${font}
# |--ETH0
${else}${if_up eth0}
${goto 35}Up: ${font Ubuntu:style=Bold:size=12}${color5}${upspeed eth0}${color}${font}
${goto 40}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totalup eth0}${color}${font}
${goto 35}Down: ${font Ubuntu:style=Bold:size=12}${color5}${downspeed eth0}${color}${font}
${goto 40}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totaldown eth0}${color}${font}
# |--PPP0
${else}${if_up ppp0}
${goto 35}Up: ${font Ubuntu:style=Bold:size=12}${color5}${upspeed ppp0}${color}${font}
${goto 40}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totalup ppp0}${color}${font}
${goto 35}Down: ${font Ubuntu:style=Bold:size=12}${color5}${downspeed ppp0}${color}${font}
${goto 40}Total: ${font Ubuntu:style=Bold:size=8}${color2}${totaldown ppp0}${color}${font}
${endif}${endif}${endif}

Enfin taper à deux reprises CTRL+S (une fois pour enregistrer le fichier, une seconde fois pour relancer le conky avec les nouveaux paramètres).

modération: merci de mettre des miniatures ou les liens

Dernière modification par ljere (Le 29/08/2012, à 19:52)

Hors ligne