[Conky] Vos .conkyrc !

Ce qui ne concerne ni le forum ni des problèmes
Avatar de l’utilisateur
la_poigne
yeomen
Messages : 215
Inscription : dim. 22 févr. 2009, 09:20

Re: [Conky] Vos .conkyrc !

Message par la_poigne »

Salut,
llaqmataqui a écrit :Bonjour,

voici mon .conkyrc :
http://img841.imageshack.us/img841/2697 ... 0x900s.png

Dites moi ce que vous en pensez.
c'est quand même mieux quand on a le .conkyrc en texte
surtout les barres d'utilisation disque avec les ronds, ça m'intéresse :D
llaqmataqui
archer de cavalerie
Messages : 197
Inscription : dim. 30 mai 2010, 18:42

Re: [Conky] Vos .conkyrc !

Message par llaqmataqui »

Les voici :D

Le disque

Code : Tout sélectionner

#######################
# -     Général     - #
#######################
update_interval 1				# Intervalle de rafraîchessement.
total_run_times 0				# Nombre total de rafraîchissement avant de quitter : 0 fait tourner Conky tout le temps.
double_buffer yes				# Permet d'éliminer le clignotement.
no_buffers yes					# Soustrait les mémoires tampons de la mémoire utilisée.
imlib_cache_size 0				# Désactive le buffer image.
cpu_avg_samples 2				# Nombre d'échantillons à prendre en compte pour le monitoring du CPU.


#######################
# -     Fenêtre     - #
#######################
own_window yes					# Autorise Conky à créer sa propre fenêtre.
own_window_type override		  	# La fenêtre créée n'est pas contrôlée par le gestionnaire de fenêtres.
own_window_transparent yes			# Utilise la pseudo-transparence.
own_window_class Conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
								# undecorated : enlève le tour de la fenêtre
								# below : permet de mettre la fenêtre de conky sous les autres fenêtres
								# sticky : laisse la fenêtre de conky sur tous les bureaux
								# skip_taskbar : enlève conky de la barre des taches
								# skip_pager : enlève conky du pager (alt-tab)

alignment top_middle				# Position sur l'écran.
gap_x 0	  					# Ecart avec le bord gauche ou droit de l'écran.
gap_y 0						# Ecart avec le bord haut ou bas de l'écran.
minimum_size 1440 900
maximum_width 1400


#######################
# -  Mise en forme  - #
#######################
default_color FFFFFF				# Couleur par défaut.
draw_shades no					# Affiche les ombres.


#######################
# -      Texte      - #
#######################
use_xft yes					# Utilise des polices lissées.
xftfont Inconsolata:size=9			# Police Xft à utiliser.
xftalpha 0.8					# Transparence de la police Xft.
override_utf8_locale yes			# Force l'UTF-8.


#######################
# -       Lua       - #
#######################
lua_load ~/.conky/rings.lua
lua_draw_hook_pre ring_stats



TEXT

${voffset 46}${alignr}${sysname} ${kernel} sur ${machine}
${alignr}Intel Core 2 Duo T8300 @ 2.40GHz
${alignr}Conky ${conky_version}
${voffset 46}${goto 360}${font Santana:size=12}epoch : ${time %s}${alignr}${uptime_short}${font}
${voffset 5}${goto 340}${hr 2}

${voffset 105}${goto 700}+
${goto 700}A
${goto 693}RCH
${goto 686}ARCHA
${goto 686}RCHARC
${goto 679}; HARCH;
${goto 672}+AR.CHARC
${goto 665}+HARCHARCHA
${goto 658}RCHARCHARCHAR;
${goto 651}CHARCHARCHARCHA+
${goto 644}RCHARCH   ARCHARC
${goto 630}.HARCHA;     ;RCH;`".
${goto 623}.ARCHARC;     ;HARCH.
${goto 623}ARCHARCHA.   .RCHARCHA`
${goto 616}RCHARC'           'HARCHA
${goto 609};RCHA                 RCHA;
${goto 609}RC'                     'HA
${goto 602}R'                         `C
${goto 595}'                            `
Le fichier lua qui fait marcher le tout

Code : Tout sélectionner

--[[
Ring Meters by londonali1010 (2009)

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

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

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
	lua_load ~/scripts/rings-v1.2.lua
	lua_draw_hook_pre ring_stats
	
Changelog:
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]

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.1,
		-- "fg_colour" is the colour of the indicator part of the ring.
		fg_colour=0xffffff,
		-- "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=160, y=190,
		-- "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 (e.g. more clockwise) than start_angle.
		end_angle=360
	},
	{
		name='time',
		arg='%M.%S',
		max=60,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.4,
		x=160, y=190,
		radius=56,
		thickness=5,
		start_angle=0,
		end_angle=360
	},
	{
		name='time',
		arg='%S',
		max=60,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.6,
		x=160, y=190,
		radius=62,
		thickness=5,
		start_angle=0,
		end_angle=360
	},
	{
		name='cpu',
		arg='cpu1',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0,
		fg_colour=0xffffff,
		fg_alpha=0.1,
		x=160, y=190,
		radius=70,
		thickness=5,
		start_angle=60,
		end_angle=120
	},
	{
		name='cpu',
		arg='cpu2',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0,
		fg_colour=0xffffff,
		fg_alpha=0.1,
		x=160, y=190,
		radius=76,
		thickness=5,
		start_angle=60,
		end_angle=120
	},
	{
		name='acpitemp',
		arg='',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.4,
		x=160, y=190,
		radius=84.5,
		thickness=8,
		start_angle=60,
		end_angle=120
	},
	{
		name='battery_percent',
		arg='BAT0',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.6,
		x=160, y=190,
		radius=72,
		thickness=11,
		start_angle=122,
		end_angle=210
	},
	{
		name='memperc',
		arg='',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.8,
		x=160, y=190,
		radius=83.5,
		thickness=8,
		start_angle=122,
		end_angle=210
	},
	{
		name='time',
		arg='%d',
		max=31,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.8,
		x=160, y=190,
		radius=70,
		thickness=5,
		start_angle=212,
		end_angle=360
	},
	{
		name='time',
		arg='%m',
		max=12,
		bg_colour=0xffffff,
		bg_alpha=0.1,
		fg_colour=0xffffff,
		fg_alpha=0.8,
		x=160, y=190,
		radius=76,
		thickness=5,
		start_angle=212,
		end_angle=360
	},
	{
		name='fs_used_perc',
		arg='/home',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.2,
		fg_colour=0xffffff,
		fg_alpha=0.3,
		x=160, y=190,
		radius=108.5,
		thickness=3,
		start_angle=-120,
		end_angle=240
	},
	{
		name='fs_used_perc',
		arg='/',
		max=100,
		bg_colour=0xffffff,
		bg_alpha=0.2,
		fg_colour=0xffffff,
		fg_alpha=0.3,
		x=160, y=190,
		radius=135,
		thickness=50,
		start_angle=-120,
		end_angle=120
	},
}

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_ring_stats()
	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

	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
Avatar de l’utilisateur
la_poigne
yeomen
Messages : 215
Inscription : dim. 22 févr. 2009, 09:20

Re: [Conky] Vos .conkyrc !

Message par la_poigne »

Merci,

mais en fait je parlait de ce qu'il y a en bas à droite en desous de SYSTEME............
/ :
/home :
Partage :
Carte SD :
llaqmataqui
archer de cavalerie
Messages : 197
Inscription : dim. 30 mai 2010, 18:42

Re: [Conky] Vos .conkyrc !

Message par llaqmataqui »

Et voici l'autre conky :

Code : Tout sélectionner

#######################
# -     Général     - #
#######################
update_interval 1				# Intervalle de rafraîchessement.
total_run_times 0				# Nombre total de rafraîchissement avant de quitter : 0 fait tourner Conky tout le temps.
double_buffer yes				# Permet d'éliminer le clignotement.
no_buffers yes					# Soustrait les mémoires tampons de la mémoire utilisée.
imlib_cache_size 0				# Désactive le buffer image.


#######################
# -     Fenêtre     - #
#######################
own_window yes					# Autorise Conky à créer sa propre fenêtre.
own_window_type override		  	# La fenêtre créée n'est pas contrôlée par le gestionnaire de fenêtres.
own_window_transparent yes			# Utilise la pseudo-transparence.
own_window_class Conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
								# undecorated : enlève le tour de la fenêtre
								# below : permet de mettre la fenêtre de conky sous les autres fenêtres
								# sticky : laisse la fenêtre de conky sur tous les bureaux
								# skip_taskbar : enlève conky de la barre des taches
								# skip_pager : enlève conky du pager (alt-tab)

alignment top_right				# Position sur l'écran.
gap_x 20					# Ecart avec le bord gauche ou droit de l'écran.
gap_y 215					# Ecart avec le bord haut ou bas de l'écran.
minimum_size 300 				# Largeur minimal en pixel.


#######################
# -  Mise en forme  - #
#######################
default_color FFFFFF				# Couleur par défaut.
draw_shades no					# Affiche les ombres.

color0 4B4B4B
color1 feff5f
color2 ff8f00
color3 ff4b0b
color4 ff0000
color5 FF9999
color6 FFFF99


#######################
# -      Texte      - #
#######################
use_xft yes					# Utilise des polices lissées.
xftfont Inconsolata:size=9			# Police Xft à utiliser.
override_utf8_locale yes			# Force l'UTF-8.



TEXT

${color}${voffset 25}${font terminus:style=Bold:size=7.5}MEMOIRE : ${memperc}% ${stippled_hr}${font}
${alignc}${mem}/${memmax}
${voffset 10}Mémoire en cache  :${alignr}${cached}
Mémoire en tampon :${alignr}${buffers}
Swap :${alignr}${swap}/${swapmax}

${voffset 4}${color}${font terminus:style=Bold:size=7.5}PROCESSUS : ${processes} ${stippled_hr}${font}
Nom${goto 134}pid${goto 203}%cpu${alignr}%mem
${voffset 5}${color5}${top_mem name 1}${goto 125}${top_mem pid 1}${goto 191}${top_mem cpu 1}${alignr}${top_mem mem 1}
${color6}${top_mem name 2}${goto 125}${top_mem pid 2}${goto 191}${top_mem cpu 2}${alignr}${top_mem mem 2}
${color}${top_mem name 3}${goto 125}${top_mem pid 3}${goto 191}${top_mem cpu 3}${alignr}${top_mem mem 3}
${top_mem name 4}${goto 125}${top_mem pid 4}${goto 191}${top_mem cpu 4}${alignr}${top_mem mem 4}
${top_mem name 5}${goto 125}${top_mem pid 5}${goto 191}${top_mem cpu 5}${alignr}${top_mem mem 5}

