[Conky] Vos .conkyrc !

Ce qui ne concerne ni le forum ni des problèmes
Avatar de l’utilisateur
acid_cloridrix
archer
Messages : 117
Inscription : mer. 17 oct. 2012, 15:18

Re: [Conky] Vos .conkyrc !

Message par acid_cloridrix »

Je touche pas un mot en english donc il me serait difficile d'expliquer clairement ce que je ne comprend que très intuitivement. (et par crainte de dire des con...ries) :mrgreen: :mrgreen:

man conky??

Tu peux réduire la valeur à 512 je pense.
HP 500-261ef full 64 bits - Samsung 24 pcs 1920x1080 px
CPU : 4 X Intel ® Core™ i5-4440 @ 3.1 Ghz | RAM : 8 Go
HD : Western Digital 1 To | CG Radeon R5 235


Multiboot UEFI : ArchLinux - Windows 7 - Autre base Debian

Openbox (LXqt)
KDE Plasma 5
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Alors a priori text_buffer_size correspondrai a la quantité de caractère affichable
Vivre libre ou mourir
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Nouveau probleme au niveau de lm_sensor et de mon amd A8-5600k. Lorsque je fait

Code : Tout sélectionner

[punky@HTPC ~]$ sensors
k10temp-pci-00c3
Adapter: PCI adapter
temp1:        +15.4°C  (high = +70.0°C)
                       (crit = +70.0°C, hyst = +69.0°C)

jc42-i2c-0-1a
Adapter: SMBus PIIX4 adapter at 0b00
temp1:        +42.0°C  (low  =  +0.0°C)                  ALARM (HIGH, CRIT)
                       (high =  +0.0°C, hyst =  +0.0°C)
                       (crit =  +0.0°C, hyst =  +0.0°C)

jc42-i2c-0-1b
Adapter: SMBus PIIX4 adapter at 0b00
temp1:        +44.3°C  (low  =  +0.0°C)                  ALARM (HIGH, CRIT)
                       (high =  +0.0°C, hyst =  +0.0°C)
                       (crit =  +0.0°C, hyst =  +0.0°C) 

Si j'interprete comme il faut, la 1ere température serait celle de la carte mere est les deux quisuivent le core 1 et le core 2.
Deux soucis se présente 2 core de present mais mon processeur est un 4core.
Deuxiement comment demander a conky d'aller chercher les bonne info pour afficher lers température a savoir que j'utilise cette commande

Code : Tout sélectionner

${offset 65}${font Santana:size=10}Température CPU ${exec sensors | sed '/temp1/!d ; s/^.*  +\|  .*$//g'}
Merci d'avance
Vivre libre ou mourir
Avatar de l’utilisateur
acid_cloridrix
archer
Messages : 117
Inscription : mer. 17 oct. 2012, 15:18

Re: [Conky] Vos .conkyrc !

Message par acid_cloridrix »

Pourquoi pas:

Code : Tout sélectionner

${hwmon 1 temp 2}
${hwmon 1 temp 3}
etc...
? (à adapter selon ton matériel)

Je n'utilise pas lm-sensors, seulement hddtemp pour mon hdd.
HP 500-261ef full 64 bits - Samsung 24 pcs 1920x1080 px
CPU : 4 X Intel ® Core™ i5-4440 @ 3.1 Ghz | RAM : 8 Go
HD : Western Digital 1 To | CG Radeon R5 235


Multiboot UEFI : ArchLinux - Windows 7 - Autre base Debian

Openbox (LXqt)
KDE Plasma 5
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Ca semble fonctionner. Mais comment savoir a quel materiel correspond hwmon 1 temp 1 ?
Vivre libre ou mourir
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Ah ca commence a ressembler a quelque chose se petit bureau compiz + conky. Encore quelque détail a arranger. Entre autre comment faire pour que mes fs_bar soit en dégradé plutôt que d'une seule couleur? Et puis j'aimerais bien utiliser la couche widget de compiz mais n'arrive pas a mettre mes conky dessus quelqu'un sait comment? J'ai pourtant activer la couche widget ainsi que mis class=conky. je post mon conkyrc (celui de gauche les autres n'etant que des scripts repris de droite et de gauche). Un grand merci a acid_cloridrix pour son aide ainsi qu'au divers forum et tuto consulté

Code : Tout sélectionner

######################
# - Conky settings - #
######################
background no
update_interval 1
  
cpu_avg_samples 2
net_avg_samples 2
use_spacer none
override_utf8_locale yes
  
double_buffer yes
no_buffers yes
  
text_buffer_size 2048
imlib_cache_size 0
  
#############################
# - Window specifications - #
#############################
own_window_class Conky
own_window yes
own_window_type normal
own_window_argb_visual yes
own_window_argb_value 180
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
  
border_inner_margin 0
border_outer_margin 0
  
minimum_size 2500
maximum_width 500
 
alignment tl
gap_x 10
gap_y 10
	  
#########################
# - Graphics settings - #
#########################
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
  
#####################
# - Text settings - #
#####################
use_xft yes
xftfont Santana:size=12
xftalpha 0.8
uppercase no
	 
################
# - Couleurs - #
################
# default_color ffffff
default_color DBDBDB
color1 868686                #Blanc cassé
#color2 606060                #Gris
 
#Réglages système
cpu_avg_samples 1            #Nb d'échantillons pour calculer la moyenne d'utilisation CPU
net_avg_samples 2            #Nb d'échantillons pour calculer la moyenne d'utilisation CPU
  
################
# - LUA Load - #
################
lua_load ~/.bin/conky/cpufreq.lua
 
 
############
# - Code - #
############
TEXT
${image ~/.bin/conky/images/cpu04.png 100x100}
        




	

	

${font Santana:size=12:style=Bold}AMD A8-5600k
${font Santana:size=12}Ondemand ${lua cpu_freq_g 0} GHz | Max. ${lua cpu_freq_max_g 0}${font Santana:size=12} GHz | ${font Santana:size=12}Actuel ${freq} MHz

Uptime : $uptime

Fréquence CPU 1: ${freq 1} ${alignr}Fréquence CPU 2: ${freq 2}
Fréquence CPU 3: ${freq 3} ${alignr}Fréquence CPU 4: ${freq 4}