${if_up wlan0}${voffset 4}${font terminus:style=Bold:size=7.5}RESEAU : wifi ${stippled_hr}${font}
Connecté sur ${wireless_essid wlan0}.
${voffset 10}Adresse IP :${alignr}${addr wlan0}
Qualité du signal :${alignr}${wireless_link_qual wlan0}%
Port(s) ouvert(s) :${alignr} ${tcp_portmon 1 65535 count}
${voffset 10}Réception :${alignr}${downspeedf wlan0} ko/s
${downspeedgraph wlan0 30,300 4b4b4b 4b4b4b 1000}
${voffset -8}${font Inconsolata:size=8}${alignr}Total : ${totaldown wlan0}${font}
${voffset 10}Envoi :${alignr}${upspeedf wlan0} ko/s
${upspeedgraph wlan0 30,300 4b4b4b 4b4b4b 100}
${voffset -8}${font Inconsolata:size=8}${alignr}Total : ${totalup wlan0}${font}${else}${if_up eth0}${voffset 4}${font terminus:style=Bold:size=7.5}RESEAU : ethernet ${stippled_hr}${font}
Connecté sur ${wireless_essid eth0}.
${voffset 10}Adresse IP :${alignr}${addr eth0}
Port(s) ouvert(s) :${alignr} ${tcp_portmon 1 65535 count}
${voffset 10}Réception :${alignr}${downspeedf eth0} ko/s
${downspeedgraph eth0 30,300 4b4b4b 4b4b4b 1000}
${voffset -8}${font Inconsolata:size=8}${alignr}Total : ${totaldown eth0}${font}
${voffset 10}Envoi :${alignr}${upspeedf eth0} ko/s
${upspeedgraph eth0 30,300 4b4b4b 4b4b4b 100}
${voffset -8}${font Inconsolata:size=8}${alignr}Total : ${totalup eth0}${font}${else}${voffset 4}${font terminus:style=Bold:size=7.5}RESEAU ${stippled_hr}${font}
Aucune connexion réseau activée.${endif}${endif}

${font terminus:style=Bold:size=7.5}SYSTEME ${stippled_hr}${font}
/ :
${voffset -18}${goto 90}${font webdings: size=15}${if_match ${fs_used_perc /} >0}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /} >10}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /} >20}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /} >30}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /} >40}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /} >50}${color1}${else}${color0}${endif}=${if_match ${fs_used_perc /} >60}${color1}${else}${color0}${endif}=${if_match ${fs_used_perc /} >70}${color2}${else}${color0}${endif}=${if_match ${fs_used_perc /} >80}${color3}${else}${color0}${endif}=${if_match ${fs_used_perc /} >90}${color4}${else}${color0}${endif}=${font}${alignr}${fs_type /}
${color}/home :
${voffset -18}${goto 90}${font webdings: size=15}${if_match ${fs_used_perc /home} >0}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >10}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >20}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >30}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >40}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >50}${color1}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >60}${color1}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >70}${color2}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >80}${color3}${else}${color0}${endif}=${if_match ${fs_used_perc /home} >90}${color4}${else}${color0}${endif}=${font}${alignr}${fs_type /home}
${if_mounted /media/Partage}${color}Partage :
${voffset -18}${goto 90}${font webdings: size=15}${if_match ${fs_used_perc /media/Partage} >0}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >10}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >20}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >30}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >40}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >50}${color1}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >60}${color1}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >70}${color2}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >80}${color3}${else}${color0}${endif}=${if_match ${fs_used_perc /media/Partage} >90}${color4}${else}${color0}${endif}=${font}${alignr}${if_match "${fs_type /media/Partage}" == "fuseblk"}ntfs${else}${fs_type /media/Partage}${endif}${else}${color}${alignc}${font Inconsolata:size=8.5}${goto 93}Partage non monté${font}${endif}
${if_mounted /media/5A4A-5097}${color}Carte SD :
${voffset -18}${goto 90}${font webdings: size=15}${if_match ${fs_used_perc /media/5A4A-5097} >0}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >10}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >20}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >30}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >40}${color}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >50}${color1}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >60}${color1}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >70}${color2}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >80}${color3}${else}${color0}${endif}=${if_match ${fs_used_perc /media/5A4A-5097} >90}${color4}${else}${color0}${endif}=${font}${alignr}${if_match "${fs_type /media/5A4A-5097}" == "vfat"}fat32${else}${fs_type /media/5A4A-5097}${endif}${else}${color}${alignc}${font Inconsolata:size=8.5}${goto 93}Carte SD non montée${font}${endif}
ricqles
Hankyu
Messages : 10
Inscription : sam. 05 juin 2010, 19:26

Re: [Conky] Vos .conkyrc !

Message par ricqles »

Coucou !

Bon ben m'étant inspiré un peu de tout ce qui se dit dans ce post tout au long de ces nombreuses pages :)

Je me lance avec mon bureau de débutant :roll: (Oui je suis sous Arch Linux depuis 2 semaines mais je m'étais pas trop donné le temps de personnaliser tout çà avant)

Donc :

- Arch x86_64
- OpenBox
- Tint2
- Conky
- Nitrogen

J'ai encore des choses à peaufiner mais c'est déjà une bonne base à mon goût :P

Image
Avatar de l’utilisateur
z0rg>
Hankyu
Messages : 28
Inscription : sam. 30 oct. 2010, 01:30

Re: [Conky] Vos .conkyrc !

Message par z0rg> »

Salut, je vient d'installer Archlinux ( utilisateur d'ubuntu qui voudrait changer..), je voudrais savoir comment avoir le support de lua dans conky, comment puis-je l'installer ?

EDIT : réglé

yaourt -R conky
yaourt -S conky-lua
Avatar de l’utilisateur
lifala
Daikyu
Messages : 95
Inscription : mer. 28 juil. 2010, 22:20
Localisation : Rhone-Alpes

Re: [Conky] Vos .conkyrc !

Message par lifala »

salut,

j'ai installer vim-conkyrc avec yaourt, mais je n'arrive pas à l'activer .... j'ai beau chercher sur le web je trouve rien d'assez explicite pour moi ! :(

merci
Avatar de l’utilisateur
Nic0
Chu Ko Nu
Messages : 454
Inscription : dim. 11 janv. 2009, 03:16
Localisation : Calvados (14)

Re: [Conky] Vos .conkyrc !

Message par Nic0 »

Salut,

@lifala
C'est un plugin pour vim afin d'activer la coloration syntaxique pour conkyrc, que je n'utilise pas, mais j'ai regardé vite fait.
Effectivement après installation, le .conkyrc ne semble pas se colorer automatiquement.
Lorsque le fichier est ouvert, le code suivant semble suffire à l'activer (au besoin mettre quelque chose dans le vimrc)

Code : Tout sélectionner

:set syntax=conkyrc
~ Yet Another DevOps Blog ~
Avatar de l’utilisateur
lifala
Daikyu
Messages : 95
Inscription : mer. 28 juil. 2010, 22:20
Localisation : Rhone-Alpes

Re: [Conky] Vos .conkyrc !

Message par lifala »

Merci c'est tout simplement ce qu'il me fallait ! :D
Avatar de l’utilisateur
n3os
archer
Messages : 115
Inscription : mar. 12 avr. 2011, 20:37

Re: [Conky] Vos .conkyrc !

Message par n3os »

Hello,

Image

Le .conkyrc

Code : Tout sélectionner

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

# # affiche le texte sur la sortie standard
out_to_console no

# # réglage de la mémoire, pour éviter le clignotement
double_buffer yes

# # Soustraire les mémoires tampons de la mémoire utiliser
no_buffers yes
text_buffer_size 2048

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

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


# # taille et positon
alignment top_right
minimum_size 340 
maximum_width 340 

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

# #  afficher les ombres
draw_shades no

# # afficher des contours
draw_outline no

# # contours autour des blocs de texte
draw_borders no

# # largeur du contour
border_width 1

# # largeur des marges
border_margin 5

short_units yes                 #Unités courtes
pad_percents 2 

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

# # utiliser sa propre fenêtre
own_window yes 
own_window_colour 000000	
own_window_type override # normal / override / desktop
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

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

# #police a utiliser : use_xft doit être a "yes"
#xftfont Comic Sans MS:style=Bold:size=9.5
xftfont Libération Mono:style=Bold:size=8.5
# # Tout le texte en majuscule
uppercase no

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

# # Couleurs
default_color FFFFFF #blanc
default_shade_color 000000
default_outline_color 000000


#Lua Load
  lua_load ~/.conky/scripts/rings.lua
  lua_draw_hook_pre ring_stats

##${image ~/.conky/bm.png -p 0,0 -s 290x75}
#   #   #   #   #   #   #
#   INFOS A AFFICHER    #
#   #   #   #   #   #   #
   
TEXT
${voffset 23}${goto 18}CPU${goto 107}MEM${goto 195}TEMP${goto 287}GPU
${voffset 14}${goto 10}${cpu cpu0} % ${goto 100}${memperc}%${goto 190}${hwmon temp 1}°C ${goto 280}${nvidia temp}°C

Le fichier rings.lua

Code : Tout sélectionner