CPU : $color${hwmon 2 temp 1}°C ${color2}${goto 200} M/B : $color${hwmon 1 temp 1}°C${color2}${alignr} GPU : ${execi 30 aticonfig --od-gettemperature | grep Temperature | cut -c43-47}°C

GPU : ${execi 30 aticonfig --odgc| grep GPU  | cut -c31-34}${alignr} CPU : ${cpu}%
RAM : $mem/$memmax - $memperc% 

${font Santana:size=12:style=Bold}File Systems : ${hr}${font}$color
/     ${fs_used /}  / ${fs_size /} ${alignc}${fs_bar /}
~   ${fs_used /home/punky/}/${fs_size 
/home/punky }${alignc}${fs_bar /home/punky/}

${font Santana:size=12:style=Bold}Réseau :${hr}${font}$color

${offset 15}Download : ${color}${downspeed enp1s0}  ${color}${alignr}Uploads : ${color}${upspeed enp1s0}
${offset 15}${downspeedgraph enp1s0 25,235 00E7FF D000FF}   ${upspeedgraph enp1s0 25,235 00E7FF D000FF}

${offset 15}${color}IP Public:${color1}${texeci 3600 wget http://checkip.dyndns.org -O - -o /dev/null | cut -d : -f 2 | cut -d \< -f 1}
${offset 15}${color}IP Local : ${color1}${addr enp1s0} 
${offset 15}${color}TCP Connections :  ${color1}${tcp_portmon 1 65535 count}
Encore deux petite chose j'ai essayé en vain de placer le fond de mon htc-meteo sous mon conky de droite pour des raison de visibilité puisque lorsqu'il fait jour aux etats-unis je ne vois plus grand chose de ce qui y est ecris, mais lorsque je le fait l'image est totalement transparente. Et si quelqu'un connait un script permettant d'afficher les info d'amarok si possible avec pochette ceux que j'ai testé ne fonctionne pas.

Image
Vivre libre ou mourir
Avatar de l’utilisateur
acid_cloridrix
archer
Messages : 117
Inscription : mer. 17 oct. 2012, 15:18

Re: [Conky] Vos .conkyrc !

Message par acid_cloridrix »

Pour les fs_bar, il n'est pas possible à ma connaissance de faire un dégradé :| (sinon je l'aurais fait :mrgreen: ) mais j'ai déjà croisé quelque part des scripts lua permettant d'obtenir ce genre de chose en forme de barrettes verticales, 'va falloir gogoliser :)
KorteX39 a écrit : j'ai essayé en vain de placer le fond de mon htc-meteo sous mon conky de droite pour des raison de visibilité puisque lorsqu'il fait jour aux etats-unis je ne vois plus grand chose
J'ai pas très bien compris mais tu dois parler des effets d'ombre de chaque côtés de ton écran que tu aimerais dégommer ??

Il faut trifouiller, je pense, là-dedans:

Code : Tout sélectionner

own_window_class Conky
own_window yes
own_window_type normal
own_window_argb_visual yes
own_window_argb_value 180
own_window_transparent yes
Je commencerais par commenter own_window_argb_visual yes et own_window_argb_value 180...

Faut tester, pour le reste aucune idée, pas de compiz chez moi.

EDIT: tu devrais aller faire un tour par ici http://conky.pitstop.free.fr/wiki/index ... s_%28fr%29 peut-être y trouveras-tu des choses intéressantes.

Sinon l'ouverture d'un sujet serait peut-être préférable pour ne pas gâcher la lisibilité de celui-ci...
HP 500-261ef full 64 bits - Samsung 24 pcs 1920x1080 px
CPU : 4 X Intel ® Core™ i5-4440 @ 3.1 Ghz | RAM : 8 Go
HD : Western Digital 1 To | CG Radeon R5 235


Multiboot UEFI : ArchLinux - Windows 7 - Autre base Debian

Openbox (LXqt)
KDE Plasma 5
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Pour ce qui est des effets d'ombre de chaque cotés acid_cloridrix , c'est voulu c'est une photo satelite en temps réel (ou presque) par satellite.
Pour temontrer voila l'image que j'ai a cette heure-ci.
Image
et voici le resultat que j'obtient.
Image
L'inconvenient c'est que quand c'est le jour aux etats unis je ne vois plus grand chose sur le conky je voulais donc mettre le meme fond que sur le conky tout fait qu'il y a en haut a droite celui avec l'heure et la météo mais je ne vois que la bordure de l'image l'image est elle toute transparente et je ne connais pas l'argument permettant de l'assombrir ( a noté que le probleme vient de conky puisque l'image afficher dans gwenview n'est pas transparent tout du moin pas a 100%) en gros il me faut un fond noir translucide et non transparent



P.S : Je n'avais pas vu que tu me conseillais de rouvrir un fil de discussion. Je m'en occupe en rentrant de course
Dernière modification par KorteX39 le mer. 26 mars 2014, 18:18, modifié 1 fois.
Vivre libre ou mourir
Tucnacek
Chu Ko Nu
Messages : 332
Inscription : sam. 28 sept. 2013, 22:40

Re: [Conky] Vos .conkyrc !

Message par Tucnacek »

Peut-être pourrais-tu nous fournir le fichier de configuration "d'en haut à droite" afin que l'on puisse y chercher la solution ?
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Voici le code du conky en haut a droite

Code : Tout sélectionner

# — Conky settings — #

background yes

update_interval 1
total_run_times 0
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0

temperature_unit celcius

# — Window specifications — #
own_window_class Conky
own_window yes
own_window_type normal
own_window_transparent yes
own_window_argb_visual yes
own_window_argb_value 180
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

border_inner_margin 0
border_outer_margin 0

minimum_size 275 275
maximum_width 275

alignment top_right

gap_x 25
gap_y 75


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

# — Text settings — #
use_xft yes
xftfont Ubuntu:size=8
xftalpha 1.0

default_color FFFFFF

uppercase no
use_spacer right

color0 white
color1 orange
color2 green


TEXT
${image $HOME/.conky/htc_home/images/base2.png -p 0,30 -s 260x145}${image $HOME/.conky/htc_home/images/base2.png -p 0,190 -s 260x45}${image $HOME/.conky/htc_home/images/flip_bg.png -p 30,10 -s 100x110}${image $HOME/.conky/htc_home/images/flip_bg.png -p 130,10 -s 100x110}
${execi 500 bash $HOME/.conky/htc_home/accuweather/accuw_script}
${voffset 7}${font Helvetica LT Std :style=Condensed:size=60}${color 434343}${goto 41}${time %H}${goto 142}${color 434343}${time %M}${voffset 34}${color whitesmoke}${font Helvetica LT Std :style=bold:size=9}${goto 175}${time %a}, ${time %e} ${time %b}
${font Helvetica LT Std :size=8}${color whitesmoke}${voffset -18}${goto 20}${execpi 600 sed -n '28p' $HOME/.conky/htc_home/accuweather/curr_cond}${voffset 12}${goto 20}${color grey}W:${color white}${execpi 600 sed -n '31p' $HOME/.conky/htc_home/accuweather/curr_cond}-${execpi 600 sed -n '32p' $HOME/.conky/htc_home/accuweather/curr_cond}${voffset 12}${goto 20}${color grey}H:${color white}${execpi 600 sed -n '33p' $HOME/.conky/htc_home/accuweather/curr_cond}${voffset 12}${goto 20}${color grey}P:${color white}${execpi 600 sed -n '34p' $HOME/.conky/htc_home/accuweather/curr_cond}${voffset -10}${goto 180}${font Helvetica LT Std :size=18}${execpi 600 sed -n '29p' $HOME/.conky/htc_home/accuweather/curr_cond}°${goto 214}${voffset -12}${font Helvetica LT Std :size=8}${color grey}H:${color white}${execpi 600 sed -n '3p' $HOME/.conky/htc_home/accuweather/first_days}°${goto 216}${voffset 11}${color grey}L:${color white}${execpi 600 sed -n '4p' $HOME/.conky/htc_home/accuweather/first_days}°
${voffset 49}${font Helvetica LT Std :size=8}${color white}${goto 25}${execpi 600 sed -n '8p' $HOME/.conky/htc_home/accuweather/first_days}°/${color grey}${execpi 600 sed -n '9p' $HOME/.onky/htc_home/accuweather/first_days}°${goto 72}${color white}${execpi 600 sed -n '13p' $HOME/.conky/htc_home/accuweather/first_days}°/${color grey}${execpi 600 sed -n '14p' $HOME/.conky/htc_home/accuweather/first_days}°${goto 118}${color white}${execpi 600 sed -n '18p' $HOME/.conky/htc_home/accuweather/first_days}°/${color grey}${execpi 600 sed -n '19p' $HOME/.conky/htc_home/accuweather/first_days}°${goto 162}${color white}${execpi 600 sed -n '23p' $HOME/.conky/htc_home/accuweather/first_days}°/${color grey}${execpi 600 sed -n '24p' $HOME/.conky/htc_home/accuweather/first_days}°${goto 207}${color white}${execpi 600 sed -n '4p' $HOME/.conky/htc_home/accuweather/last_days}°/${color grey}${execpi 600 sed -n '5p' $HOME/.conky/htc_home/accuweather/last_days}°
${voffset 1}${font Helvetica LT Std :size=8}${color whitesmoke}${goto 27}${execpi 600 sed -n '5p' $HOME/.conky/htc_home/accuweather/first_days}${goto 74}${execpi 600 sed -n '10p' $HOME/.conky/htc_home/accuweather/first_days}${goto 120}${execpi 600 sed -n '15p' $HOME/.conky/htc_home/accuweather/first_days}${goto 164}${execpi 600 sed -n '20p' $HOME/.conky/htc_home/accuweather/first_days}${goto 209}${execpi 600 sed -n '1p' $HOME/.conky/htc_home/accuweather/last_days}
${image $HOME/.conky/htc_home/accuweather/cc.png -p 70,95 -s 125x75}
${image $HOME/.conky/htc_home/accuweather/6.png -p 14,180 -s 48x29}${image $HOME/.conky/htc_home/accuweather/11.png -p 60,180 -s 48x29}${image $HOME/.conky/htc_home/accuweather/16.png -p 107,180 -s 48x29}${image $HOME/.conky/htc_home/accuweather/21.png -p 152,180 -s 48x29}${image $HOME/.conky/htc_home/accuweather/last_2.png -p 197,180 -s 48x29}
Vivre libre ou mourir
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Je commencerais par commenter own_window_argb_visual yes et own_window_argb_value 180...
Commenter ces deux ligne ne mene a rien j'ouvrirai un autre post demain la je n'ai malheureusement pas le temps de m'en occuper a moins qu'un moderateur veuille bien transferer la discussion dans un autre fil.
Vivre libre ou mourir
Avatar de l’utilisateur
acid_cloridrix
archer
Messages : 117
Inscription : mer. 17 oct. 2012, 15:18

Re: [Conky] Vos .conkyrc !

Message par acid_cloridrix »

Bien sûr que ça ne mene à rien puisque je t'ai répondu dans l'erreur n'ayant pas pigé sur le moment ce que tu demandais...
HP 500-261ef full 64 bits - Samsung 24 pcs 1920x1080 px
CPU : 4 X Intel ® Core™ i5-4440 @ 3.1 Ghz | RAM : 8 Go
HD : Western Digital 1 To | CG Radeon R5 235


Multiboot UEFI : ArchLinux - Windows 7 - Autre base Debian

Openbox (LXqt)
KDE Plasma 5
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Bien ton site acid_cloridrix merci. J'etais tombé dessus lors de mes conkyperigrination mais la page c'est noyé dans le nombre de page ouverte sur mon pc. J'ai pu y trouvé pas mal de chose qui reponde aux question que j'ai posé ici.
Vivre libre ou mourir
Avatar de l’utilisateur
KorteX39
Daikyu
Messages : 80
Inscription : mer. 12 mars 2014, 15:56

Re: [Conky] Vos .conkyrc !

Message par KorteX39 »

Alors voila j'ai rouvert deux sujet pour mes deux problemes decris plus haut pour ceux qui veulent suivre et eventuellement me donner des piste c'est ici que ca ce passe
http://forums.archlinux.fr/topic15164.html
http://forums.archlinux.fr/topic15163.html
Vivre libre ou mourir
Avatar de l’utilisateur
acid_cloridrix
archer
Messages : 117
Inscription : mer. 17 oct. 2012, 15:18