--[[
Ring Meters by londonali1010 (2009)

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

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

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

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

settings_table = {
    {
        name='cpu',
        arg='cpu0',
        max=100,
        bg_colour=0x606060,
        bg_alpha=0.9,
        fg_colour=0x1994d1,
        fg_alpha=1,
        x=32, y=45,
	radius=30,
	thickness=5,
        start_angle=270,
        end_angle=570,
    },
{
        name='memperc',
        arg='memperc',
        max=100,
        bg_colour=0x606060,
        bg_alpha=0.9,
        fg_colour=0x1994d1,
        fg_alpha=1,
        x=122, y=45,
        radius=30,
        thickness=5,
        start_angle=270,
        end_angle=570,
    },
{
        name='hwmon',
        arg='temp 1',
        max=80,
        bg_colour=0x606060,
        bg_alpha=0.9,
        fg_colour=0x1994d1,
        fg_alpha=1,
        x=212, y=45,
        radius=30,
        thickness=5,
        start_angle=270,
        end_angle=570,
    },
{
        name='nvidia temp',
        arg='temp',
        max=80,
        bg_colour=0x606060,
        bg_alpha=0.9,
        fg_colour=0x1994d1,
        fg_alpha=1,
        x=302, y=45,
        radius=30,
        thickness=5,
        start_angle=270,
        end_angle=570,
    },
}

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_ring_stats()
    if lastValue==nil then lastValue = 0 end
    
    local function setup_rings(cr,pt)
        local str=''
        local value=0

        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)
        if pt['name'] == "hwmon" then 
            if str=="N/A" then
                value=lastValue
            else
                value=tonumber(str)
                lastValue=value
            end
        else
            value=tonumber(str)
        end
        if value==nil then value=0 end
        pct=value/pt['max']
        draw_ring(cr,pct,pt)
    end

    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
Le .conkyrc est à plaçer ds son /home.
Suivant où vous mettez le script rings.lua,
modifier la ligne "lua_load ~/.conky/scripts/rings.lua" dans le fichier .conkyrc

j'ai utilisé ce modèle
Avatar de l’utilisateur
chipster
Maître du Kyudo
Messages : 2063
Inscription : ven. 11 août 2006, 22:25
Localisation : Saint-Étienne (42)
Contact :

Re: [Conky] Vos .conkyrc !

Message par chipster »

@llaqmataqui : tu utilises quoi comme environnement et même question pour la barre qui se trouve tout en haut de ton screenshot (là où il y a l'heure à droite et d'autres choses à gauche)
Skwad
archer de cavalerie
Messages : 195
Inscription : mar. 14 déc. 2010, 20:00

Re: [Conky] Vos .conkyrc !

Message par Skwad »

Mon conky actuel

Code : Tout sélectionner

#Fonctionnement de conky 
  total_run_times 0            #Temps en secondes ; 0 = toujours actif
  background yes            #Pour que conky tourne en arrière plan ; no = pour les tests

#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

#Mémoire
  double_buffer yes            #Éviter le clignotement
  no_buffers yes            #Soustraire les mémoires tampons de la mémoire utilisée
  text_buffer_size 1024            #Taille du cache pour le texte

#Affichage
  out_to_console no            #Affiche le texte sur la sortie standard
  update_interval 1            #Taux de rafraîchissement de la fenêtre (s)

#Fenêtre conky
  alignment bottom_middle            #Alignement
 #---
  minimum_size 1679 10            #Taille minimum (px) ; largeur / hauteur
  maximum_width 1679            #Largeur maximum (px)
 #---
  gap_x 0                #Écart avec le bord gauche / droit
  gap_y 4                #Écart avec le bord haut / bas
 #---
  draw_shades no            #Afficher les ombres
  draw_outline no            #Afficher les contours de fenêtre
  draw_borders no            #Afficher des contours autour des blocs de texte
  draw_graph_borders yes            #Afficher les contours des graph
  border_width 1            #Largeur du contour
  border_inner_margin 1            #Largeur des marges
 #---
  own_window yes            #Utiliser sa propre fenêtre
  own_window_type desktop        #Type de fenêtre ; normal / override / desktop
  own_window_transparent yes        #Pseudo transparence

#Mise en forme
  use_xft yes                #Utiliser Xft (polices lissées etc)
  xftalpha 1                #Utiliser Xft
  override_utf8_locale yes         #Force l'UTF8
  uppercase no                #Tout le texte en majuscule
  use_spacer yes            #Ajoute des espaces après certains objets (qu'avec des polices fixes)
 #---
  xftfont Monospace:style=Bold:size=9        #Police par défaut
 #---
  stippled_borders 1            #Taille des pointillés

#Couleurs
  default_color CCCCCC	            #Couleur par défaut
  default_shade_color 333333        #Couleur des ombres
  default_outline_color 000000        #Couleur des contours
 #---
  short_units yes            #Unités courtes
  pad_percents 2            #Unité à 2 décimales
  
#MPD
#mpd_host 127.0.0.7
#mpd_port 6699

TEXT																																																																																				
$uptime | $kernel $machine | ${exec pacman -Qu | wc -l} MAJ | CPU1 ${cpu cpu1} [${platform coretemp.0 temp 1}°C] CPU2 ${cpu cpu2} [${platform coretemp.1 temp 1}°C] | MEM $memperc | SWP $swapperc | /boot ${fs_used_perc /boot} - / ${fs_used_perc /} - /home ${fs_used_perc /home} - /Docs ${fs_used_perc /media/Docs} | SDA ${execi 30 hddtemp -n /dev/sda} °C - SDB ${execi 30 hddtemp -n /dev/sdb} °C - SDC ${execi 30 hddtemp -n /dev/sdc} °C | ${addr eth0} - ${execi 60 wget -O - http://ip.tupeux.com | tail} | TDn ${totaldown eth0} TUp ${totalup eth0} - Dn ${downspeed eth0}Up ${upspeed eth0}

Discret, complet, nickel.

Image
OS : Archlinux / Debian
DE : Gnome / KDE
Serveur : OpenMediaVault
willcoyote
archer
Messages : 149
Inscription : sam. 25 déc. 2010, 23:41

Re: [Conky] Vos .conkyrc !

Message par willcoyote »

chipster a écrit :Allé, un autre petit script pour faire mumuse avec conky 8)
Son petit nom : Imagesat
J'ai repris ce que d'autres faisaient avant mais là aussi, mais ça ne me plaisait pas. J'aurai aimé améliorer leur code bash mais, ne sachant pas l'utiliser, ... .
Ce que je reprochais à d'autres scripts, c'est qu'ils re-découpaient à chaque fois l'image initiale pour ensuite l'afficher. Je trouvais que faire cette manipulation prenait trop de temps machine. Maintenant, ce n'est plus le cas.
D'autre part, je trouvais le script bash trop rigide du fait qu'il fallait éditer les paramètres directement dans le script. J'ai remplacé ceci par un passage d'arguments, ce qui est nettement moins sale.

J'aurai pu coder le script en perl uniquement mais je pense que vous n'auriez pas été content de télécharger perlwww et un module de manipulation d'images.
Donc il vous faut à la place deux petits logiciels à savoir wget et imagemagick qui devrait être probablement déjà installés

Si vous souhaiter la documentation intégrale de ce script :

Code : Tout sélectionner

perldoc Imagesat
Il faut obligatoirement lui passer 4 paramètres lors de son exécution

Code : Tout sélectionner

 -i http//emplacement_de_votre_image
-s dimension de la future image à afficher (200x200+20+10)
Voici un petit exemple d'utilisation dans conky:

Code : Tout sélectionner

${exec perl Imagesat -s 1274x657+0+110 -i http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_RGB-naturalcolor-westernEurope.jpg}
Si la carte que j'ai mis dans l'exemple ne vous plaît pas, où ne correspond pas à votre zone géographique, faites un petit tour ici

Allé, je suis sympa ce matin, voici comment ça s'utilise dans conky après la balise TEXT

Code : Tout sélectionner

${exec perl /home/user/.conky/Imagesat -s 1274x657+0+110 -i http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_RGB-naturalcolor-westernEurope.jpg}${image /home/user/.conky/image.jpg -p -5,-5 -s 400x220}
Version : 0.03 du 01/10/2009

Code : Tout sélectionner

#!/usr/bin/perl -w

use strict;
use warnings;

use constant VERSION => 0.03;

if(scalar @ARGV != 4) {
	&help;
}

my $image_web;
my $dimensions;

# Détermination des arguments
for(my $i = 0; $i < scalar @ARGV; $i +=2) {
	if($ARGV[$i] eq "-s") {
		$dimensions = $ARGV[$i + 1];
	}
	elsif($ARGV[$i] eq "-i") {
		$image_web = $ARGV[$i + 1];
	}
	else {
		print STDERR "Argument $ARGV[$i] inconnu\n";
		&help;
	}
}

# Détermination du nom de l'image
my @decoupage = split "/", $image_web;
my $image_sat = $decoupage[$#decoupage]; 

# On regarde si le fichier existe déjà
if(-e $image_sat) {
	# Récupération des informations de l'image
	my @infos_ancienne_image = (stat($image_sat))[7..10];

	# Téléchargement de l'image si besoin
	&telecharger($image_web, "-m -nd");
	
	# Récupération des informations de l'image
	my @infos_nouvelle_image = (stat($image_sat))[7..10];

	# Comparaison des informations pour déterminer si on a télécharger une image
	my $comparaison = 0;
	for(my $i = 0; $i < scalar @infos_ancienne_image; $i++) {
		if($infos_ancienne_image[$i] != $infos_nouvelle_image[$i]) {
			$comparaison++;
			last;
		}
	}

	# Si l'image est nouvelle, il faut refaire un découpage
	if($comparaison) {
		&nouvelle_image($image_sat, $dimensions);
	}
}
else {
	&telecharger($image_web, "");
	&nouvelle_image($image_sat, $dimensions);
}

#######################
# Début des fonctions #
#######################

sub help {
	print "Utilisation : $0 [arguments]\n"
		. "arguments :\n"
		. "  -i : Permet d'indiquer l'emplacement où se trouve l'image\n"
		. "  -s : Permet d'indiquer le découpage de l'image\n";
	exit(0);
}

sub nouvelle_image {
	my ($image, $decoupage) = @_;

	# Sauvegarde de l'image actuelle
	system("cp $image imagesattmp.jpg");
	# Découpage de l'image
	system("convert imagesattmp.jpg -crop $decoupage image.jpg");
	# Suppression de l'image temporaire
	unlink "imagesattmp.jpg";
}
sub telecharger {
	my ($emplacement, $options) = @_;

	system("wget -q $options $emplacement");
}

__END__

=encoding utf8

=head1 Nom

Imagesat

=head1 SYNOPSIS

Il permet de télécharger et réduire une image

=head1 DESCRIPTION

Ce script Perl permet de télécharger une image, de la redimensionner pour ensuite l'afficher dans conky. Le script prend B<obligatoirement> deux paramètres à savoir l'emplacement de l'image à
télécharger ainsi que les dimensions de la future image.
Les différentes images (en fonction de vos envies) où vous pouvez trouver votre bonheur se trouve ici :
L<http://oiswww.eumetsat.org/IPPS/html/latestImages.html>

=head1 AUTEUR

Chipster Julien

=head1 Programmes externes

Pour fonctionner, ce script a besoin de deux logiciels :

=over 4

=item wget

=item imagemagick

=back

=head1 UTILISATION

Ce script s'utiliser comme ceci :

C<${exec perl Imagesat} [arguments]>

Si vous avez fait un chmod +x Imagesat :

C<${exec ./Imagesat} [arguments]>

[arguments] doit être défini comme ceci :

=over 4

=item -i http://......../mon_image.jpg

=item -s 200x200+0+0

=back

=head2 Exemple

C<${exec perl Imagesat -s 1274x657+0+110 -i http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_RGB-naturalcolor-westernEurope.jpg}>

Allé, je suis sympa, voici comment ça s'utilise dans conky après la balise TEXT
${exec perl /home/user/.conky/Imagesat -s 1274x657+0+110 -i http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_RGB-naturalcolor-westernEurope.jpg}${image /home/user/.conky/image.jpg -p -5,-5 -s 400x220}

=head1 BOGUES

Aucun connu actuellement

=head1 Évolutions

=head1 Changelog

=item1 Rajout de l'option -q à wget. Il était trop bavard :D Ceci avait tendance à faire boguer gnome

=over 4

=item 30/08/2009

Création du script

=item Big Bang

Création de l'univers connu :D

=back
Version : 0.02

Code : Tout sélectionner

#!/usr/bin/perl -w

use strict;
use warnings;

use constant VERSION => 0.02;

if(scalar @ARGV != 4) {
	&help;
}

my $image_web;
my $dimensions;

# Détermination des arguments
for(my $i = 0; $i < scalar @ARGV; $i +=2) {
	if($ARGV[$i] eq "-s") {
		$dimensions = $ARGV[$i + 1];
	}
	elsif($ARGV[$i] eq "-i") {
		$image_web = $ARGV[$i + 1];
	}
	else {
		print STDERR "Argument $ARGV[$i] inconnu\n";
		&help;
	}
}

# Détermination du nom de l'image
my @decoupage = split "/", $image_web;
my $image_sat = $decoupage[$#decoupage]; 

# On regarde si le fichier existe déjà
if(-e $image_sat) {
	# Récupération des informations de l'image
	my @infos_ancienne_image = (stat($image_sat))[7..10];

	# Téléchargement de l'image si besoin
	&telecharger($image_web, "-m -nd");
	
	# Récupération des informations de l'image
	my @infos_nouvelle_image = (stat($image_sat))[7..10];

	# Comparaison des informations pour déterminer si on a télécharger une image
	my $comparaison = 0;
	for(my $i = 0; $i < scalar @infos_ancienne_image; $i++) {
		if($infos_ancienne_image[$i] != $infos_nouvelle_image[$i]) {
			$comparaison++;
			last;
		}
	}

	# Si l'image est nouvelle, il faut refaire un découpage
	if($comparaison) {
		&nouvelle_image($image_sat, $dimensions);
	}
}
else {
	&telecharger($image_web, "");
	&nouvelle_image($image_sat, $dimensions);
}

#######################
# Début des fonctions #
#######################

sub help {
	print "Utilisation : $0 [arguments]\n"
		. "arguments :\n"
		. "  -i : Permet d'indiquer l'emplacement où se trouve l'image\n"
		. "  -s : Permet d'indiquer le découpage de l'image\n";
	exit(0);
}

sub nouvelle_image {
	my ($image, $decoupage) = @_;

	# Sauvegarde de l'image actuelle
	system("cp $image imagesattmp.jpg");
	# Découpage de l'image
	system("convert imagesattmp.jpg -crop $decoupage image.jpg");
	# Suppression de l'image temporaire
	unlink "imagesattmp.jpg";
}
sub telecharger {
	my ($emplacement, $options) = @_;

	system("wget $options $emplacement");
}

__END__

=encoding utf8

=head1 Nom

Imagesat

=head1 SYNOPSIS

Il permet de télécharger et réduire une image

=head1 DESCRIPTION

Ce script Perl permet de télécharger une image, de la redimensionner pour ensuite l'afficher dans conky. Le script prend B<obligatoirement> deux paramètres à savoir l'emplacement de l'image à
télécharger ainsi que les dimensions de la future image.
Les différentes images (en fonction de vos envies) où vous pouvez trouver votre bonheur se trouve ici :
L<http://oiswww.eumetsat.org/IPPS/html/latestImages.html>

=head1 AUTEUR

Chipster Julien

=head1 Programmes externes

Pour fonctionner, ce script a besoin de deux logiciels :

=over 4

=item wget

=item imagemagick

=back

=head1 UTILISATION

Ce script s'utiliser comme ceci :

C<${exec perl Imagesat} [arguments]>

Si vous avez fait un chmod +x Imagesat :

C<${exec ./Imagesat} [arguments]>

[arguments] doit être défini comme ceci :

=over 4

=item -i http://......../mon_image.jpg

=item -s 200x200+0+0

=back

=head2 Exemple

C<${exec perl Imagesat -s 1274x657+0+110 -i http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_RGB-naturalcolor-westernEurope.jpg}>

Allé, je suis sympa, voici comment ça s'utilise dans conky après la balise TEXT
${exec perl /home/user/.conky/Imagesat -s 1274x657+0+110 -i http://oiswww.eumetsat.org/IPPS/html/latestImages/EUMETSAT_MSG_RGB-naturalcolor-westernEurope.jpg}${image /home/user/.conky/image.jpg -p -5,-5 -s 400x220}

=head1 BOGUES

Aucun connu actuellement

=head1 Évolutions

=head1 Changelog

=over 4

=item 30/08/2009

Création du script

=item Big Bang

Création de l'univers connu :D

=back
Salut
Un deterrage pour un script sympa qui fonctionne toujours aussi bien
Mais j'aurai une question pour chipster

Chez moi, l'image téléchargée et l'image decoupée se place sur mon /home/user/

Comment fait t'on pour quelle se place dans un autre dossier ?

Merci
willcoyote
archer
Messages : 149
Inscription : sam. 25 déc. 2010, 23:41

Re: [Conky] Vos .conkyrc !

Message par willcoyote »

Bon ben merci quand meme
neecride
newbie
Messages : 7
Inscription : jeu. 29 sept. 2011, 22:13

Re: [Conky] Vos .conkyrc !

Message par neecride »

si vous voulez le conkyrc et le lua dites moi la j'ai pas le temps A+

Image

Edite : Me re-vla encore du changement que boulot piuff

Image

sur celui la je me suis fait plaisir, deadspace oblige !!.
Avatar de l’utilisateur
TechDesk
newbie
Messages : 6
Inscription : jeu. 14 juil. 2011, 12:16

Re: [Conky] Vos .conkyrc !

Message par TechDesk »

Image

Code : Tout sélectionner

background yes
gap_x 5
gap_y 30
alignment top_right
update_interval 1
double_buffer yes
cpu_avg_samples 1
net_avg_samples 1
diskio_avg_samples 1
out_to_console no
own_window_transparent no
own_window_colour black
no_buffers yes
draw_shades yes
own_window yes
own_window_type override
own_window_class conky
border_width 1
draw_borders no
draw_outline no
use_xft yes
xftfont OCR A Std:size=11
override_utf8_locale yes
uppercase no
use_spacer none
default_color white
default_outline_color black

TEXT
${color #00ACDE}$nodename - $sysname $kernel on $machine

${color #FF4000}-----------------------| Système |-----------------------$color
Uptime: ${color #00ACDE}$uptime$color
Processes: ${color #00ACDE}$processes$color     Running: ${color #00ACDE}$running_processes$color
Load Average: ${color #00ACDE}$loadavg$color

${color #FF4000}----------------------| Processeur |---------------------$color
Frequency: ${color #00ACDE}$freq MHz$color
CPU: ${color #00ACDE}$cpu$color % ${color #00ACDE}${cpubar 16}$color
Core 1: ${color #00ACDE}${cpu cpu1}$color % ${color #00ACDE}${cpubar 10}$color
Core 2: ${color #00ACDE}${cpu cpu2}$color % ${color #00ACDE}${cpubar 10}$color
Core 3: ${color #00ACDE}${cpu cpu3}$color % ${color #00ACDE}${cpubar 10}$color
Core 4: ${color #00ACDE}${cpu cpu4}$color % ${color #00ACDE}${cpubar 10}$color

${color #FF4000}-----------------------| Mémoire |-----------------------$color
RAM: ${color #00ACDE}$mem$color / ${color #00ACDE}$memmax$color${color #00ACDE} ${membar 16}$color

${color #FF4000}---------------------| Disque Dur |---------------------$color
            Read: ${color #00ACDE}$diskio_read $color  Write: ${color #00ACDE}$diskio_write$color
ArchLinux  ${color #00ACDE}${fs_used_perc /}$color % ${color #00ACDE}${fs_bar /}$color
Carte SD  ${color #00ACDE}${fs_used_perc /media/lexar}$color % ${color #00ACDE}${fs_bar /media/lexar}$color
${color #FF4000}------------------------| Réseau |------------------------$color
IP WAN: ${color #00ACDE}${execi 90 /home/administrateur/.wan.sh}$color

Wired: ${color #00ACDE}${addr eth0}$color
Gateway: ${color #00ACDE}$gw_ip $color
Down: ${color #00ACDE}${downspeed eth0}$alignr${totaldown eth0}$color
${color #00ACDE}${downspeedgraph eth0 15,0 109090 109090 2200}$color
Up: ${color #00ACDE}${upspeed eth0}$alignr${totalup eth0}$color
${color #00ACDE}${upspeedgraph eth0 15,0 109090 109090 130}$color

Wireless: ${color #00ACDE}${addr wlan0}$color
Access Point: ${color #00ACDE}${wireless_essid wlan0}$color
Gateway: ${color #00ACDE}$gw_ip $color
Down: ${color #00ACDE}${downspeed wlan0}$alignr${totaldown wlan0}$color
${color #00ACDE}${downspeedgraph wlan0 15,0 109090 109090 65}$color
Up: ${color #00ACDE}${upspeed wlan0}$alignr${totalup wlan0}$color
${color #00ACDE}${upspeedgraph wlan0 15,0 109090 109090 15}$color

${color #FF4000}------------------------| Batterie |-----------------------$color
${color #00ACDE}${battery_percent BAT0}$color % ${color #00ACDE}${battery_bar 10,0 BAT0}$color
Dernière modification par Nic0 le mar. 25 oct. 2011, 07:19, modifié 1 fois.
Raison : Miniature d'image
Le matériel c'est pas éternel
Avatar de l’utilisateur
banditblue
Elfe
Messages : 591
Inscription : dim. 10 janv. 2010, 10:19

Re: [Conky] Vos .conkyrc !

Message par banditblue »

Mon environnement Openbox

Image


Environnement : Openbox
Théme utilisé ; Win2-7Murrine-aeroblue
Fbpanel
Conky-lua
Météo Weather.com



=========================================================

le conkyrc + appel du script bargraph.lua + Météo
Image

Code : Tout sélectionner

alignment tr
background no
border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
double_buffer yes
draw_borders no
draw_graph_borders yes
draw_outline no
draw_shades no
gap_x 10
gap_y 200
minimum_size 10 10
net_avg_samples 2
out_to_console no
out_to_stderr no
extra_newline no
own_window_transparent yes
own_window yes
own_window_type normal
own_window_title conky
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
stippled_borders 0
show_graph_scale no
show_graph_range no
update_interval 1.0
uppercase no
use_spacer none
use_xft yes
text_buffer_size 2048
xftfont DejaVu:size=9
lua_load /home/moi/.conky/lua/bargraphe.lua
lua_draw_hook_pre main_bars

TEXT

${offset 40}${voffset -35}
${font SF Square Head:size=10}Ordinateur${font} ${hr 2} 
  ${voffset -4}${font DejaVu:size=7}Systeme${font}
  ${offset 50}${voffset -17}:
  ${font DejaVu:size=7}${offset 90}${voffset -15}Archlinux${font}
  ${voffset -8}${font DejaVu:size=7}Kernel${font}
  ${offset 50}${voffset -17}:
  ${font DejaVu:size=7}${offset 90}${voffset -15}$kernel${font}
  ${voffset -8}${font DejaVu:size=7}Temps${font}
  ${offset 50}${voffset -17}:
  ${font DejaVu:size=7}${offset 90}${voffset -15}$uptime${font}
${font SF Square Head:size=10}${voffset -5}Systeme${font} ${hr 1} 
  ${font DejaVu:size=7}${voffset -2}Core 1
  ${offset 45}${voffset -12}:
  ${offset 52}${voffset -11}${cpu cpu1}${font}
  ${offset 70}${voffset -17}%
  ${font DejaVu:size=7}${voffset -5}Core 2
  ${offset 45}${voffset -12}:
  ${offset 52}${voffset -11}${cpu cpu2}${font}
  ${offset 70}${voffset -17}%
  ${font DejaVu:size=7}${voffset -5}Core 3
  ${offset 45}${voffset -12}:
  ${offset 52}${voffset -11}${cpu cpu3}${font}
  ${offset 70}${voffset -17}%
  ${font DejaVu:size=7}${voffset -5}Core 4
  ${offset 45}${voffset -12}:
  ${offset 52}${voffset -11}${cpu cpu4}${font}
  ${offset 70}${voffset -17}%
  ${font DejaVu:size=7}${voffset -5}Core 5
  ${offset 45}${voffset -12}:
  ${offset 52}${voffset -11}${cpu cpu5}${font}
  ${offset 70}${voffset -17}%
  ${font DejaVu:size=7}${voffset -5}Core 6
  ${offset 45}${voffset -12}:
  ${offset 52}${voffset -11}${cpu cpu6}${font}
  ${offset 70}${voffset -17}%
  ${font DejaVu:size=7}${voffset -5}Core 7
  ${offset 45}${voffset -12}:
  ${offset 52}${voffset -11}${cpu cpu7}${font}
  ${offset 70}${voffset -17}%
  ${font DejaVu:size=7}${voffset -5}Core 8
  ${offset 45}${voffset -12}:
  ${offset 52}${voffset -11}${cpu cpu8}${font}
  ${offset 70}${voffset -17}%
${font SF Square Head:size=10}${voffset -2}Disque Dur${font} ${hr 2} 
  ${voffset -4}${font DejaVu:size=7}Systeme
  ${offset 100}${voffset -12}Home
  ${fs_used /}/${fs_size /}
  ${offset 100}${voffset -12}${fs_used /home}/${fs_size /home}
#${offset 100}${voffset -10}${font}
#${font DejaVu:size=7}${voffset -7}Disque externe
#${offset 2}${fs_free /run/media/moi/DDexterne}/${fs_size /run/media/moi/DDexterne}
#${offset 3}${font}
${font SF Square Head:size=10}${voffset 10}Memoire${font} ${hr 2}
  ${font DejaVu:size=7}${voffset -5}
  ${voffset -10}${mem} / ${memmax}
#${offset 100}${voffset -10}${font}
#${font DejaVu:size=7}${voffset -7}Disque externe
#${offset 2}${fs_free /run/media/moi/DDexterne}/${fs_size /run/media/moi/DDexterne}
#${offset 3}${font}
${voffset 7}${font SF Square Head:size=10}Resaux par le cable${font} ${hr 2} 
  ${voffset -5}${font DejaVu:size=7} Down
  ${offset 35}${voffset -11}:
  ${offset 44}${voffset -12}${downspeed enp0s31f6}
  ${offset 80}${voffset -12}/s
  Upload
  ${offset 37}${voffset -11}:
  ${offset 44}${voffset -12}${upspeed enp0s31f6}
  ${offset 80}${voffset -12}/s${font}
${voffset -5}${font SF Square Head:size=10}Resaux Wifi${font} ${hr 2} 
  ${voffset -5}${font DejaVu:size=7} Down
  ${offset 35}${voffset -11}:
  ${offset 44}${voffset -12}${downspeed wlp0s20f0u2}
  ${offset 80}${voffset -12}/s
  Upload
  ${offset 37}${voffset -11}:
  ${offset 44}${voffset -12}${upspeed wlp0s20f0u2}
  ${offset 80}${voffset -12}/s${font}
${voffset -4}${font Sf Square Head:size=10}Meteo ${hr 2}$font
${texeci 500 bash $HOME/Weather_com_conky_script/weather_com}${image $HOME/Weather_com_conky_script/Forecast_Images/now.png -p 15,355 -s 50x50}
${goto 60}${voffset -15}${font Noto Serif:Italic:size=11}${texeci 600 sed -n '2p' $HOME/Weather_com_conky_script/now}$font
${goto 100}${voffset 5}${font LED_mono:Medium:size=25}${texeci 600 sed -n '1p' $HOME/Weather_com_conky_script/now}$font${goto 137}${voffset -20}${font FreeSerif:size=15}°$font
${goto 102}${voffset 10}${font DejaVu:size=7}Ressentie:${font}
${goto 150}${voffset -17}$font${font LED_mono:Medium:size=10}${texeci 300 sed -n '3p' $HOME/Weather_com_conky_script/now}$font$font${goto 167}${voffset -7}${font FreeSerif:size=10}°$font
${goto 20}${voffset 5}${font DejaVu:size=7}Mini :${font}${voffset -2} ${font LED_mono:Medium:size=9}${texeci 300 sed -n '5p' $HOME/Weather_com_conky_script/now}${font}${font FreeSerif:size=10}°${font}${goto 104}${font DejaVu:size=7}Vent: ${texeci 300 sed -n '7p' $HOME/Weather_com_conky_script/now}${font}
${goto 20}${voffset -8}${font DejaVu:size=7}Maxi:${font}${voffset -2} ${font LED_mono:Medium:size=9}${texeci 300 sed -n '3p' $HOME/Weather_com_conky_script/now}${font}${font FreeSerif:size=10}°${font}${goto 92}${font DejaVu:size=7}Index Uv:${goto 148}${texeci 300 sed -n '6p' $HOME/Weather_com_conky_script/now}${font}
${goto 20}${voffset -8}${font DejaVu:size=7}Pression Athmo: ${goto 127}${texeci 300 sed -n '10p' $HOME/Weather_com_conky_script/now}${font}
${voffset -2}${font Sf Square Head:size=10}Prevision de la semaine${font}
${if_match "${texeci 600 sed -n '1p' $HOME/Weather_com_conky_script/10days}" == "Today"}${image $HOME/Weather_com_conky_script/Forecast_Images/d1.png -p 0,550 -s 40x40}${image $HOME/Weather_com_conky_script/Forecast_Images/d2.png -p 120,215 -s 90x90}${image $HOME/Weather_com_conky_script/Forecast_Images/d3.png -p 240,215 -s 90x90}${image $HOME/Weather_com_conky_script/Forecast_Images/d4.png -p 360,215 -s 90x90}${image $HOME/Weather_com_conky_script/Forecast_Images/d5.png -p 480,215 -s 90x90}${image $HOME/Weather_com_conky_script/Forecast_Images/d6.png -p 600,215 -s 90x90}${image $HOME/Weather_com_conky_script/Forecast_Images/d7.png -p 720,215 -s 90x90}
${goto 30}${texeci 600 sed -n '9p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '40p' $HOME/Weather_com_conky_script/10days}°${texeci 600 sed -n '71p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '102p' $HOME/Weather_com_conky_script/10days}°${texeci 600 sed -n '133p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '164p' $HOME/Weather_com_conky_script/10days}°${texeci 600 sed -n '195p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '226p' $HOME/Weather_com_conky_script/10days}°${texeci 600 sed -n '257p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '288p' $HOME/Weather_com_conky_script/10days}°${texeci 600 sed -n '319p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '350p' $HOME/Weather_com_conky_script/10days}°${texeci 600 sed -n '381p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '412p' $HOME/Weather_com_conky_script/10days}°${else}
${image $HOME/Weather_com_conky_script/Forecast_Images/d2.png -p 24,470 -s 25x25}${image $HOME/Weather_com_conky_script/Forecast_Images/d3.png -p 80,470 -s 25x25}${image $HOME/Weather_com_conky_script/Forecast_Images/d4.png -p 135,470 -s 25x25}
${image $HOME/Weather_com_conky_script/Forecast_Images/d5.png -p 24,530 -s 25x25}${image $HOME/Weather_com_conky_script/Forecast_Images/d6.png -p 80,530 -s 25x25}${image $HOME/Weather_com_conky_script/Forecast_Images/d7.png -p 135,530 -s 25x25}
${goto 30}${voffset -48}${font DejaVu:Italic:size=7}${texeci 600 sed -n '63p' $HOME/Weather_com_conky_script/10days|tr a-z A-Z|cut -c1-3}${goto 90}${texeci 600 sed -n '125p' $HOME/Weather_com_conky_script/10days|tr a-z A-Z|cut -c1-3}${goto 145}${texeci 600 sed -n '187p' $HOME/Weather_com_conky_script/10days|tr a-z A-Z|cut -c1-3}${goto 30}${voffset 60}${texeci 600 sed -n '249p' $HOME/Weather_com_conky_script/10days|tr a-z A-Z|cut -c1-3}${goto 90}${texeci 600 sed -n '311p' $HOME/Weather_com_conky_script/10days|tr a-z A-Z|cut -c1-3}${goto 145}${texeci 600 sed -n '807p' $HOME/Weather_com_conky_script/10days|tr a-z A-Z|cut -c1-3}
${goto 23}${voffset -32}${texeci 600 sed -n '71p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '102p' $HOME/Weather_com_conky_script/10days}°${goto 84}${texeci 600 sed -n '133p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '164p' $HOME/Weather_com_conky_script/10days}°${goto 138}${texeci 600 sed -n '195p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '226p' $HOME/Weather_com_conky_script/10days}°
${voffset -7}${hr 1}
${goto 23}${voffset 38}${texeci 600 sed -n '257p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '288p' $HOME/Weather_com_conky_script/10days}°${goto 84}${texeci 600 sed -n '319p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '350p' $HOME/Weather_com_conky_script/10days}°${goto 138}${texeci 600 sed -n '381p' $HOME/Weather_com_conky_script/10days}°/${texeci 600 sed -n '412p' $HOME/Weather_com_conky_script/10days}°${font}
${endif}
${voffset -18}${font SF Square Head:size=10}Mise a jour${font} ${hr 2}
  ${voffset -2}${offset 30}${font DejaVu:size=7}mise a jour de disponible 
  ${offset 15}${voffset -12}${execpi 600 yaourt -Sya --logfile /dev/null > /dev/null; yaourt -Qu | wc -l}
${voffset -2}${hr 2}

=========================================================

le bargraphe-lua (bargraphe systeme et capacité disque dur)

le bargraphe.lua à copier dans le dossier /lua

Code : Tout sélectionner

--[[ BARGRAPH WIDGET
   v2.1 by wlourf (07 Jan. 2011)
   this widget draws a bargraph with different effects 
   http://u-scripts.blogspot.com/2010/07/bargraph-widget.html
   
To call the script in a conky, use, before TEXT
   lua_load /path/to/the/script/bargraph.lua
   lua_draw_hook_pre main_rings
and add one line (blank or not) after TEXT

   
Parameters are :
3 parameters are mandatory
name   - the name of the conky variable to display, for example for {$cpu cpu0}, just write name="cpu"
arg      - the argument of the above variable, for example for {$cpu cpu0}, just write arg="cpu0"
        arg can be a numerical value if name=""
max      - the maximum value the above variable can reach, for example, for {$cpu cpu0}, just write max=100
   
Optional parameters:
x,y      - coordinates of the starting point of the bar, default = middle of the conky window
cap      - end of cap line, ossibles values are r,b,s (for round, butt, square), default="b"
        http://www.cairographics.org/samples/set_line_cap/
angle   - angle of rotation of the bar in degress, default = 0 (i.e. a vertical bar)
        set to 90 for an horizontal bar
skew_x   - skew bar around x axis, default = 0
skew_y   - skew bar around y axis, default = 0
blocks  - number of blocks to display for a bar (values >0) , default= 10
height   - height of a block, default=10 pixels
width   - width of a block, default=20 pixels
space   - space between 2 blocks, default=2 pixels
angle_bar   - this angle is used to draw a bar on a circular way (ok, this is no more a bar !) default=0
radius      - for cicular bars, internal radius, default=0
           with radius, parameter width has no more effect.

Colours below are defined into braces {colour in hexadecimal, alpha}
fg_colour   - colour of a block ON, default= {0x00FF00,1}
bg_colour   - colour of a block OFF, default = {0x00FF00,0.5}
alarm      - threshold, values after this threshold will use alarm_colour colour , default=max
alarm_colour - colour of a block greater than alarm, default=fg_colour
smooth      - (true or false), create a gradient from fg_colour to bg_colour, default=false 
mid_colour   - colours to add to gradient, with this syntax {position into the gradient (0 to1), colour hexa, alpha}
           for example, this table {{0.25,0xff0000,1},{0.5,0x00ff00,1},{0.75,0x0000ff,1}} will add
           3 colurs to gradient created by fg_colour and alarm_colour, default=no mid_colour
led_effect   - add LED effects to each block, default=no led_effect
           if smooth=true, led_effect is not used
           possibles values : "r","a","e" for radial, parallelel, perdendicular to the bar (just try!)
           led_effect has to be used with theses colours :
fg_led      - middle colour of a block ON, default = fg_colour
bg_led      - middle colour of a block OFF, default = bg_colour
alarm_led   - middle colour of a block > ALARM,  default = alarm_colour

reflection parameters, not avaimable for circular bars
reflection_alpha    - add a reflection effect (values from 0 to 1) default = 0 = no reflection
                      other values = starting opacity
reflection_scale    - scale of the reflection (default = 1 = height of text)
reflection_length   - length of reflection, define where the opacity will be set to zero
                 calues from 0 to 1, default =1
reflection         - position of reflection, relative to a vertical bar, default="b"
                 possibles values are : "b","t","l","r" for bottom, top, left, right
draw_me     - if set to false, text is not drawn (default = true or 1)
              it can be used with a conky string, if the string returns 1, the text is drawn :
              example : "${if_empty ${wireless_essid wlan0}}${else}1$endif",

v1.0 (10 Feb. 2010) original release
v1.1 (13 Feb. 2010) numeric values can be passed instead conky stats with parameters name="", arg = numeric_value   
v1.2 (28 Feb. 2010) just renamed the widget to bargraph
v1.3 (03 Mar. 2010) added parameters radius & angle_bar to draw the bar in a circular way
v2.0 (12 Jul. 2010) rewrite script + add reflection effects and parameters are now set into tables
v2.1 (07 Jan. 2011) Add draw_me parameter and correct memory leaks, thanks to "Creamy Goodness"

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

]]

require 'cairo'

----------------START OF PARAMETERS ----------
function conky_main_bars()
   local bars_settings={
      {
         name="cpu",
         arg="cpu1",
         max=100,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=100,y=70,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },   
      {
         name="cpu",
         arg="cpu2",
         max=169,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=100,y=82,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },                     
      {
         name="cpu",
         arg="cpu3",
         max=100,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=100,y=94,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },   
      {
         name="cpu",
         arg="cpu4",
         max=169,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=100,y=106,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },
       {
         name="cpu",
         arg="cpu5",
         max=100,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=100,y=118,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },   
      {
         name="cpu",
         arg="cpu6",
         max=169,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=100,y=130,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },                     
      {
         name="cpu",
         arg="cpu7",
         max=100,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=100,y=142,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },   
      {
         name="cpu",
         arg="cpu8",
         max=169,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=100,y=154,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },     
      {
         name="memperc",
         arg="",
         max=170,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=12,y=242,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },
      {
         name="fs_used_perc",
         arg="/",
         max=100,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=12,y=205,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },
      {
         name="fs_used_perc",
         arg="/home/moi",
         max=100,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=105,y=205,
         blocks=15,
         space=0.5,
         height=5,width=5,
         angle=90,
         smooth = true,
      },
      {
         name='downspeedf',
         arg='enp0s31f6',
         max=1000,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=105,y=268,
         blocks=10,
         space=0.8,
         height=7,width=7,
         angle=90,
         smooth = true,
      },      
      {
         name='upspeedf',
         arg='enp0s31f6',
         max=1000,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=105,y=279,
         blocks=10,
         space=0.8,
         height=7,width=7,
         angle=90,
         smooth = true,
      },
      {
         name='downspeedf',
         arg='wlp0s20f0u2',
         max=1000,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=105,y=306,
         blocks=10,
         space=0.7,
         height=7,width=7,
         angle=90,
         smooth = true,
      },      
      {
         name='upspeedf',
         arg='wlp0s20f0u2',
         max=1000,
         bg_colour={0x0000ff,0.5},
         fg_colour={0x00ff00,1},
         mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
         x=105,y=318,
         blocks=10,
         space=0.7,
         height=7,width=7,
         angle=90,
         smooth = true,
      },
   }
   
-----------END OF PARAMETERS--------------


    
   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)    
   --prevent segmentation error when reading cpu state
    if tonumber(conky_parse('${updates}'))>3 then
        for i in pairs(bars_settings) do
           
           draw_multi_bar_graph(bars_settings[i])
           
        end
    end
   cairo_destroy(cr)
   cairo_surface_destroy(cs)
   cr=nil

end



function draw_multi_bar_graph(t)
   cairo_save(cr)
   --check values
   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   
   if t.name==nil and t.arg==nil then 
      print ("No input values ... use parameters 'name' with 'arg' or only parameter 'arg' ") 
      return
   end
   if t.max==nil then
      print ("No maximum value defined, use 'max'")
      return
   end
   if t.name==nil then t.name="" end
   if t.arg==nil then t.arg="" end

   --set default values   
   if t.x == nil      then t.x = conky_window.width/2 end
   if t.y == nil      then t.y = conky_window.height/2 end
   if t.blocks == nil   then t.blocks=10 end
   if t.height == nil   then t.height=10 end
   if t.angle == nil    then t.angle=0 end
   t.angle = t.angle*math.pi/180
   --line cap style
   if t.cap==nil      then t.cap = "b" end
   local cap="b"
   for i,v in ipairs({"s","r","b"}) do 
      if v==t.cap then cap=v end
   end
   local delta=0
   if t.cap=="r" or t.cap=="s" then delta = t.height end
   if cap=="s" then    cap = CAIRO_LINE_CAP_SQUARE
   elseif cap=="r" then
      cap = CAIRO_LINE_CAP_ROUND
   elseif cap=="b" then
      cap = CAIRO_LINE_CAP_BUTT
   end
   --end line cap style
   --if t.led_effect == nil   then t.led_effect="r" end
   if t.width == nil   then t.width=20 end
   if t.space == nil   then t.space=2 end
   if t.radius == nil   then t.radius=0 end
   if t.angle_bar == nil   then t.angle_bar=0 end
   t.angle_bar = t.angle_bar*math.pi/360 --halt angle
   
   --colours
   if t.bg_colour == nil    then t.bg_colour = {0x00FF00,0.5} end
   if #t.bg_colour~=2       then t.bg_colour = {0x00FF00,0.5} end
   if t.fg_colour == nil    then t.fg_colour = {0x00FF00,1} end
   if #t.fg_colour~=2       then t.fg_colour = {0x00FF00,1} end
   if t.alarm_colour == nil    then t.alarm_colour = t.fg_colour end
   if #t.alarm_colour~=2       then t.alarm_colour = t.fg_colour end

   if t.mid_colour ~= nil then   
      for i=1, #t.mid_colour do    
          if #t.mid_colour[i]~=3 then 
             print ("error in mid_color table")
             t.mid_colour[i]={1,0xFFFFFF,1} 
          end
      end
    end
    
   if t.bg_led ~= nil and #t.bg_led~=2   then t.bg_led = t.bg_colour end
   if t.fg_led ~= nil and #t.fg_led~=2   then t.fg_led = t.fg_colour end
   if t.alarm_led~= nil and #t.alarm_led~=2 then t.alarm_led = t.fg_led end
   
   if t.led_effect~=nil then
      if t.bg_led == nil then t.bg_led = t.bg_colour end
      if t.fg_led == nil    then t.fg_led = t.fg_colour end
      if t.alarm_led == nil  then t.alarm_led = t.fg_led end
   end
   

   if t.alarm==nil then t.alarm = t.max end --0.8*t.max end
   if t.smooth == nil then t.smooth = false end

   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
   
   if t.reflection_alpha==nil then t.reflection_alpha=0 end
   if t.reflection_length==nil then t.reflection_length=1 end
   if t.reflection_scale==nil then t.reflection_scale=1 end
   
   --end of default values
   

   local function rgb_to_r_g_b(col_a)
      return ((col_a[1] / 0x10000) % 0x100) / 255., ((col_a[1] / 0x100) % 0x100) / 255., (col_a[1] % 0x100) / 255., col_a[2]
   end
   
   
   --functions used to create patterns

   local function create_smooth_linear_gradient(x0,y0,x1,y1)
      local pat = cairo_pattern_create_linear (x0,y0,x1,y1)
      cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
      cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
      if t.mid_colour ~=nil then
         for i=1, #t.mid_colour do
            cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
         end
      end
      return pat
   end

   local function create_smooth_radial_gradient(x0,y0,r0,x1,y1,r1)
      local pat =  cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
      cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(t.fg_colour))
      cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(t.alarm_colour))
      if t.mid_colour ~=nil then
         for i=1, #t.mid_colour do
            cairo_pattern_add_color_stop_rgba (pat, t.mid_colour[i][1], rgb_to_r_g_b({t.mid_colour[i][2],t.mid_colour[i][3]}))
         end
      end
      return pat
   end
   
   local function create_led_linear_gradient(x0,y0,x1,y1,col_alp,col_led)
      local pat = cairo_pattern_create_linear (x0,y0,x1,y1) ---delta, 0,delta+ t.width,0)
      cairo_pattern_add_color_stop_rgba (pat, 0.0, rgb_to_r_g_b(col_alp))
      cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
      cairo_pattern_add_color_stop_rgba (pat, 1.0, rgb_to_r_g_b(col_alp))
      return pat
   end

   local function create_led_radial_gradient(x0,y0,r0,x1,y1,r1,col_alp,col_led,mode)
      local pat = cairo_pattern_create_radial (x0,y0,r0,x1,y1,r1)
      if mode==3 then
         cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_alp))            
         cairo_pattern_add_color_stop_rgba (pat, 0.5, rgb_to_r_g_b(col_led))
         cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))            
      else
         cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col_led))
         cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col_alp))            
      end
      return pat
   end






   local function draw_single_bar()
      --this fucntion is used for bars with a single block (blocks=1) but 
      --the drawing is cut in 3 blocks : value/alarm/background
      --not zvzimzblr for circular bar
      local function create_pattern(col_alp,col_led,bg)
         local pat
         
         if not t.smooth then
            if t.led_effect=="e" then
               pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
            elseif t.led_effect=="a" then
               pat = create_led_linear_gradient (t.width/2, 0,t.width/2,-t.height,col_alp,col_led)
            elseif  t.led_effect=="r" then
               pat = create_led_radial_gradient (t.width/2, -t.height/2, 0, t.width/2,-t.height/2,t.height/1.5,col_alp,col_led,2)
            else
               pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
            end
         else
            if bg then
               pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(t.bg_colour))
            else
               pat = create_smooth_linear_gradient(t.width/2, 0, t.width/2,-t.height)
            end
         end
         return pat
      end
      
      local y1=-t.height*pct/100
      local y2,y3
      if pct>(100*t.alarm/t.max) then 
         y1 = -t.height*t.alarm/100
         y2 = -t.height*pct/100
         if t.smooth then y1=y2 end
      end
      
      if t.angle_bar==0 then
      
         --block for fg value
         local pat = create_pattern(t.fg_colour,t.fg_led,false)
         cairo_set_source(cr,pat)
         cairo_rectangle(cr,0,0,t.width,y1)
         cairo_fill(cr)
         cairo_pattern_destroy(pat)
      
         -- block for alarm value         
         if not t.smooth and y2 ~=nil then 
            pat = create_pattern(t.alarm_colour,t.alarm_led,false)
            cairo_set_source(cr,pat)
            cairo_rectangle(cr,0,y1,t.width,y2-y1)
            cairo_fill(cr)
            y3=y2
            cairo_pattern_destroy(pat)
         else
            y2,y3=y1,y1
         end
         -- block for bg value
         cairo_rectangle(cr,0,y2,t.width,-t.height-y3)
         pat = create_pattern(t.bg_colour,t.bg_led,true)
         cairo_set_source(cr,pat)
         cairo_pattern_destroy(pat)
         cairo_fill(cr)
      end      
   end  --end single bar
   





   local function draw_multi_bar()
      --function used for bars with 2 or more blocks
      for pt = 1,t.blocks do 
         --set block y
         local y1 = -(pt-1)*(t.height+t.space)
         local light_on=false
         
         --set colors
         local col_alp = t.bg_colour
         local col_led = t.bg_led
         if pct>=(100/t.blocks) or pct>0 then --ligth on or not the block
            if pct>=(pcb*(pt-1))  then 
               light_on = true
               col_alp = t.fg_colour
               col_led = t.fg_led
               if pct>=(100*t.alarm/t.max) and (pcb*pt)>(100*t.alarm/t.max) then 
                  col_alp = t.alarm_colour 
                  col_led = t.alarm_led 
               end
            end
         end

         --set colors
         --have to try to create gradients outside the loop ?
         local pat 
         
         if not t.smooth then
            if t.angle_bar==0 then
               if t.led_effect=="e" then
                  pat = create_led_linear_gradient (-delta, 0,delta+ t.width,0,col_alp,col_led)
               elseif t.led_effect=="a" then
                  pat = create_led_linear_gradient (t.width/2, -t.height/2+y1,t.width/2,0+t.height/2+y1,col_alp,col_led)               
               elseif  t.led_effect=="r" then
                  pat = create_led_radial_gradient (t.width/2, y1, 0, t.width/2,y1,t.width/1.5,col_alp,col_led,2)   
               else
                  pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))
               end
            else
                if t.led_effect=="a"  then
                   pat = create_led_radial_gradient (0, 0, t.radius+(t.height+t.space)*(pt-1),
                                           0, 0, t.radius+(t.height+t.space)*(pt),                   
                                  col_alp,col_led,3)   
               else
                  pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(col_alp))               
               end
               
            end
         else
            
            if light_on then
               if t.angle_bar==0 then
                  pat = create_smooth_linear_gradient(t.width/2, t.height/2, t.width/2,-(t.blocks-0.5)*(t.height+t.space))
               else
                  pat = create_smooth_radial_gradient(0, 0, (t.height+t.space),  0,0,(t.blocks+1)*(t.height+t.space),2)
               end
            else      
               pat = cairo_pattern_create_rgba  (rgb_to_r_g_b(t.bg_colour))
            end
         end
         cairo_set_source (cr, pat)
         cairo_pattern_destroy(pat)

         --draw a block
         if t.angle_bar==0 then
            cairo_move_to(cr,0,y1)
            cairo_line_to(cr,t.width,y1)
         else      
            cairo_arc( cr,0,0,
               t.radius+(t.height+t.space)*(pt)-t.height/2,
                -t.angle_bar -math.pi/2 ,
                t.angle_bar -math.pi/2)
         end
         cairo_stroke(cr)
      end   
   end
   
   
   
   
   local function setup_bar_graph()
      --function used to retrieve the value to display and to set the cairo structure
      if t.blocks ~=1 then t.y=t.y-t.height/2 end
      
      local value = 0
      if t.name ~="" then
         value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
         --$to_bytes doesn't work when value has a decimal point,
         --https://garage.maemo.org/plugins/ggit/browse.php/?p=monky;a=commitdiff;h=174c256c81a027a2ea406f5f37dc036fac0a524b;hp=d75e2db5ed3fc788fb8514121f67316ac3e5f29f
         --http://sourceforge.net/tracker/index.php?func=detail&aid=3000865&group_id=143975&atid=757310
         --conky bug?
         --value = (conky_parse(string.format('${%s %s}', t.name, t.arg)))
         --if string.match(value,"%w") then
         --   value = conky_parse(string.format('${to_bytes %s}',value))
         --end
      else
         value = tonumber(t.arg)
      end

      if value==nil then value =0 end
      
      pct = 100*value/t.max
      pcb = 100/t.blocks
      
      cairo_set_line_width (cr, t.height)
      cairo_set_line_cap  (cr, cap)
      cairo_translate(cr,t.x,t.y)
      cairo_rotate(cr,t.angle)

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

   
      
      --call the drawing function for blocks
      if t.blocks==1 and t.angle_bar==0 then
         draw_single_bar()
         if t.reflection=="t" or t.reflection=="b" then cairo_translate(cr,0,-t.height) end
      else
         draw_multi_bar()
      end

      --dot for reminder
      --[[
      if t.blocks ~=1 then
         cairo_set_source_rgba(cr,1,0,0,1)
         cairo_arc(cr,0,t.height/2,3,0,2*math.pi)
         cairo_fill(cr)
      else
         cairo_set_source_rgba(cr,1,0,0,1)
         cairo_arc(cr,0,0,3,0,2*math.pi)
         cairo_fill(cr)
      end]]
      
      --call the drawing function for reflection and prepare the mask used      
      if t.reflection_alpha>0 and t.angle_bar==0 then
         local pat2
         local matrix1 = cairo_matrix_t:create()
         tolua.takeownership(matrix1)
         if t.angle_bar==0 then
            pts={-delta/2,(t.height+t.space)/2,t.width+delta,-(t.height+t.space)*(t.blocks)}
            if t.reflection=="t" then
               cairo_matrix_init (matrix1,1,0,0,-t.reflection_scale,0,-(t.height+t.space)*(t.blocks-0.5)*2*(t.reflection_scale+1)/2)
               pat2 = cairo_pattern_create_linear (t.width/2,-(t.height+t.space)*(t.blocks),t.width/2,(t.height+t.space)/2)
            elseif t.reflection=="r" then
               cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,delta+2*t.width,0)
               pat2 = cairo_pattern_create_linear (delta/2+t.width,0,-delta/2,0)
            elseif t.reflection=="l" then
               cairo_matrix_init (matrix1,-t.reflection_scale,0,0,1,-delta,0)
               pat2 = cairo_pattern_create_linear (-delta/2,0,delta/2+t.width,-0)
            else --bottom
               cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(t.height+t.space)*(t.reflection_scale+1)/2)
               pat2 = cairo_pattern_create_linear (t.width/2,(t.height+t.space)/2,t.width/2,-(t.height+t.space)*(t.blocks))
            end
         end
         cairo_transform(cr,matrix1)

         if t.blocks==1 and t.angle_bar==0 then
            draw_single_bar()
            cairo_translate(cr,0,-t.height/2) 
         else
            draw_multi_bar()
         end
         
         
         cairo_set_line_width(cr,0.01)
         cairo_pattern_add_color_stop_rgba (pat2, 0,0,0,0,1-t.reflection_alpha)
         cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)
         if t.angle_bar==0 then
            cairo_rectangle(cr,pts[1],pts[2],pts[3],pts[4])
         end
         cairo_clip_preserve(cr)
         cairo_set_operator(cr,CAIRO_OPERATOR_CLEAR)
         cairo_stroke(cr)
         cairo_mask(cr,pat2)
         cairo_pattern_destroy(pat2)
         cairo_set_operator(cr,CAIRO_OPERATOR_OVER)
         
      end --reflection
      pct,pcb=nil
   end --setup_bar_graph()
   
   --start here !
   setup_bar_graph()
   cairo_restore(cr)
end
ensuite pour changer la position des bargraphe en hauteur il suffira d'adapter

exemple pour le CPU 1

name="cpu",
arg="cpu1",
max=100,
bg_colour={0x0000ff,0.5},
fg_colour={0x00ff00,1},
mid_colour={{0.25,0xFFFF00,1},{0.5,0xFFFFFF,1},{0.75,0xFF0000,1}},
x=103,y=125,
blocks=15,
space=0.5,
height=5,width=5,
angle=90,
smooth = true,

en orange = couleur du bargraphe
en vert = position du bargraphe ..... x et y
en violet = nombre de bloc du bargraphe ( ici 15 sur 100 blocs )
en mauve = taille des blocs

=========================================================
conky_gray.lua a placer dans /lua

Code : Tout sélectionner

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

require 'cairo'

--------------------------------------------------------------------------------
--                                                                    clock DATA
-- HOURS
clock_h = {
    {
    name='time',                   arg='%H',                    max_value=12,
    x=90,                         y=100,
    graph_radius=58,
    graph_thickness=3,
    graph_unit_angle=30,           graph_unit_thickness=30,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.9,
    txt_radius=88,
    txt_weight=1,                  txt_size=16.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=1.0,
    graduation_radius=53,
    graduation_thickness=6,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1.0,
    },
}
-- MINUTES
clock_m = {
    {
    name='time',                   arg='%M',                    max_value=60,
    x=90,                         y=100,
    graph_radius=52,
    graph_thickness=2,
    graph_unit_angle=6,            graph_unit_thickness=6,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=0.9,
    txt_radius=70,
    txt_weight=1,                  txt_size=12.0,
    txt_fg_colour=0xfffffff,        txt_fg_alpha=1.9,
    graduation_radius=57,
    graduation_thickness=5,        graduation_mark_thickness=2,
    graduation_unit_angle=30,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=1.0,
    },
}
-- SECONDS
clock_s = {
    {
    name='time',                   arg='%S',                    max_value=60,
    x=90,                         y=100,
    graph_radius=49,
    graph_thickness=2,
    graph_unit_angle=6,            graph_unit_thickness=2,
    graph_bg_colour=0xffffff,      graph_bg_alpha=0.0,
    graph_fg_colour=0xFFFFFF,      graph_fg_alpha=1.0,
    txt_radius=40,
    txt_weight=0,                  txt_size=10.0,
    txt_fg_colour=0xFFFFFF,        txt_fg_alpha=0.7,
    graduation_radius=0,
    graduation_thickness=0,        graduation_mark_thickness=0,
    graduation_unit_angle=0,
    graduation_fg_colour=0xFFFFFF, graduation_fg_alpha=0.0,
    },
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-------------------------------------------------------------------------------
--                                                                         MAIN
function conky_main()
    if conky_window == nil then 
        return
    end

    local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
    local display = cairo_create(cs)
    
    local updates = conky_parse('${updates}')
    update_num = tonumber(updates)
    
    if update_num > 5 then
        go_clock_rings(display)
        go_gauge_rings(display)
    end
    
    cairo_surface_destroy(cs)
    cairo_destroy(display)
end

le conkyrc executant le code lua

Code : Tout sélectionner

--[[
Conky, a system monitor, based on torsmo

Any original torsmo code is licensed under the BSD license

All code written since the fork of torsmo is licensed under the GPL

Please see COPYING for details

Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2019 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
]]

conky.config = {
    alignment = 'top_right',
    background = false,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    extra_newline = false,
    font = 'DejaVu Sans Mono:size=12',
    gap_x = 20,
    gap_y = 30,
    minimum_height = 180,
    minimum_width = 180,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_transparent = true,
    own_window_class = 'Conky',
    own_window_type = 'desktop',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
    lua_load = '/home/moi/.conky/lua/conky_gray.lua',
    lua_draw_hook_post = 'main',
}

conky.text = [[
   ${font DejaVu:size=7}${voffset 45}${offset 43}${time %A}${font}
   ${font DejaVu:size=16}${voffset -5}${offset 50}${time %d}${font}
   ${font VeraBl:size=8}${voffset -5}${offset 40}${time %B}${font}
]]

=========================================================
Dernière modification par banditblue le ven. 31 déc. 2021, 19:35, modifié 26 fois.
La connaîssance n'a pas de limite.
Mais sa valeur, est d'autant plus grande, une fois partagé


Pc fixe --- MSI MPG Z490 Gaming Edge WiFi, I9-9900Kf, RTX3070Ti, 64Go DDR4, SSD 1Tera nvme gen4 Samsung 980 pro, SSD 1Tera WD Blacksn850X,3HDD 5Tera
Eeepc Asus 1015pem --- Intel Atom N550 Dual-core 1.5Ghz / DD 1Tera 7200rpm / Ram 2Go

Screenshot + Les Conky ===> http://forums.archlinux.fr/post85405.html#p85405
Avatar de l’utilisateur
onyx67
Elfe
Messages : 766
Inscription : dim. 06 nov. 2011, 18:12
Localisation : Alsace

Re: [Conky] Vos .conkyrc !

Message par onyx67 »

Bon j'y vais du miens aussi.
En fait c'est mon tout premier, un conky de newbie quoi! :pastaper:

Code : Tout sélectionner

#configuration Conky 2012_01_03


#paramètres de la fenêtre
own_window yes
own_window_type desktop
own_window_transparent yes

#paramètres de la police
use_xft yes
override_uft8_locale yes

#paramètres de la configuration
text_buffer_size
own_window_double yes
update_interval 1
double_buffer yes
alignment top_right
TEXT
ONYX-17  $kernel


Actif depuis: $uptime

Vitesse téléchargement:
${downspeedgraph eth0 22,150 00ff00 ff0000}
${offset 50}${voffset -31}${downspeed eth0}k/s

disque /:       TOP
${fs_bar 10,60 /root}        $running_processes/$processes
cpu:
$color${cpugraph}
usage CPU:
${top name 1} ${top pid 1} ${top cpu 1}
${top name 2} ${top pid 2} ${top cpu 2}
${top name 3} ${top pid 3} ${top cpu 3}
${top name 4} ${top pid 4} ${top cpu 4}

RAM: $memfree

usage RAM:
${top_mem name 1} ${top_mem pid 1} ${top_mem mem 1}
${top_mem name 2} ${top_mem pid 2} ${top_mem mem 2}
${top_mem name 3} ${top_mem pid 3} ${top_mem mem 3}
${top_mem name 4} ${top_mem pid 4} ${top_mem mem 4}
Voilà, me reste plus qu'à glaner des idées pour y mettre un peu de couleur:
Image
"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
Kristen
Elfe
Messages : 709
Inscription : ven. 14 oct. 2011, 10:24
Localisation : Finistère France

Re: [Conky] Vos .conkyrc !

Message par Kristen »

Bonjour
je voudrai afficher mon DD externe dans mon conky. Le problème est que le nom du DD est Expansion Drive . Le problème vient de l'espace entre Expansion et Drive
Voici ce que j'ai écrit.

Code : Tout sélectionner

${if_mounted /media/Expansion\040Drive}${goto 20}${voffset 5}${color1}Expansion Drive ${fs_size /media/Expansion\040Drive'} : ${color}${fs_used_perc /media/Expansion\040Drive}% ${alignr}${fs_free /media/Expansion\040Drive} ${fs_bar 5,80 /media/Expansion\040Drive}${endif}
Pour le moment, avec ${if_mounted /media/Expansion\040Drive} j'ai un affichage sur le conky mais par contre, toutes les données sont à 0. J'ai essayé avec /media/Expansion\ Drive /media/"Expansion Drive" sans succès.
Je dois mettre quoi pour que ça marche?
Merci
C'est bon j'ai trouvé

Code : Tout sélectionner

${if_mounted /media/Expansion\040Drive}${goto 20}${color1}Expansion Drive libre à ${fs_free_perc /media/Expansion Drive}%${color}${alignr}${fs_free /media/Expansion Drive}/${fs_size /media/Expansion Drive}${endif}
KDE Plasma sur
- fixe Intel Core i5-4570 CPU @ 3.20GHz × 4 - RAM 12 Go - Carte graphique GeForce GTX 750 Ti NV117 - Écran 24" et 23" hdmi
- Lenovo IdeaPad 3 15ALC6 - 15.6" - Ryzen 5 5500U - 16 Go RAM - 128 Go SSD + 1 To HDD
- Lenovo Ideapad S130-14IGM
Avatar de l’utilisateur
onyx67
Elfe
Messages : 766
Inscription : dim. 06 nov. 2011, 18:12
Localisation : Alsace

Re: [Conky] Vos .conkyrc !

Message par onyx67 »

> kristen
J'ai exactement le même problème avec un disque dur externe n'apparaissant pas dans le conky. Il s’appelle "Iomega HDD" (donc un nom avec un espace).
J'ai bêtement essayé

Code : Tout sélectionner

${if_mounted /media/Iomega\040HDD}
, mais sans résultat.
Pourrai-tu m'expliquer la commande et me dire ce qu'il faudrait faire?
Excellente idée en tout cas, et très pratique.
Merci
"La complication est un effet de la simplicité mal acquise"

Intel i5-2320; Nvidia GeForce GT 520; ATA Hitachi 2To; ArchLinux-KDE
Répondre