Re: [Conky] Vos .conkyrc !

Message par acid_cloridrix »

À la demande de Onyx67 je mets ici mon conkyrc

Image

conky_plasma_draw_dark :

Code : Tout sélectionner

background yes
use_xft yes
xftfont Sans:regular:size=8
xftalpha 1
update_interval 1
total_run_times 0
# own_window_colour ffffff
own_window yes
own_window_transparent yes
own_window_type dock
own_window_hints undecorated,below,sticky,skip_taskbar
double_buffer yes
own_window_argb_visual yes
# own_window_argb_value 0
minimum_size 475 989
maximum_width 1920
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_shade_color e0dfde
default_outline_color e0dfde
alignment tl
gap_x 25
gap_y 60
no_buffers yes
uppercase min
cpu_avg_samples 2
override_utf8_locale yes

text_buffer_size 4096
imlib_cache_size 0

default_color 000000

color1 5A5A5A # gris foncé
color2 1793D1 # bleu
color3 ed7f10 # orange
color4 BEBEBE # gris clair
color5 3DAEE6 # bleu clair
color6 00C000 # vert
color7 FF0000 # rouge

# -- Lua Load -- #
# SET THE PATH TO THE SCRIPT HERE
lua_load ~/.conky/draw_plasma_dark.lua
lua_draw_hook_pre main_box

TEXT
draw_plasma_dark.lua :

Code : Tout sélectionner

require 'cairo'
    
function conky_main_box()

    if conky_window==nil then return end
    
	---------------------- PARAMETERS BEGIN HERE
    local boxes_settings={

        {x=2, y=2,w=483,h=168,
        corners={ {"circle",5},},
        colour={ {0,0x2c2f3d,0.80} },
        },
        {x=112, y=25,w=354,h=2,
        colour={ {0,0x377c9e,1} },
        },
        ------------------------------
	{x=2, y=183,w=483,h=100,
        corners={ {"circle",5},},
        colour={ {0,0x2c2f3d,0.80} },
        },
        {x=114, y=207,w=356,h=2,
        colour={ {0,0x377c9e,1} },
        },
        {x=16, y=241,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
        {x=16, y=268,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
	------------------------------
        {x=2, y=295,w=483,h=180,
        corners={ {"circle",5},},
        colour={ {0,0x2c2f3d,0.80} },
        },
        {x=136, y=317,w=334,h=2,
        colour={ {0,0x377c9e,1} },
        },
        {x=16, y=351,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
        {x=16, y=378,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
        {x=16, y=405,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
        {x=16, y=432,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
        {x=16, y=459,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
	------------------------------
        {x=2, y=487,w=483,h=148,
        corners={ {"circle",5},},
        colour={ {0,0x2c2f3d,0.80} },
        },
        {x=214, y=508,w=256,h=2,
        colour={ {0,0x377c9e,1} },
        },
        {x=16, y=540,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
	------------------------------
        {x=2, y=647,w=483,h=128,
        corners={ {"circle",5},},
        colour={ {0,0x2c2f3d,0.80} },
        },
        {x=98, y=671,w=372,h=2,
        colour={ {0,0x377c9e,1} },
        },
        {x=16, y=705,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
        {x=16, y=732,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
        {x=16, y=759,w=454,h=1,
        colour={ {0,0x4C4C4C,1} },
        },
	------------------------------
        {x=2, y=787,w=483,h=212,
        corners={ {"circle",5},},
        colour={ {0,0x2c2f3d,0.80} },
        },
        {x=303, y=808,w=167,h=2,
        colour={ {0,0x377c9e,1} },
        },
    }

    ---------------------------- PARAMETERS END HERE
    
    local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local cr=cairo_create(cs)
    
    if tonumber(conky_parse("$updates"))<5 then return end
    for i in pairs(boxes_settings) do
        draw_box (cr,boxes_settings[i])
    end
    cairo_destroy(cr)
    cairo_surface_destroy(cs)    
end

    
function draw_box(cr,t)

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

    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(t)
      local t2 = {}
      for k,v in pairs(t) 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 t.x == nil then t.x = 0 end
    if t.y == nil then t.y = 0 end
    if t.w == nil then t.w = conky_window.width end
    if t.h == nil then t.h = conky_window.height end
    if t.radius == nil then t.radius = 0 end
    if t.border == nil then t.border = 0 end
    if t.colour==nil then t.colour={{1,0xFFFFFF,0.5}} end
    if t.linear_gradient ~= nil then 
        if #t.linear_gradient ~= 4 then
            t.linear_gradient = {t.x,t.y,t.width,t.height}
        end
    end 
    if t.angle==nil then t.angle = 0 end

	if t.skew_x == nil then t.skew_x=0  end
	if t.skew_y == nil then  t.skew_y=0 end
	if t.scale_x==nil then t.scale_x=1 end
	if t.scale_y==nil then t.scale_y=1 end	
	if t.rot_x == nil then t.rot_x=0  end
	if t.rot_y == nil then  t.rot_y=0 end
    
    if t.operator == nil then t.operator = "over" end
    if (t_operators[t.operator]) == nil then
        print ("wrong operator :",t.operator)
        t.operator = "over"
    end
    
    if t.radial_gradient ~= nil then 
        if #t.radial_gradient ~= 6 then
            t.radial_gradient = {t.x,t.y,0, t.x,t.y, t.width}
        end
    end 
    
    for i=1, #t.colour do    
        if #t.colour[i]~=3 then 
            print ("error in color table")
            t.colour[i]={1,0xFFFFFF,1} 
        end
    end

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

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

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

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

    cairo_save(cr)
    cairo_translate(cr, t.x, t.y)
    if t.rot_x~=0 or t.rot_y~=0 or t.angle~=0 then
        cairo_translate(cr,t.rot_x,t.rot_y)
        cairo_rotate(cr,t.angle*math.pi/180)
        cairo_translate(cr,-t.rot_x,-t.rot_y)
    end
    if t.scale_x~=1 or t.scale_y~=1 or t.skew_x~=0 or t.skew_y~=0 then
	    local matrix0 = cairo_matrix_t:create()
	    tolua.takeownership(matrix0)
	    cairo_matrix_init (matrix0, t.scale_x,math.pi*t.skew_y/180	, math.pi*t.skew_x/180	,t.scale_y,0,0)
	    cairo_transform(cr,matrix0)    
    end
    
    local tc=t_corners
    cairo_move_to(cr,tc[1][2],0)
    cairo_line_to(cr,t.w-tc[2][2],0)
    draw_corner(2,tc[2])
    cairo_line_to(cr,t.w,t.h-tc[3][2])
    draw_corner(3,tc[3])
    cairo_line_to(cr,tc[4][2],t.h)
    draw_corner(4,tc[4])
    cairo_line_to(cr,0,tc[1][2])
    draw_corner(1,tc[1])
    
    if t.no_gradient then
        cairo_set_source_rgba(cr,rgba_to_r_g_b_a(t.colour[1]))
    else
        if t.linear_gradient ~= nil then
            pat = cairo_pattern_create_linear (t.linear_gradient[1],t.linear_gradient[2],t.linear_gradient[3],t.linear_gradient[4])
        elseif t.radial_gradient ~= nil then
            pat = cairo_pattern_create_radial (t.radial_gradient[1],t.radial_gradient[2],t.radial_gradient[3],
            	t.radial_gradient[4],t.radial_gradient[5],t.radial_gradient[6])
        end
        for i=1, #t.colour do
            cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgba_to_r_g_b_a(t.colour[i]))
        end
        cairo_set_source (cr, pat)
        cairo_pattern_destroy(pat)
    end 
     
    cairo_set_operator(cr,t_operators[t.operator]) 

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

    cairo_restore(cr)
end
conky_plasma_dark :

Code : Tout sélectionner

background yes
use_xft yes
xftfont Sans:regular:size=8
xftalpha 1
update_interval 1
total_run_times 0
# own_window_colour ffffff
own_window yes
own_window_transparent yes
own_window_type dock
own_window_hints undecorated,below,sticky,skip_taskbar
double_buffer yes
own_window_argb_visual yes
# own_window_argb_value 0
minimum_size 475 185
maximum_width 1920
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_shade_color e0dfde
default_outline_color e0dfde
alignment tl
gap_x 25
gap_y 60
no_buffers yes
uppercase min
cpu_avg_samples 2
override_utf8_locale yes
default_bar_size 453 6

text_buffer_size 4096
imlib_cache_size 0

default_color EDEEEF

color1 909090 # gris foncé
color2 377c9e # 1793D1 # bleu
color3 ed7f10 # orange
color4 BEBEBE # gris clair
color5 377C9E # bleu clair
color6 428d3b # vert
color7 FF0000 # rouge

# -- Lua Load -- #
# SET THE PATH TO THE SCRIPT HERE
lua_load ~/.conky/graph_plasma_dark.lua
lua_draw_hook_pre main_graph

TEXT
##########################################################################   SYSTÈME   ######################################################################################
#
${font Sans :regular:size=14}${color1}${goto 20}${voffset 5}Système${font}${color2}

${font Sans :bold:size=8}${goto 18}${texeci 3000 users | cut -c1-7}@${nodename}${alignr 13}${uptime}${font}

${color}${goto 18}Version de KDE Plasma${goto 210}:${alignr 13}${texeci 3000 yaourt -Q plasma-desktop | cut -d " " -f 2} \
(${texeci 3000 yaourt -Q plasma-desktop | cut -d / -f 1})${font}
${goto 18}Version de QT${goto 210}:${alignr 13}${texeci 3000 yaourt -Q qt5-base | cut -d " " -f 2} \
(${texeci 3000 yaourt -Q qt5-base | cut -d / -f 1})${font}

${font Sans :bold:size=8}${color2}${goto 18}Version de noyau (démarré)${alignr 13}linux ${texeci 5 uname -r} (${texeci 5 head -n1 ~/.cache/kernel | cut -f 1 -d "/"})
${color}${goto 18}Autre noyau disponible${alignr 13}${texeci 5 tail -n1 ~/.cache/kernel | cut -f 2 -d "/"} (${texeci 5 tail -n1 ~/.cache/kernel | cut -f 1 -d "/"})

#Température GPU${goto 120}:${color3}${alignr}${acpitemp} °C
#
${font}${goto 18}MAJ(s) disponible(s)${font}${goto 210}:\
${font Sans :bold:size=8}${if_match ${texeci 30 cat ~/.cache/nb_majs}>0}\
${color3}${alignr 9}${texeci 600 cat ~/.cache/nb_majs}\
${else}${color6}${alignr 13}Système à jour${endif}

##########################################################################   MÉMOIRE   ######################################################################################

${font Sans :regular:size=14}${color1}${goto 20}${voffset 5}Mémoire${font}${color2}${color}

${font Sans :bold:size=8}${goto 18}RAM${font}${goto 65}:
${voffset -13}${alignc}${mem} / ${memmax}
${voffset -13}${alignr 13}${memperc} %
${color4}${voffset -6}${color}

${font Sans :bold:size=8}${goto 18}${voffset -6}SWAP${font}${goto 65}:
${voffset -13}${alignc}${swap} / ${swapmax}
${voffset -13}${alignr 13}${swapperc} %
${color4}${voffset -6}${color}

########################################################################   PROCESSEUR   #####################################################################################

${font Sans :regular:size=14}${color1}${goto 20}${voffset 3}Processeur${font}${color2}${color}

${font Sans:bold:size=8}${color2}${goto 18}${texeci 3000 cat /proc/cpuinfo | grep 'model name' | head -n1 | sed -e 's/model name.*: //' | cut -c 1-25}\
${font}${goto 210}:${font Sans :bold:size=8}${alignr 13}${freq_g cpu} GHz${font}
${color4}${voffset -6}${color}

${if_existing /sys/class/hwmon/hwmon0/temp5_input}\
${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu1
${font}${voffset -13}${alignc}${hwmon 0 temp 2} °C
${voffset -13}${alignr 13}${cpu cpu1} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu2
${font}${voffset -13}${alignc}${hwmon 0 temp 3} °C
${voffset -13}${alignr 13}${cpu cpu2} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu3
${font}${voffset -13}${alignc}${hwmon 0 temp 4} °C
${voffset -13}${alignr 13}${cpu cpu3} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu4
${font}${voffset -13}${alignc}${hwmon 0 temp 5} °C
${voffset -13}${alignr 13}${cpu cpu4} %
${color4}${voffset -6}${endif}
#
${voffset -13}\
${if_existing /sys/class/hwmon/hwmon1/temp5_input}\
${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu1
${font}${voffset -13}${alignc}${hwmon 1 temp 2} °C
${voffset -13}${alignr 13}${cpu cpu1} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu2
${font}${voffset -13}${alignc}${hwmon 1 temp 3} °C
${voffset -13}${alignr 13}${cpu cpu2} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu3
${font}${voffset -13}${alignc}${hwmon 1 temp 4} °C
${voffset -13}${alignr 13}${cpu cpu3} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu4
${font}${voffset -13}${alignc}${hwmon 1 temp 5} °C
${voffset -13}${alignr 13}${cpu cpu4} %
${color4}${voffset -6}${endif}
#
${voffset -13}\
${if_existing /sys/class/hwmon/hwmon2/temp5_input}\
${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu1
${font}${voffset -13}${alignc}${hwmon 2 temp 2} °C
${voffset -13}${alignr 13}${cpu cpu1} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu2
${font}${voffset -13}${alignc}${hwmon 2 temp 3} °C
${voffset -13}${alignr 13}${cpu cpu2} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu3
${font}${voffset -13}${alignc}${hwmon 2 temp 4} °C
${voffset -13}${alignr 13}${cpu cpu3} %
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Cpu4
${font}${voffset -13}${alignc}${hwmon 2 temp 5} °C
${voffset -13}${alignr 13}${cpu cpu4} %
${color4}${voffset -6}${endif}

##########################################################################   PROCESSUS EN COURS   ############################################################################

${font Sans :regular:size=14}${color1}${goto 20}${voffset 3}Processus en cours${font}${color2}

${font Sans :bold:size=8}${color2}${goto 18}${voffset -2}Processus   :  ${processes}
${voffset -13}${alignc}en cours   :  ${running_processes}
${voffset -13}${alignr 13}(${loadavg 1 2 3})
${color4}${voffset -6}${color}
#
#${font Sans :italic:bold:size=8}${goto 18}${voffset -12}Process
#${voffset -13}${alignc}mem
#${voffset -13}${alignc -203}cpu

${font}${goto 18}${voffset -6}${top name 1}
${voffset -13}${alignc}${top mem 1} %
${voffset -13}${alignc -203}${top cpu 1} %

${goto 18}${voffset -6}${top name 2}
${voffset -13}${alignc}${top mem 2} %
${voffset -13}${alignc -203}${top cpu 2} %

${goto 18}${voffset -6}${top name 3}
${voffset -13}${alignc}${top mem 3} %
${voffset -13}${alignc -203}${top cpu 3} %

${goto 18}${voffset -6}${top name 4}
${voffset -13}${alignc}${top mem 4} %
${voffset -13}${alignc -203}${top cpu 4} %

##########################################################################   RÉSEAU   #######################################################################################

${font Sans :regular:size=14}${color1}${goto 20}${voffset 5}Réseau${font}${color2}

#wlp3s0
${font Sans :bold:size=8}${goto 18}enp4s0
${voffset -13}${alignc}${addr enp4s0}
${voffset -13}${alignr 13}${texeci 3000 wget -O - http://ip.tupeux.com | tail}
${font}${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Réception
${font}${voffset -13}${alignc}${downspeedf enp4s0} kb/s
${voffset -13}${alignr 13}${totaldown enp4s0}
${color4}${voffset -6}

${font Sans:bold:size=8}${color}${goto 18}${voffset -6}Envoi
${font}${voffset -13}${alignc}${upspeedf enp4s0} kb/s
${voffset -13}${alignr 13}${totalup enp4s0}
${color4}${voffset -6}

#####################################################################   OCCUPATION DES DISQUES DURS   #######################################################################

${font Sans :regular:size=14}${color1}${goto 20}${voffset 3}Occupation des disques durs${font}${color2}

${color}${goto 18}/dev/sda3${goto 90}Windows 7\
${if_mounted /media/Windows}\
${alignc}${diskio_read /dev/sda3}/s
${voffset -13}${alignc -105}${fs_used /media/Windows} / 100GiB
${voffset -13}${alignr 13}${fs_used_perc /media/Windows} %
${color5}${goto 16}${fs_bar /media/Windows}${else}\
#
${color FF0000}${alignr 13}démonté
${color 4C4C4C}${goto 16}${cpubar cpu5}${endif}
#
${color}${goto 18}${voffset 1}/dev/sda4${goto 90}Document-NTFS\
${if_mounted /media/Documents-NTFS}\
${alignc}${diskio_read /dev/sda4}/ ${diskio_write /dev/sda4}
${voffset -13}${alignc -105}${fs_used /media/Documents-NTFS} / 100GiB
${voffset -13}${alignr 13}${fs_used_perc /media/Documents-NTFS} %
${color5}${goto 16}${fs_bar /media/Documents-NTFS}${else}\
#
${color FF0000}${alignr 13}démonté
${color 4C4C4C}${goto 16}${cpubar cpu5}${endif}
#
${font Sans :bold:size=8}${color2}${goto 18}${voffset 1}/dev/sda6${goto 90}(ArchLinux)\
${alignc}${diskio_read /dev/sda6}/ ${diskio_write /dev/sda6}
${voffset -13}${alignc -105}${fs_used /} / 40GiB
${voffset -13}${alignr 13}${fs_used_perc /} %
${font}${goto 16}${color6}${fs_bar /}
#
${color}${goto 18}${voffset 1}/dev/sda7${goto 90}Linux Mint\
${if_mounted /media/Debian}\
${alignc}${diskio_read /dev/sda7}/s
${voffset -13}${alignc -105}${fs_used /media/Debian} / 40GiB
${voffset -13}${alignr 13}${fs_used_perc /media/Debian} %
${color5}${goto 16}${fs_bar /media/Debian}${else}\
#
${color FF0000}${alignr 13}démonté
${color 4C4C4C}${goto 16}${cpubar cpu5}${endif}
#
${color}${goto 18}${voffset 1}/dev/sda8${goto 90}Calculate Linux\
${if_mounted /media/Calculate}\
${alignc}${diskio_read /dev/sda8}/s
${voffset -13}${alignc -105}${fs_used /media/Calculate} / 40GiB
${voffset -13}${alignr 13}${fs_used_perc /media/Calculate} %
${color5}${goto 16}${fs_bar /media/Calculate}${else}\
#
${color FF0000}${alignr 13}démonté
${color 4C4C4C}${goto 16}${cpubar cpu5}${endif}
#
${color}${goto 18}${voffset 1}/dev/sda9${goto 90}Document-EXT4\
${if_mounted /media/Documents-EXT4}\
${alignc}${diskio_read /dev/sda9}/ ${diskio_write /dev/sda9}
${voffset -13}${alignc -105}${fs_used /media/Documents-EXT4} / 600GiB
${voffset -13}${alignr 13}${fs_used_perc /media/Documents-EXT4} %
${color5}${goto 16}${fs_bar /media/Documents-EXT4}${else}\
#
${color FF0000}${alignr 13}démonté
${color 4C4C4C}${goto 16}${cpubar cpu5}${endif}
graph_plasma_dark.lua

Code : Tout sélectionner

require 'cairo'
    
function set_settings()
	graph_settings={
            {
        name="memperc",
        arg="",
        max=100,
        x=16,
        y=241,
        width=454,
        height=24,
        nb_values=200,
        background=false,
        foreground=true,
        autoscale=false,
        fg_colour = { {0,0x377c9e,1}}
            },
            {
        name="swapperc",
        arg="",
        max=100,
        x=16,
        y=268,
        width=454,
        height=24,
        nb_values=200,
        background=false,
        foreground=true,
        autoscale=false,
        fg_colour = { {0,0x377c9e,1}}
            },
            {
        name="cpu",
        arg="cpu1",
        max=100,
        x=16,
        y=378,
        width=454,
        height=24,
        nb_values=200,
        background=false,
        foreground=true,
        autoscale=true,
        fg_colour = { {0,0x377c9e,1}}
            },
            {
        name="cpu",
        arg="cpu2",
        max=100,
        x=16,
        y=405,
        width=454,
        height=24,
        nb_values=200,
        background=false,
        foreground=true,
        autoscale=true,
        fg_colour = { {0,0x377c9e,1}}
            },
            {
        name="cpu",
        arg="cpu3",
        max=100,
        x=16,
        y=432,
        width=454,
        height=24,
        nb_values=200,
        background=false,
        foreground=true,
        autoscale=true,
        fg_colour = { {0,0x377c9e,1}}
            },
            {
        name="cpu",
        arg="cpu4",
        max=100,
        x=16,
        y=459,
        width=454,
        height=24,
        nb_values=200,
        background=false,
        foreground=true,
        autoscale=true,
        fg_colour = { {0,0x377c9e,1}}
            },
            {
        name="downspeedf",
        arg="enp4s0",
        max=2500,
        x=16,
        y=732,
        autoscale=false,
        width=454,
        height=24,
        nb_values=150,
        fg_bd_size=1,
        background=false,
        fg_bd_colour = { {1,0x428d3b,1}},
        foreground=false,
            },
            {
        name="upspeedf",
        arg="enp4s0",
        max=500,
        x=16,
        y=759,
        autoscale=false,
        width=454,
        height=24,
        nb_values=150,
        fg_bd_size=1,
        background=false,
        fg_bd_colour = { {1,0x428d3b,1}},
        foreground=false,
            },
       }
end

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

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

function conky_main_graph()

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

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

		end
    end

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

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

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


function draw_graph(t)
    --drawing function

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

	cairo_restore(cr)

end
Note : j'utilise 2 fichiers lua, 1 pour les graphs, 1 pour les fenêtres, d'où l'usage de 2 conkys. Si je savais coder je joindrais ces 2 fichiers en un seul pour que ce soit plus propre :oops:

Et pour lancer le tout :

Code : Tout sélectionner

#!/bin/sh

if [ "$(pidof conky)" ]; then
    killall conky
    conky -c ~/.conky/conky_plasma_draw_dark
#    conky -c ~/.conky/conky_plasma_rss_draw
    sleep 4 &&
    conky -c ~/.conky/conky_plasma_dark
    conky -c ~/.conky/conky_memo_dark
#    conky -c ~/.conky/conky_rss_plasma
    exit
else
    killall conky
    conky -c ~/.conky/conky_plasma_draw_dark
#    conky -c ~/.conky/conky_plasma_rss_draw
    sleep 4 &&
    conky -c ~/.conky/conky_plasma_dark
    conky -c ~/.conky/conky_memo_dark
#    conky -c ~/.conky/conky_rss_plasma
    exit
fi
HP 500-261ef full 64 bits - Samsung 24 pcs 1920x1080 px
CPU : 4 X Intel ® Core™ i5-4440 @ 3.1 Ghz | RAM : 8 Go
HD : Western Digital 1 To | CG Radeon R5 235


Multiboot UEFI : ArchLinux - Windows 7 - Autre base Debian

Openbox (LXqt)
KDE Plasma 5
Avatar de l’utilisateur
onyx67
Elfe
Messages : 766
Inscription : dim. 06 nov. 2011, 18:12
Localisation : Alsace

Re: [Conky] Vos .conkyrc !

Message par onyx67 »

Je vais potasser ça. Merci :)
"La complication est un effet de la simplicité mal acquise"

Intel i5-2320; Nvidia GeForce GT 520; ATA Hitachi 2To; ArchLinux-KDE
Avatar de l’utilisateur
gevutom
Hankyu
Messages : 19
Inscription : ven. 08 avr. 2016, 21:57
Localisation : 48 :mad:

Re: [Conky] Vos .conkyrc !

Message par gevutom »

Coucou.
Je n'ai pas tout relu et le lien y est sans doute déjà, mais au cas où je vous remets le lien de la cave de l'ami arpinux, avec une belle doc' francophone sur ce sympathique Conky ;)

https://arpinux.org/x/doku.php/user_too ... y:arpconky

Pillez sans retenue, fouillez dans les recoins, c'est fait pour ça ;)
Sur nunux depuis fin 2014 avec HandyLinux : il n'est jamais trop tard pour apprendre.
Avatar de l’utilisateur
Breizh
newbie
Messages : 9
Inscription : ven. 30 déc. 2016, 10:14

Re: [Conky] Vos .conkyrc !

Message par Breizh »

Un conky tout simple, mais qui fait le boulot. Le code :

Code : Tout sélectionner

conky.config = {
	alignment = 'top_right',
	background = true,
	cpu_avg_samples = 2,
	double_buffer = true,
	font = 'Terminus:size=8',
	draw_shades = false,
	minimum_width = 250,
	maximum_width = 250,
	minimum_height = 1080,
	gap_y = 0,
	gap_x = 5,
	no_buffers = true,
	own_window = true,
	own_window_type = 'override',
	own_window_transparent = false,
	own_window_argb_visual = true,
	own_window_argb_value = 150,
	update_interval = 1.0,
	use_xft = true,
	default_color = 'BBBBBB',
	format_human_readable = true,
	short_units = true,
	if_up_strictness = 'link',

	color2 = 'FFFFFF',
	color3 = '888888',
	
	template0 = [[${goto 32}${color3}${cpubar cpu\1 6,70}$color${goto 117}${top name \1}$alignr${top cpu \1}%$alignr${offset -250}${cpu cpu\1}%]],
	template1 = [[${top_mem name \1}$alignr${top_mem mem_res \1}\ \ \ ${top_mem mem \1}%]],
	template2 = [[$color${goto 117}${top name \1}$alignr${top cpu \1}%${goto 110}$alignr${offset -150}${if_match ${freq \2}<1000}${freq \2} MHz$else${freq_G \2} GHz$endif]]
};

conky.text = [[
${voffset 28}${color 34BF5C}$alignc${font Terminus:size=12}${time %A %d %B %Y}$font$color

${color2}${font Terminus:size=10}CPU${alignr}${font}${exec sensors -u | grep "temp1_input" | cut -d" " -f4 | cut -d. -f1 | head -n 1}°C${color}
${cpugraph 00FC00 FF0000 -t}${color2}${voffset 10}${goto 95}$alignc$cpu%$color
${template0 1}
${template0 2}
${template0 3}
${template0 4}
${template2 5 1}
${template2 6 2}
${template2 7 3}
${template2 8 4}

${color2}${font Terminus:size=10}RAM${font}${alignr}$mem / $memeasyfree / $memmax${color}
${memgraph 00FC00 FF0000 -t}${color2}${voffset 10}${goto 95}$alignc$memperc%$color
${template1 1}
${template1 2}
${template1 3}
${template1 4}

${color2}${font Terminus:size=10}Swap${font}${alignr}$swap / $swapfree / $swapmax${color}
$swapperc% ${if_match $swapperc>80}${color FF0000}$else${if_match $swapperc>40}${color FFFC00}$else${color 00FC00}$endif$endif${swapbar}$color${if_up wlp1s0}

${color2}${font Terminus:size=10}WLAN${font}${alignr}${addr wlp1s0}${color}
${wireless_essid} ${wireless_link_qual_perc wlp1s0}%$alignr${wireless_bitrate wlp1s0}
Download ${totaldown wlp1s0}${alignr}${totalup wlp1s0} Upload
${downspeed wlp1s0}${alignr}${upspeed wlp1s0}
${downspeedgraph wlp1s0 25,122 00FC00 FF0000}$alignr${upspeedgraph wlp1s0 25,122 00FC00 FF0000}${endif}${if_up enp0s31f6}

${color2}${font Terminus:size=10}LAN${font}${alignr}${addr enp0s31f6}${color}
Download ${totaldown enp0s31f6}${alignr}${totalup enp0s31f6} Upload
${downspeed enp0s31f6}${alignr}${upspeed enp0s31f6}
${downspeedgraph enp0s31f6 25,122 00FC00 FF0000}$alignr${upspeedgraph enp0s31f6 25,122 00FC00 FF0000}${endif}

${color2}${font Terminus:size=10}Disk${font}${alignr}${hddtemp}°C${color}
Read${alignr}Write
${diskio_read sda}$alignr${diskio_write sda}
${diskiograph_read sda 25,122 00FC00 FF0000}$alignr${diskiograph_write sda 25,122 00FC00 FF0000}
/$alignr${fs_free /} ${if_match $fs_free_perc<10}${color FF0000}$else${if_match $fs_free_perc<20}${color FFFC00}$else${color 00FC00}$endif$endif${fs_bar 6,150 /}$color
/home$alignr${fs_free /home} ${if_match ${fs_free_perc /home}<10}${color FF0000}$else${if_match ${fs_free_perc /home}<20}${color FFFC00}$else${color 00FC00}$endif$endif${fs_bar 6,150 /home}$color
/tmp$alignr${fs_free /tmp} ${if_match ${fs_free_perc /tmp}<10}${color FF0000}$else${if_match ${fs_free_perc /tmp}<20}${color FFFC00}$else${color 00FC00}$endif$endif${fs_bar 6,150 /tmp}$color

${color2}${font Terminus:size=10}System${font}${alignr}${execi 600 lsb_release -ds | tr -d '"'}${color}
Kernel$alignr$kernel
Load average$alignr$loadavg
Uptime$alignr$uptime
System fan$alignr$ibm_fan RPM

${if_match $battery_percent<10}${color FF0000}${blink Battery $battery}${else}Battery $battery$endif
${if_match $battery_percent<20}${color FF0000}$else${if_match $battery_percent<60}${color FFFC00}$else${color 00FC00}$endif$endif$battery_bar$color

${color2}${font Terminus:size=10}Music On Console${font}${alignr}${if_match "$moc_state"=="??"}STOP$else$moc_state$endif${color}
$moc_curtime / $moc_totaltime$alignr$moc_timeleft
Title$alignr${scroll wait 32 1 4 $moc_song}
Artist$alignr${scroll wait 32 1 4 $moc_artist}
Album$alignr${scroll wait 32 1 4 $moc_album}

${execbar echo $(($(mocp -Q "%cs") * 100 / $(mocp -Q "%ts")))}

Bitrate$alignr$moc_bitrate
Rate$alignr$moc_rate
File$alignr${scroll wait 32 1 4 $moc_file}
]]
Et le screen :
https://lut.im/Xb04XByAaS/09s1Y8gLoKAV3x2T.png

Des questions ? :mrgreen:
Répondre