Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1751 Le 29/03/2010, à 10:03

HacKurx

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

Bonjour, j'ai une petite question, j'ai changé mon avant "text" de mon conkyrc afin de le rendre plus lisible mais depuis je n'ai plus les unités de mesure.
Je suis obligé d'écrire comme cela dans mon script du coup:
${upspeedf eth0} Kio/s
${totaldown eth0}io

Une idée pour résoudre mon problème?
Merci

Hors ligne

#1752 Le 29/03/2010, à 11:10

wlourf

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

driden91 a écrit :

Salut

je suis très intéressé par cette option de conky.

j'ai reussi a le faire marché en utilisant la libimpulse en 64bits.
j'ai une fenetre qui s'ouvre avec des l'equalizer qui s'affiche sous forme de barre.
Je le voudrais sous forme de cercle comme sur ton image

comment puis je faire cela ?

Salut,
pour cela, il faut modifier ton conky, commente avec # toutes les lignes qui commencent par lua_draw_hook_pre    et utilise une de ces lignes :

lua_draw_hook_pre spectrum widget 10 300 1 25 10 1 10 5 2
#lua_draw_hook_pre spectrum widget 10 300 1 20 10 1 10 4 1   
#lua_draw_hook_pre spectrum widget 10 300 1 20 10 0 20 5 0

mais bon, je ne sais pas chez toi, mais pour moi, ce n'est pas très synchro avec le son !

Hors ligne

#1753 Le 29/03/2010, à 11:11

wlourf

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

bonjour,

Dans la série des bons-gros-conky-qui-prennent-de-la-place, en voici un fait avec Lua qui affiche quelques infos. Rien de neuf, c'est du recyclage d'autres scripts mais avec une présentation différente.

Graphiques horizontaux pour la mémoire, le cpu, le dl, le ul, la température et la vitesse du ventilo.
Le graphique circulaire affiche le % d'utilisation de 2 à 5 partitions + l'horloge.

Et j'ai ajouté un script bash qui permet d'afficher ou non les textes.

Donc avec textes + 3 partitions, ça donne ça :
1269811839.png
et sans les textes + 5 partitions, ça donne ça :
1269812171.png

Si vous l'essayez, il y a un chemin à spécifier dans le conky ligne 48 (lua_load ...), dans le script lua il faut indiquer quelles partitions surveiller (lignes 611 à 615) et quels paramètres utiliser pour les scripts horizontaux (lignes 469 à 475), et le script bash écrit un fichier dans /tmp...

Donc, le conkyrc (avec conky 1.7.2 minimum), laisser une ligne (vide ou non) après TEXT:

# -- Conky settings -- #
background no
update_interval 5

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
imlib_cache_size 0

# -- Window specifications -- #

own_window yes
own_window_type desktop
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_title big conky

border_inner_margin 0
border_outer_margin 0

minimum_size 350 800

alignment tl
gap_x 0
gap_y 0

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

# -- Text settings -- #
use_xft yes
xftfont Santana:size=10
xftalpha 0.8

uppercase no

default_color FFFFFF

lua_load ~/scripts/bureau/widgets.lua
lua_draw_hook_pre main


TEXT

le script Lua : widgets.lua

require 'cairo'

--[[ BARGRAPH WIDGET
	v1.3 by wlourf (03 march 2010)
	This widget draw a simple bar like (old) equalizers on hi-fi systems.
	http://u-scripts.blogspot.com/
	
	The arguments are :
	- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'...
	  or you can set it to "" if you want to display a numeric value with arg=numeric_value
    - "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. 
      If you would not use an argument in the Conky variable, use ''.
	- "max" is the maximum value of the bar. If the Conky variable outputs a percentage, use 100.
	- "nb_blocks" is the umber of block to draw
	- "cap" id the cap of a block, possibles values are CAIRO_LINE_CAP_ROUND , CAIRO_LINE_CAP_SQUARE or CAIRO_LINE_CAP_BUTT
	  see http://www.cairographics.org/samples/set_line_cap/
	- "xb" and "yb" are the coordinates of the bottom left point of the bar, or the center of the circle if radius>0
	- "w" and "h" are the width and the height of a block (without caps), w has no effect for "circle" bar
	- "space" is the space betwwen two blocks, can be null or negative
	- "bgc" and "bga" are background colors and alpha when the block is not LIGHT OFF
	- "fgc" and "fga" are foreground colors and alpha when the block is not LIGHT ON
	- "alc" and "ala" are foreground colors and alpha when the block is not LIGHT ON and ALARM ON
	- "alarm" is the value where blocks LIGHT ON are in a different color (values from 0 to 100)
	- "led_effect" true or false : to show a block with a led effect
	- "led_alpha" alpha of the center of the led (values from 0 to 1)
	- "smooth" true or false : colors in the bar has a smooth effect
	- "mid_color",mid_alpha" : colors of the center of the bar (mid_color can to be set to nil)
	- "rotation" : angle of rotation of the bar (values are 0 to 360 degrees). 0 = vertical bar, 90 = horizontal bar
	- "radius" : draw the bar on a circle (it's no more a circle, radius = 0 to keep bars)
	- "angle_bar"  : if radius>0 angle_bar is the angle of the bar
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 March 2010) added parameters radius & angle_bar to draw the bar in a circular way
]]


function bar_graph(name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga,alc,ala,alarm,led_effect,led_alpha,smooth,mid_color,mid_alpha,rotation,radius, angle_bar)
 	local function rgb_to_r_g_b(colour, alpha)
		return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
	end

	local function setup_bar_graph()

		local value = 0
		if name ~="" then
			local str = conky_parse(string.format('${%s %s}', name, arg))
			value = tonumber(str)
		else
			value = arg
		end
		if value==nil then value =0 end
		local pct = 100*value/max
		local pcb = 100/nb_blocks
		
		cairo_set_line_width (cr, h)
		cairo_set_line_cap  (cr, cap)
		
		local angle_rot= rotation*math.pi/180
		local alpha_bar = (angle_bar*math.pi/180)/2
		for pt = 1,nb_blocks do  
			local light_on=false
			--set colors
			local col,alpha = bgc,bga
			if pct>=(100/nb_blocks/2) then --start after an half bloc
				if pct>=(pcb*(pt-1)) then 
					light_on=true
					col,alpha = fgc,fga
					if pct>=alarm and (pcb*pt)>alarm then col,alpha = alc,ala end
				end
			end

			--vertical points
			local x1=xb
			local y1=yb-pt*(h+space)
			local radius0 = yb-y1
	
			local x2=xb+radius0*math.sin(angle_rot)
			local y2=yb-radius0*math.cos(angle_rot)
			
			--line on angle_rot
			local a1=(y2-yb)/(x2-xb)
			local b1=y2-a1*x2

			--line perpendicular to angle_rot
			local a2=-1/a1
			local b2=y2-a2*x2
			
			--dots on perpendicular
			local xx0,xx1,yy0,yy1=0,0,0,0
			if rotation == 90  or rotation == 270 then
				xx0,xx1=x2,x2
				yy0=yb
				yy1=yb+w
			else
				xx0,xx1=x2,x2+w*math.cos(angle_rot)
				yy0=xx0*a2+b2
				yy1=xx1*a2+b2
			end

			local xc,yc
			--perpendicular segment
			if alpha_bar == 0 then
				cairo_move_to (cr, xx0 ,yy0)
				cairo_line_to (cr, xx1 ,yy1)
				xc,yc=(xx0+xx1)/2,(yy0+yy1)/2
			else			
				cairo_arc( cr,
					xb,
					yb,
					radius+(h+space)*(pt)-h/2,
					( -alpha_bar -math.pi/2+angle_rot) ,
					( alpha_bar -math.pi/2+angle_rot) 
				)
				xc=xb+	(radius+(h+space)*(pt))*math.sin(angle_rot)
				yc=yb-	(radius+(h+space)*(pt))*math.cos(angle_rot)			
			end
		
			--colors
			if light_on and led_effect then
				local pat = cairo_pattern_create_radial (xc, yc, 0, xc,yc,w/1.5)
				cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(col,led_alpha))
				cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(col,alpha))
				cairo_set_source (cr, pat)
				cairo_pattern_destroy(pat)
			else
				cairo_set_source_rgba(cr, rgb_to_r_g_b(col,alpha))
			end 

			if light_on and smooth then
				local radius = (nb_blocks+1)*(h+space)
				if pt==1 then 
					xc0,yc0=xc,yc --remember the center of first block
				end
				cairo_move_to(cr,xc0,yc0)
				local pat = cairo_pattern_create_radial (xc0, yc0, 0, xc0,yc0,radius)
				cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(fgc,fga))
				cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(alc,ala))
				if mid_color ~=nil then
					cairo_pattern_add_color_stop_rgba (pat, 0.5,rgb_to_r_g_b(mid_color,mid_alpha))
				end
				cairo_set_source (cr, pat)
				cairo_pattern_destroy(pat)
			end 
		
			cairo_stroke (cr);

		end
	end
	
	--prevent segmentation error
	local updates=tonumber(conky_parse('${updates}'))
	if updates> 3 then
		setup_bar_graph()
	end	
end


--END OF BARGRAPH WIDGET

--[[CLOCK SHADED WIDGET by wlourf (07 feb. 2010)
	http://u-scripts.blogspot.com/
	This clock is designed to draw only hands with some shadows and a small dot in the center.

	Was originaly based on  Air Clock by londonali (2009)

	You can adjust the clock's radius for each hand, as well as the size and offset of the drop shadow.
	You can also choose whether to display the seconds hand. 
	This clock updates every time Conky does, so if you want to show seconds, it is recommended that you set update_interval to no more than 0.5s.
	If you turn off seconds, you can set the update_interval to as long as 30s.

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/clock/clock.lua):
	lua_load ~/scripts/clock/clock.lua
	lua_draw_hook_pre draw_clock

-- 10 jan. 2010 v1.0 original release
   07 feb. 2010 v1.1 turn the clock into a widget + some improvments
	
	
	== PARAMETERS ==
	
	clock_r 	= Radius of the clock, in pixels
	xc, yc 		= x and y coordinates of center, relative to the top left corner of Conky, in pixels
	
	rh, lgh, fgh, bosh, bofgh, shadh,
	rm, lgm, fgm, bosm, bofgm, shadm,
	rs, lgs, fgs, boss, bofgs, shads,
	--r.    = radius of footer of hand
	--lg.   = length of hand (it's a kind of proportion of clock_r, not pixels
	--        a value of 2 is close to the radius )
	--fg.   = foreground color of hand (can be nil)
	--bos.  = border size of hand (can be zero)
	--bofg. = border foreground color (can be nil)
	--shad. = shadow foreground color (can be nil) 
	
	show_seconds [true/false]	display seconds hand ?
	 
	shadow_xoffset, shadow_yoffset
	-- x and y offsets of the drop shadow, relative to the centre of the clock face, in pixels. 
	-- Can be positive (downward) or negative (upward)	
	shadow_opacity [0 to 1]  	set the opacity of the shadow
	
	dot_pc,dot_color,dot_shadow_color,shadow_length
	-- dot_pc [0 to 1] 	is the size of the dot percent of the minimum radius (rh,rm,rs)
    -- dot_color = the foreground color of the dot
    -- dot_shadow_color = the foreground color of the shadow of the dot
    -- shadow_length =  length of the shadow

]]

function clock_widget(clock_r,xc,yc,
	rh, lgh, fgh, bosh, bofgh, shadh,
	rm, lgm, fgm, bosm, bofgm, shadm,
	rs, lgs, fgs, boss, bofgs, shads,
	show_seconds,
	shadow_xoffset,shadow_yoffset,
	shadow_opacity,
	dot_pc,dot_color,dot_shadow_color,shadow_length
)

	--local to global
	g_clock_r=clock_r
	g_xc,g_yc=xc,yc
	g_shadow_xoffset,g_shadow_yoffset,g_shadow_opacity=shadow_xoffset,shadow_yoffset,shadow_opacity
	
	-- Grab time
	local hours=os.date("%I")
	local mins=os.date("%M")
	local secs=os.date("%S")

	--angles needed to draw the hands	
	gamma = math.pi/2-math.atan(rs/(clock_r*lgs))
	secs_arc=(2*math.pi/60)*secs
	secs_arc0=secs_arc-gamma
	secs_arc1=secs_arc+gamma
	
	gamma = math.pi/2-math.atan(rm/(clock_r*lgm))
	mins_arc=(2*math.pi/60)*mins + secs_arc/60
	mins_arc0=mins_arc-gamma
	mins_arc1=mins_arc+gamma
	
	gamma = math.pi/2-math.atan(rh/(clock_r*lgh))
	hours_arc=(2*math.pi/12)*hours+mins_arc/12
	hours_arc0=hours_arc-gamma
	hours_arc1=hours_arc+gamma

	--draw hands
	draw_hand(hours_arc,hours_arc0,hours_arc1,lgh,rh,fgh,bosh,bofgh,shadh)
	draw_hand(mins_arc, mins_arc0, mins_arc1, lgm,rm,fgm,bosm,bofgm,shadm)
	
	if show_seconds then
		draw_hand(secs_arc, secs_arc0, secs_arc1, lgs,rs,fgs,boss,bofgs,shads)
	end
	
	if dot_pc>0 then
		--draw dot center
		lg_shadow_center=5
		radius=math.min(rh,rm,rs)*dot_pc
		if radius<1 then radius=1 end
		ang = math.atan(shadow_yoffset/ shadow_xoffset)
		
		if shadow_xoffset>=0 then ang=ang+math.pi/2 end
		if shadow_xoffset<0 then ang=ang-math.pi/2 end

		x0 = xc + radius*math.sin(ang-math.pi/2)
		y0 = yc - radius*math.cos(ang-math.pi/2)
		xx = xc + (radius)*math.sin(ang-math.pi)*shadow_length
		yy = yc - (radius)*math.cos(ang-math.pi)*shadow_length
		x1 = xc - radius*math.sin(ang-math.pi/2)
		y1 = yc + radius*math.cos(ang-math.pi/2)

		cairo_move_to(cr,x0,y0)
		cairo_curve_to(cr,x0,y0,xx,yy,x1,y1)

		pat = cairo_pattern_create_radial (xc, yc, 0,
		                           			xc,yc, radius*2);

		cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(dot_shadow_color,shadow_opacity));
		cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(dot_shadow_color,0));
		cairo_set_source (cr, pat);
		cairo_fill (cr);

		--gradient inside the dot circle
		xshad = xc + radius*math.sin(ang)*.5
		if shadow_xoffset==0 then xshad = xc  end
		yshad = yc - radius*math.cos(ang)*.5
		if shadow_yoffset==0 then yshad = yc  end
		local ds_pat=cairo_pattern_create_radial(xc,yc,0,
			xshad,yshad,radius)
		cairo_pattern_add_color_stop_rgba(ds_pat,0,rgb_to_r_g_b(dot_color,1))
		cairo_pattern_add_color_stop_rgba(ds_pat,1,0,0,0,1)

		cairo_arc(cr,xc,yc,radius,0,2*math.pi)
		cairo_set_source(cr,ds_pat)
		cairo_fill(cr)
	end
	
	cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
	cairo_set_font_size (cr, 12.0);

end 

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


function draw_hand(arc,arc0,arc1,lg,r,fg_color,border_size,border_color,shadow_color)
	--global to local
	xc=g_xc
	yc=g_yc
	clock_r=g_clock_r
	shadow_xoffset,shadow_yoffset,shadow_opacity=g_shadow_xoffset,g_shadow_yoffset,g_shadow_opacity
	
	--calculs
	xx = xc + clock_r*math.sin(arc)*lg
	yy = yc - clock_r*math.cos(arc)*lg
	x0 = xc + r*math.sin(arc0)
	y0 = yc - r*math.cos(arc0)
	x1 = xc + r*math.sin(arc1)
	y1 = yc - r*math.cos(arc1)
	
	--shadow
	--shadow header
	if shadow_color ~= nil then
		cairo_move_to (cr, x0, y0)
		cairo_curve_to (cr, x0, y0, xx-shadow_xoffset, yy-shadow_yoffset, x1, y1)
		--shadow footer
		cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2)	
		pat = cairo_pattern_create_radial (xc, yc, 0,
		                           			xc,yc, (clock_r/2)*lg)
		cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(shadow_color,shadow_opacity))
		cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 0)
		cairo_set_source (cr, pat)
		cairo_fill (cr)
	end	
	
	--border
	if border_size>0 and border_color~=nil then
		cairo_set_line_width(cr,border_size)
		pat = cairo_pattern_create_radial (xc, yc, clock_r/10,
		                           			xc,yc, clock_r*lg)
		cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(border_color,1))
		cairo_pattern_add_color_stop_rgba (pat, 0.75, 0, 0, 0, 1)
		cairo_set_source (cr, pat)
		--header
		cairo_move_to (cr, x0, y0)
		cairo_curve_to (cr, x0, y0, xx, yy, x1, y1)
		--footer
		cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2)
		cairo_stroke(cr)
	end	

	if border_size>0 and border_color==nil then
		print ("Error : try to draw a border with color set to nil")
	end	
	
	--hand
	--hand header
	if fg_color ~= nil then
		cairo_move_to (cr, x0, y0)
		cairo_curve_to (cr, x0, y0, xx, yy, x1, y1)
		--hand footer
		cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2)	
		pat = cairo_pattern_create_radial (xc, yc, clock_r/10,
		                           			xc,yc, clock_r*lg)
		cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(fg_color,1))
		cairo_pattern_add_color_stop_rgba (pat, 0.75, 0, 0, 0, 1)
		cairo_set_source (cr, pat)
		cairo_fill (cr)
	end
	cairo_pattern_destroy (pat)
	
end
--]] END OF WIDGET













---fonction principale ------------

function conky_main()
	local height_graph2
    local fgc,fga = 0x999999, 0.5
    local alc,ala = 0xFFFFFF, 1
    local w,h=5,5
    local s=1
    
 	local function rgb_to_r_g_b(colour, alpha)
		return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
	end

	local function draw_text(xb,yb,txt,value,unit,color)
		local pat = cairo_pattern_create_linear(xb,yb,height_graph2+xb,yb)
		cairo_pattern_add_color_stop_rgba (pat, 0, rgb_to_r_g_b(fgc,1));
		cairo_pattern_add_color_stop_rgba (pat, 0.5,rgb_to_r_g_b(color,1));
		cairo_pattern_add_color_stop_rgba (pat, 1, rgb_to_r_g_b(alc,1));
		cairo_set_source (cr, pat);

		cairo_move_to(cr, xb,yb);
		cairo_show_text(cr,txt .. " " .. tostring(value) .. " " ..unit)
		cairo_pattern_destroy(pat)
		--cairo_set_line_width(cr,1)
		--cairo_move_to(cr,0,0)
		--cairo_line_to(cr,height_graph2,0)
		--cairo_stroke(cr)
	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)
    
    cr = cairo_create(cs)

	local file = io.open("/tmp/flag-conky","r")	
	io.close()
	local flag=(file ~= nil)
    local x0,y0 = 10, 290
    local y00=750
    local cap_round = CAIRO_LINE_CAP_ROUND
    local cap_square = CAIRO_LINE_CAP_SQUARE
    local cap_butt = CAIRO_LINE_CAP_BUTT

    local bgc,bga = 0x333333, 0.5
    local mid_alpha =  0.5
    local led_effect, led_alpha = false ,  1.0
    local alarm = 95
    local smooth = true
    local col_mem = 0x6600FF
    local col_cpu = 0x9999FF
    local col_dl = 0xCC6666
    local col_ul = 0xCCCC66
 	local blocks = 10
    local height_graph=blocks*(h+s+1)
    height_graph2=(blocks)*(h+s)
    
	--four horizontal graph
    local updates=tonumber(conky_parse('${updates}'))
    if len_t == nil then     
        len_t=55
        t1,t2,t3,t4,t5,t6={},{},{},{},{},{}
    end

    
    for i = 1, tonumber(len_t) do
        if t1[i+1]==nil then t1[i+1]=0 end
        if t2[i+1]==nil then t2[i+1]=0 end
        if t3[i+1]==nil then t3[i+1]=0 end
        if t4[i+1]==nil then t4[i+1]=0 end
        if t5[i+1]==nil then t5[i+1]=0 end
        if t6[i+1]==nil then t6[i+1]=0 end
        t1[i]=t1[i+1]
        t2[i]=t2[i+1]
        t3[i]=t3[i+1]
        t4[i]=t4[i+1]
        t5[i]=t5[i+1]
        t6[i]=t6[i+1]        
        if i==len_t  and updates>3 then
        	--VALEURS POUR LES BARGRAPHS
            t1[len_t]=tonumber(conky_parse('${memperc}'))
            t2[len_t]=tonumber(conky_parse('${cpu}'))
            t3[len_t]=tonumber(conky_parse('${downspeedf eth0}'))
            t4[len_t]=tonumber(conky_parse('${upspeedf   eth0}'))
            t5[len_t]=tonumber(conky_parse("${exec sensors | grep 'Sys Temp' | cut -c15-16}"))
           -- t5[len_t]=tonumber(conky_parse("${exec sensors | grep 'temp1' | cut -c15-16}"))
            t6[len_t]=tonumber(conky_parse("${exec sensors | grep 'CPU Fan' | cut -c9-16}"))
        end
        --(reminder
        --(name, arg, max, nb_blocks, cap, xb, yb, w, h, space, bgc, bga, fgc, fga,alc,ala,alarm,led_effect,led_alpha,smooth,mid_color,mid_alpha,rotation,radius,angle_bar)    
        --horizontal gradient like
        local bggrad = bga*i/tonumber(len_t)
        local fggrad = fga*i/tonumber(len_t)
        local alagrad = ala*i/tonumber(len_t)
        local midgrad = mid_alpha*i/tonumber(len_t)
        
        bar_graph('', t1[i],    100,    blocks, cap_round, x0+i*5+2, y0-10,
             0,h,s,bgc,bggrad, fgc,fggrad,alc, alagrad, alarm, led_effect, led_alpha,smooth,col_mem,midgrad,0,0,0)

        bar_graph('', t2[i],    100,    blocks, cap_round, x0+i*5+2, y0-10-height_graph,
             0,h,s,bgc,bggrad, fgc,fggrad,alc, alagrad, alarm, led_effect, led_alpha,smooth,col_cpu,midgrad,0,0,0)

        bar_graph('', t3[i],    2000,    blocks, cap_round, x0+i*5+2, y0-10-height_graph*2,
             0,h,s,bgc,bggrad, fgc,fggrad,alc, alagrad, alarm, led_effect, led_alpha,smooth,col_dl,midgrad,0,0,0)

        bar_graph( '', t4[i],   100,    blocks, cap_round, x0+i*5+2, y0-10-height_graph*3,
             0,h,s,bgc,bggrad, fgc,fggrad,alc, alagrad, alarm, led_effect, led_alpha,smooth,col_ul,midgrad,0,0,0)

        bar_graph( '', t5[i],   100,    blocks, cap_round, x0+i*5+2, y00-10,
             0,h,s,bgc,bggrad, fgc,fggrad,alc, alagrad, alarm, led_effect, led_alpha,smooth,col_cpu,midgrad,0,0,0)

        bar_graph( '', t6[i],   1500,    blocks, cap_round, x0+i*5+2, y00-10-height_graph,
             0,h,s,bgc,bggrad, fgc,fggrad,alc, alagrad, alarm, led_effect, led_alpha,smooth,col_mem,midgrad,0,0,0)
    end
         
    if flag then
		--test for mem,cpu and internet speeds
	  	cairo_set_font_size(cr,12)

	  	cairo_select_font_face(cr, "Shado",
		  CAIRO_FONT_SLANT_NORMAL,
		  CAIRO_FONT_WEIGHT_NORMAL);    
		cairo_save(cr)
		cairo_translate(cr,x0+len_t*5+20,y0-13)
		cairo_rotate(cr,-math.pi/2)

		draw_text(0,0,"Mem",t1[len_t],"%",col_mem)
		draw_text(height_graph+1,0,"Cpu",t2[len_t],"%",col_cpu)
	
		if #tostring(t3[len_t])>=5 then cairo_set_font_size(cr,10) end
		draw_text(2*height_graph+1,0,"D",t3[len_t],"k/s",col_dl)
	
		draw_text(3*height_graph+1,0,"U",t4[len_t],"k/s",col_ul)

		cairo_restore(cr)
		cairo_translate(cr,x0+len_t*5+20,y00-13)
		cairo_rotate(cr,-math.pi/2)
		cairo_save(cr)
		draw_text(0,0,"T ",t5[len_t],"°C",col_cpu)
		draw_text(height_graph-5,0,"",t6[len_t],"rpm",col_mem)
		cairo_restore(cr)
	 end
	
    -- disk space with circular bargraph for /, /home, /data, and /mini and/or /antec when mounted
    function draw_value_for_circle(arc,arc_nb,xc,yc,h,s,radius,blocks,value_pc,color,txt,value_txt)
		function write_text(xt,yt)
			cairo_move_to(cr,xt,yt-3)
			cairo_show_text(cr,txt .. " " .. value_txt)
		end
		
		function set_pattern(x0,y0,x1,y1)
			local pat = cairo_pattern_create_linear(x0,y0,x1,y1)
			cairo_pattern_add_color_stop_rgba (pat, 0, 0.5,0.5,0.5,1)
			cairo_pattern_add_color_stop_rgba (pat, 1,rgb_to_r_g_b(color, 1))
			cairo_set_source (cr, pat);		
			cairo_pattern_destroy(pat)		
		end
		cairo_set_line_width(cr,h)
		cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
		cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
		cairo_set_source_rgba(cr, rgb_to_r_g_b(color, 1))
		cairo_move_to(cr,xc,yc)
		local z1=radius+(h+s)*(blocks+0.5)*value_pc/100
		local z2=radius+(h+s)*(blocks+4)
		local dy=z2+20
		local dx=z2+60
		
		arc_r=(arc*(arc_nb-1)*math.pi/180)
		local x0,y0=xc+z1*math.sin(arc_r),yc-z1*math.cos(arc_r)
		local x1,y1=xc+z2*math.sin(arc_r),yc-z2*math.cos(arc_r)
		cairo_move_to(cr,x0,y0)
		cairo_line_to(cr,x1,y1)

		if arc_nb==1 then 
			set_pattern(xc-dx,y1,x1,y1)
			cairo_line_to(cr,xc-dx,yc-z2*math.cos(arc_r)) 
			write_text(xc-dx,yc-z2*math.cos(arc_r))
		end
		
		if arc_nb==2 then
			if y1>yc then 
				Y2=yc+dy
			else
				Y2=yc-dy
			end
			cairo_line_to(cr,x1,Y2)
			set_pattern(xc-dx,Y2, x1,Y2)
			cairo_line_to(cr,xc-dx,Y2)
			write_text(xc-dx,Y2)
		end
		if arc_nb==3 then
			if arc_r<=math.pi then
				cairo_line_to(cr,xc+z2*math.sin(arc_r),yc+dy)
				Y3=yc+dy
				set_pattern(xc-dx,Y3, xc+z2*math.sin(arc_r),yc+dy)
			else
				Y3=yc-z2*math.cos(arc_r)
				set_pattern(xc-dx,Y3, xc+z2*math.sin(arc_r),yc-z2*math.cos(arc_r))
			end
			
			cairo_line_to(cr,xc-dx,Y3)
			write_text(xc-dx,Y3)
		end
		if arc_nb>=4 then
			set_pattern(xc-dx,yc-z2*math.cos(arc_r),xc+z2*math.sin(arc_r),yc-z2*math.cos(arc_r) )
			cairo_line_to(cr,xc-dx,yc-z2*math.cos(arc_r))
			write_text(xc-dx,yc-z2*math.cos(arc_r))
		end
		
		cairo_stroke(cr)
		
	end
    
    cr = cairo_create(cs)
    local nb_arcs=2
    local h=3
    local blocks = 20
    local alc,ala = 0xFF0000, .8
    local alarm = 75

    local radius=15
    --PARTIIONS A SURVEILLER
    local p1txt={"/","/"}
    local p2txt={"/home","home"}
    local p3txt={"/data","data"}
    local p4txt={"/media/mini","mini"}
    local p5txt={"/media/antec","antec"}
    local p3_mnt=tonumber(conky_parse("${if_mounted " .. p3txt[1] .. "}1${else}0${endif}"))
    local p4_mnt=tonumber(conky_parse("${if_mounted " .. p4txt[1] .. "}1${else}0${endif}"))
    local p5_mnt=tonumber(conky_parse("${if_mounted " .. p5txt[1] .. "}1${else}0${endif}"))
    nb_arcs=nb_arcs+p3_mnt+p4_mnt+p5_mnt
    local arc=360/nb_arcs
    local smooth =true
    local col1,col2,col3,col4,col5 = 0x6600FF,0x3300FF,0x6633FF,0x9966FF,0x6633CC
    
    fgc=0xDDDDDD
    local xc,yc=190,450
    if not flag then xc = conky_window.width/2 end

  	cairo_set_font_size(cr,12)

  	cairo_select_font_face(cr, "Shado",
	  CAIRO_FONT_SLANT_NORMAL,
	  CAIRO_FONT_WEIGHT_NORMAL);    
	  
	
    alarm=tonumber(conky_parse("${fs_used_perc " .. p1txt[1] .. "}"))
    alc=col1
    bar_graph('',alarm,    100,    blocks, cap_butt,xc,yc,
        10,h,s,bgc,bga, fgc,fga, alc,ala, alarm, led_effect, led_alpha,smooth,mid_color,mid_alpha,0,radius,arc)
 	if flag then
		draw_value_for_circle(arc,1,xc,yc,h,s,radius,blocks,alarm,alc,p1txt[2],conky_parse("${fs_free " .. p1txt[1] .."/}"))   	
 	end
    
    alarm=tonumber(conky_parse("${fs_used_perc " .. p2txt[1] .."}"))
    alc=col2
    bar_graph('',alarm,    100,    blocks, cap_butt, xc,yc,
        10,h,s,bgc,bga, fgc,fga, alc,ala, alarm, led_effect, led_alpha,smooth,mid_color,mid_alpha,arc,radius,arc)

    
	if flag then 
	 	draw_value_for_circle(arc,2,xc,yc,h,s,radius,blocks,alarm,alc,p2txt[2],conky_parse("${fs_free " .. p2txt[1] .."}"))
    end
	
	if p3_mnt==1 then
		alarm = tonumber(conky_parse("${fs_used_perc " .. p3txt[1] .."}"))
	    alc=col3
		bar_graph('',alarm,    100,    blocks, cap_butt,xc,yc, 10,h,s,bgc,bga, fgc,fga, alc,ala, alarm, led_effect,
			led_alpha,smooth,mid_color,mid_alpha,arc*(nb_arcs+p3_mnt-p4_mnt-2-p5_mnt),radius,arc)
		if flag then 
			draw_value_for_circle(arc,(nb_arcs+p3_mnt-p4_mnt-1-p5_mnt),xc,yc,h,s,radius,blocks,alarm,alc,
				p3txt[2],conky_parse("${fs_free " .. p3txt[1] .. "}"))  
		end
	end
	
	if p4_mnt==1 then
		alarm = tonumber(conky_parse("${fs_used_perc " .. p4txt[1] .. "}"))
	    alc=col4
		bar_graph('',alarm,    100,    blocks, cap_butt,xc,yc,
		     10,h,s,bgc,bga, fgc,fga, alc,ala, alarm, led_effect, led_alpha,smooth,mid_color,mid_alpha,
		     	arc*(nb_arcs+p4_mnt-2-p5_mnt),radius,arc)
		if flag then 
			draw_value_for_circle(arc,(nb_arcs+p4_mnt-1-p5_mnt),xc,yc,h,s,radius,blocks,alarm,alc,p4txt[2],
				conky_parse("${fs_free " .. p4txt[1] .. "}"))  
		end
	end
    if p5_mnt==1 then
	    alarm = tonumber(conky_parse("${fs_used_perc " .. p5txt[1] .."}"))
	    alc=col5
	    bar_graph('', alarm,    100,    blocks, cap_butt, xc,yc,
	         10,h,s,bgc,bga, fgc,fga, alc,ala, alarm, led_effect, led_alpha,smooth,mid_color,mid_alpha,
	         arc*(nb_arcs+p5_mnt-2),radius,arc)
		if flag then 
			draw_value_for_circle(arc,(nb_arcs+p5_mnt-1),xc,yc,h,s,radius,blocks,alarm,alc,p5txt[2],
				conky_parse("${fs_free " .. p5txt[1] .."}"))  
		end
	end
        
	--end of disk space
	
	--clock
		clock_widget(
		100,xc,yc,						--radius, xc, yc
		radius,1.6,0x6600FF,h,0x9999CC,nil, 	--h: radius, lg, color, border size, border_color, shadow_color
		radius*.8,2,0x6600FF,h,0x9999CC,nil,  	--m; the same
		radius,1.5,0x6600FF,h,0x9999CC,nil, 		--s : the same
		false,							    --show second hand	
		-50,0,0, 							--shadow x , y & opacity 
		.25,0x666666,0x000000,2 				--dot percent, color and shadow color and shadow length
		)

    cairo_destroy(cr)
    cairo_surface_destroy(cs)

end

et le script bash qui permet de basculer l'affichage, évidemment, il vaut mieux le lancer par un raccourci clavier pour plus de commodité !

#!/bin/bash
flag="/tmp/flag-conky"
if [ -f $flag ]; then
	rm $flag
else
	echo > $flag
fi

Voilà !

Hors ligne

#1754 Le 29/03/2010, à 14:38

JB-home

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

j'ai testé wlourf, ça en jette big_smile

moi j'suis content j'ai réussi à modifié mon thème et à modelé tint2 comme je voulais.

http://interog.free.fr/ZDesktop.png

Hors ligne

#1755 Le 29/03/2010, à 20:08

wlourf

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

merci, le tien n'est pas mal non plus ! Tu peux poster le code pour les bargraphs des cpu STP, merci d'avance!

Hors ligne

#1756 Le 29/03/2010, à 21:01

JB-home

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

Tien voilà ( merci à RegisBurin pour la police -> http://www.dafont.com/fr/fnt-basicshapes1.font )

TEXT
     CPU 0${color #e49c16}: ${color}   ${font FnT_BasicShapes1:size=6}${if_match ${cpu cpu0} >0}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >10}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >20}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >30}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >40}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >50}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >60}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >70}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >80}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu0} >90}${color red}0${else}${color2}p${endif}${font plasmatic:size=6}    ${color red}${execi 8 sensors | grep -A 1 "Core 0" | cut -c15-23 |  sed '/^$/d'}${color}
${cpubar cpu5 2,200}
     CPU 1${color #e49c16}: ${color}   ${font FnT_BasicShapes1:size=6}${if_match ${cpu cpu1} >0}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >10}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >20}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >30}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >40}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >50}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >60}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >70}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >80}${color red}0${else}${color2}p${endif}${if_match ${cpu cpu1} >90}${color red}0${else}${color2}p${endif}${font plasmatic:size=6}    ${color red}${execi 8 sensors | grep -A 1 "Core 1" | cut -c15-23 |  sed '/^$/d'}${color}

Dernière modification par z0rg> (Le 29/03/2010, à 21:02)

Hors ligne

#1757 Le 29/03/2010, à 21:18

RegisBurin

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

J'avais toujours pas posté mon conkyrc du post #1736... hmm

Je remets:
201003292210463360x1050.th.png

Concky du haut (simple, il tient en deux lignes wink ... 'fin, ça pique les yeux quand même):

#=================================#
# Conky "system" selon regis v0.3 #
#=================================#
#Position-------------------------
alignment top_left
gap_x 1690
gap_y 5
maximum_width 1670
minimum_size 1670 25
#Apparence------------------------
background yes
use_spacer yes
own_window yes
own_window_type override
own_window_transparent yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
stippled_borders 10
border_margin 0
border_width 0
#Systeme--------------------------
cpu_avg_samples 4
net_avg_samples 4
out_to_console no
update_interval 1
double_buffer yes
no_buffers yes
uppercase no
#Polices--------------------------
use_xft yes
xftfont Neuropolitical:size=11
xftalpha .1
override_utf8_locale yes
#Couleurs-------------------------
color1 8c8c8c
color2 4d824f

TEXT
${color1}Cpu 1:${goto 55}${cpubar cpu1 10,150} ${font Neuropolitical:size=10}${color2}${cpu cpu1}%${voffset -1}${font}${goto 250}${color1}Ram: ${membar 10,150} ${font Neuropolitical:size=10}${color2}${memperc}%${voffset -2}${font}${color1}${goto 509}${font Neuropolitical:size=10}Openbox Studio ${kernel}${goto 946}${voffset -5}${font Minisystem:size=20}${color2}${time %a}${time %d}.${time %b}${voffset -9}${font}${color1}${goto 1370}/ : ${font fnt_basicshapes1: size=8}${if_match ${fs_used_perc /} >0}0${else}p${endif}${if_match ${fs_used_perc /} >10}0${else}p${endif}${if_match ${fs_used_perc /} >20}0${else}p${endif}${if_match ${fs_used_perc /} >30}0${else}p${endif}${if_match ${fs_used_perc /} >40}0${else}p${endif}${if_match ${fs_used_perc /} >50}0${else}p${endif}${if_match ${fs_used_perc /} >60}0${else}p${endif}${if_match ${fs_used_perc /} >70}0${else}p${endif}${if_match ${fs_used_perc /} >80}0${else}p${endif}${if_match ${fs_used_perc /} >90}0${else}p${endif}${voffset -3}${font}${alignr 10}${color2}${fs_free_perc /}%${goto 1623}${font Neuropolitical:size=10}libres
${font}${voffset 2}${color1}Cpu2:${goto 55}${cpubar cpu2 10,150} ${font Neuropolitical:size=10}${color2}${cpu cpu2}%${voffset -1}${font}${goto 250}${color1}Swap: ${swapbar 10,139}${goto 509}${voffset -3}${font Minisystem:size=12}Up : ${uptime}${color1}${goto 763}${font Minisystem:size=34}${color2}${voffset -23}${time %k:%M:%S}${goto 1142}${font Minisystem:size=11}${color1}bureau${goto 1200}${voffset -21}${color2}${font Minisystem:size=24}${desktop}${voffset -14}${color1}${font Neuropolitical:size=10}${goto 1223}${desktop_name}${voffset 16}${font}${goto 1337}Docs : ${font fnt_basicshapes1: size=8}${if_match ${fs_used_perc /media/Documents} >0}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >10}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >20}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >30}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >40}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >50}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >60}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >70}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >80}0${else}p${endif}${if_match ${fs_used_perc /media/Documents} >90}0${else}p${endif}${voffset -2}${font}${alignr 10}${color2}${fs_free_perc /media/Documents}%${goto 1623}${font Neuropolitical:size=10}libres

Le conky "boite à c..." (inspiré de celui de tap.telrad):

#emplacement
alignment bottom_left

#pour que conky tourne en arriere plan
background yes

#nombre d'echantillons a utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 4
net_avg_samples 4

#affiche le texte sur la sortie standard
out_to_console no

# utiliser sa propre fenetre ?
own_window yes

#type de fenetre : normal(avec le cadre) / override / desktop
own_window_type override

#pseudo transparence?
own_window_transparent yes

# taux de raffraichissement de la fenetre (en secondes)
update_interval 5

# pour eviter le clignotement de la semaine (fonctionne pas chez moi)
double_buffer yes

# afficher les ombres?
draw_shades no

# afficher des contours ?
draw_outline no

#contours autour des blocs de texte?
draw_borders no

# contour en trait-tillés, longueur d'un trait en pixels
stippled_borders 10

#largeur des marges (n'a pas l'air de fonctionner)
border_margin 100

# largeur du contour
border_width 1

# couleur par defaut du texte, de l'ombre et du contour
default_color white
default_shade_color white
default_outline_color white

# ecart avec le bord x=gauche ou droit y= haut ou bas
gap_x 1705
gap_y 10

# Ajoute des espaces apres certains objets pour eviter de les faire bouger.
# Fonctionne uniquement avec la police Monospace
use_spacer no

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

# Tout le texte en majuscule ?
uppercase no
#${offset 5}${exec cat ~/scripts/prog_tv/TVprog.txt}

#Polices--------------------------
use_xft yes
xftfont Neuropolitical:size=11
xftalpha .1
override_utf8_locale yes

#Couleurs-------------------------
color1 8c8c8c
color2 4d824f

TEXT
${color2}Boite à cons:
${voffset -6}${hr}
TF1${goto 200}${color1}${font Minisystem:size=12}${exec sed -n "1p" ~/scripts/prog_tv/TVprog.txt}${font}
${color2}Fr2${goto 200}${color1}${font Minisystem:size=12}${exec sed -n "2p" ~/scripts/prog_tv/TVprog.txt}${font}
${color2}Fr3${goto 200}${color1}${font Minisystem:size=12}${exec sed -n "3p" ~/scripts/prog_tv/TVprog.txt}${font}
${color2}C+${goto 200}${color1}${font Minisystem:size=12}${exec sed -n "4p" ~/scripts/prog_tv/TVprog.txt}${font}
${color2}Arte${goto 200}${color1}${font Minisystem:size=12}${exec sed -n "5p" ~/scripts/prog_tv/TVprog.txt}${font}
${color2}M6${goto 200}${color1}${font Minisystem:size=12}${exec sed -n "6p" ~/scripts/prog_tv/TVprog.txt}${font}

Le script qui va avec:

#!/bin/bash

function FromHtml ()
{
    sed -i 's/\&agrave;/à/g
            s/\&acirc;/â/g
            s/\&auml;/ä/g
            s/\&ccedil;/ç/g
            s/\&egrave;/è/g
            s/\&eacute;/é/g
            s/\&ecirc;/ê/g
            s/\&euml;/ë/g
            s/\&icirc;/î/g
            s/\&iuml;/ï/g
            s/\&ugrave;/ù/g
            s/\&uuml;/ü/g
            s/\&ucirc;/û/g
            s/\&#039;/\'\''/g
            s/\&amp;/\&/g' $1
}

cd ~/scripts/prog_tv/

URL=http://www.programme-tv.net/programme/programme-tnt.html


    wget -qO - $URL |sed 's/[<>]/\n/g' |grep -A 16 '^Programme TF1' |sed '/^$/d' |sed '2,5d' |sed '3,4d' |sed '4d' |sed -e "s/\"/|/g" >TF1.txt
    wget -qO - $URL |sed 's/[<>]/\n/g' |grep -A 16 '^Programme France 2' |sed '/^$/d' |sed '2,5d' |sed '3,4d' |sed '4d' |sed -e "s/\"/|/g" >FR2.txt
    wget -qO - $URL |sed 's/[<>]/\n/g' |grep -A 16 '^Programme France 3' |sed '/^$/d' |sed '2,5d' |sed '3,4d' |sed '4d' |sed -e "s/\"/|/g" >FR3.txt
    wget -qO - $URL |sed 's/[<>]/\n/g' |grep -A 16 '^Programme Canal+' |sed '/^$/d' |sed '2,5d' |sed '3,4d' |sed '4d' |sed -e "s/\"/|/g" >CAN.txt
    wget -qO - $URL |sed 's/[<>]/\n/g' |grep -A 16 '^Programme Arte' |sed '/^$/d' |sed '2,5d' |sed '3,4d' |sed '4d' |sed -e "s/\"/|/g" >ART.txt
    wget -qO - $URL |sed 's/[<>]/\n/g' |grep -A 16 '^Programme M6' |sed '/^$/d' |sed '2,5d' |sed '3,4d' |sed '4d' |sed -e "s/\"/|/g" >M6.txt
    

    H_TF1=`awk -F'|' 'NR == 3 {print $1}' TF1.txt`
    P_TF1=`awk -F'|' 'NR == 2 {print $4}' TF1.txt`    
    echo TF1    : $H_TF1 - $P_TF1
    
    H_FR2=`awk -F'|' 'NR == 3 {print $1}' FR2.txt`
    P_FR2=`awk -F'|' 'NR == 2 {print $4}' FR2.txt`
    echo FR2    : $H_FR2 - $P_FR2
    
    H_FR3=`awk -F'|' 'NR == 3 {print $1}' FR3.txt`
    P_FR3=`awk -F'|' 'NR == 2 {print $4}' FR3.txt`
    echo FR3    : $H_FR3 - $P_FR3
    
    H_CAN=`awk -F'|' 'NR == 3 {print $1}' CAN.txt`
    P_CAN=`awk -F'|' 'NR == 2 {print $4}' CAN.txt`
    echo Canal+ : $H_CAN - $P_CAN
    
    H_ART=`awk -F'|' 'NR == 3 {print $1}' ART.txt`
    P_ART=`awk -F'|' 'NR == 2 {print $4}' ART.txt`
    echo Arte   : $H_ART - $P_ART
    
    H_M6=`awk -F'|' 'NR == 3 {print $1}' M6.txt`
    P_M6=`awk -F'|' 'NR == 2 {print $4}' M6.txt`
    echo M6   : $H_M6 - $P_M6
    
    rm TVprog.txt
    sleep 2
    
    echo $H_TF1 - $P_TF1 >> TVprog.txt
    echo $H_FR2 - $P_FR2 >> TVprog.txt
    echo $H_FR3 - $P_FR3 >> TVprog.txt
    echo $H_CAN - $P_CAN >> TVprog.txt
    echo $H_ART - $P_ART >> TVprog.txt
    echo $H_M6 - $P_M6 >> TVprog.txt
    
    FromHtml TVprog.txt

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

Hors ligne

#1758 Le 30/03/2010, à 10:35

tap.telrad

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

Un script certainement un peu capilo-tracté pour une météo en couleur

#!/bin/bash
# Pour l'URL aller sur http://igoogle.wunderground.com/auto/iGoogle/global/FR.html
# Sélectionner la station dans le combo "Source" et copier l'URL dans la variable

cd ~/.scripts/etude/meteo/meteo_4

function pression() {
	pression=$((($1*3386)/(10000)))
}

function Farh_to_Cent() {
	temp=$((($1-32)*(5)/(9)))
}

function Mph_to_Kmh() {
	vit=$((($1*16)/(10)))
}

function Date_UStoFR {
	
	if [[ $2 = PM ]] ; then
		hPM=`echo $1|cut -d":" -f1` #; echo hPM = $hPM
		HPM=$((($hPM+12))) #; echo HPM = $HPM
	else
		HPM=`echo $1|cut -d":" -f1`
	fi
	
	DateFR=`echo $6|cut -d"," -f1`' '$5' '$7'  à  '$HPM':'`echo $1|cut -d":" -f2`	
	
}

function Traduction_termes() {
	sed -i 's/\&#176;/°/g
			s/\&deg;/°/g
			s/\&nbsp;/ /g
			s/Currently/Actuellement/g
			s/Humidity/Humidité/g
			s/Wind/Vent/g
			s/Visibility/Visibilité/g
			s/Dew Point/Point de rosée/g
			s/Pressure/Pression/g
			s/Clear/Clair/g
			s/Cloud Cover/Couverture nuageuse/g
			s/Chance of Rain/Probabilité de pluie/g
			s/chance of precipitation/Probabilité de précipitation/g
			s/Updated/Mis à jour/g
			s/Observed at/Observation de/g' $1
}

function Traduction_jours() {
	sed -i 's/Today/Ce jour/g
			s/Sunday/Dimanche/g
			s/Monday/Lundi/g
			s/Tuesday/Mardi/g
			s/Wednesday/Mercredi/g
			s/Thursday/Jeudi/g
			s/Friday/Vendredi/g
			s/Saturday/Samedi/g' $1
}

function Traduction_mois() {
	sed -i 's/January/Janvier/g
			s/February/Février/g
			s/March/Mars/g
			s/April/Avril/g
			s/May/Mai/g
			s/June/Juin/g
			s/July/Juillet/g
			s/August/Août/g
			s/September/Septembre/g
			s/October/Otobre/g
			s/November/Novembre/g
			s/December/Décembre/g' $1
}

function Traduction_ciel() {
	sed -i 's/Mostly Cloudy/Nuages épars/g
			s/Partly Cloudy/Nuages épars/g
			s/Scattered Clouds/Nuages épars/g
			s/Overcast/Couvert/g
			s/Light Showers/Averses  légères/g
			s/Light Rain/Pluie légère/g' $1
}

function Traduction_vent() {
	sed -i 's/from the North/Nord/g
			s/from the East/Est/g
			s/from the South/Sud/g
			s/from the West/Ouest/g
			s/from the NNE/N.N.E/g
			s/from the NE/N.E/g
			s/from the ENE/E.N.E/g
			s/from the NNW/N.N.W/g
			s/from the SSE/S.S.E/g
			s/from the WSW/W.S.W/g
			s/from the WNW/W.N.W/g' $1
}

URL='http://igoogle.wunderground.com/US//Tarbes/LFBT.html?theprefset=00000407621WS&theprefvalue=I90580282'
REP_IMG=./img

# Récupérer les lignes qu'il faut et les écrire dans "DATAS.txt"
{
	wget -qO - $URL |grep -A 160 '^	<div class="b">Currently</div>' |sed '/^$/d' |sed 's/[<>]/\n/g' |sed 's/^[ \t]*//;s/[ \t]*$//' \
					|sed '/^$/d' |sed '/^\//d' |sed '/^tr/d' |sed '/^td/d' |sed '/^span/d' |sed '/^div/d' |sed '/^|/d' |sed '/^thead/d' \
					|sed '/^tbody/d' |sed '/^a href/d' |sed '/^Hourly/d' >DATAS.txt ; sleep 1
}

# Récupérer les lignes de l'image de la lune	
{				 
	wget -qO - $URL |grep -A 2 'Moon Rise' |sed '/^$/d' |sed 's/[<>]/\n/g' |sed 's/^[ \t]*//;s/[ \t]*$//' \
					 |sed '/^$/d' |sed '/^\//d' |sed '/^tr/d' |sed '/^td/d' |sed '/^span/d' |sed '/^div/d' |sed '/^|/d' |sed '/^thead/d' \
					 |sed '/^tbody/d' |sed '/^a href/d' |sed '/^Hourly/d' >Moon.txt ; sleep 1
}	

# Récupérer les images
{
	grep '^img' DATAS.txt >img.txt ; grep '^img' ./Moon.txt >>img.txt ; sed -i "s/\"/|/g" img.txt
	IMG0=`awk -F'|' 'NR == 1 {print $2}' img.txt` ; wget `awk -F'|' 'NR == 1 {print $2}' img.txt` ; sleep 1 ; mv `basename $IMG0` $REP_IMG/0.gif
	IMG2=`awk -F'|' 'NR == 3 {print $2}' img.txt` ; wget `awk -F'|' 'NR == 3 {print $2}' img.txt` ; sleep 1 ; mv `basename $IMG2` $REP_IMG/1.gif
	IMG3=`awk -F'|' 'NR == 4 {print $2}' img.txt` ; wget `awk -F'|' 'NR == 4 {print $2}' img.txt` ; sleep 1 ; mv `basename $IMG3` $REP_IMG/2.gif
	IMG4=`awk -F'|' 'NR == 5 {print $2}' img.txt` ; wget `awk -F'|' 'NR == 5 {print $2}' img.txt` ; sleep 1 ; mv `basename $IMG4` $REP_IMG/3.gif
	IMG5=`awk -F'|' 'NR == 6 {print $2}' img.txt` ; wget `awk -F'|' 'NR == 6 {print $2}' img.txt` ; sleep 1 ; mv `basename $IMG5` $REP_IMG/4.gif	
	MOON=`awk -F'|' 'NR == 7 {print $2}' img.txt` ; wget `awk -F'|' 'NR == 7 {print $2}' img.txt` ; sleep 1 ; mv `basename $MOON` $REP_IMG/MOON.png
	# Détruire les fichiers inutiles
	rm img.txt ; rm Moon.txt
}
	
	# Nettoyer le fichier "DATAS.txt"
	sed -i '/^table/d;/^img/d;/^form method/d;/^Source:/d;/^input/d;/^select/d;/^opt/d;/^iframe/d' DATAS.txt	

# Traduction du fichier "DATAS.txt"
{
	Traduction_termes DATAS.txt
	Traduction_jours DATAS.txt
	Traduction_mois DATAS.txt
	Traduction_ciel DATAS.txt
	Traduction_vent DATAS.txt
}	

# Création du fichier "J_0.txt" pour aujourd'hui
{
	nb_Lines=`wc -l DATAS.txt | cut -f1 -d' '` ; echo Nombre lignes = $nb_Lines
	num_line=`grep -n 'Mis à jour' DATAS.txt |cut -d":" -f1` ; echo num de la ligne = $num_line
	grep -A $num_line 'Actuellement' DATAS.txt >J_0.tmp
	
	grep '^Observation' J_0.tmp >J_0.txt
	date1=`grep '^Mis à jour' J_0.tmp` ; date2=`echo ${date1:12}`
	Date_UStoFR $date2 ; echo Mis à jour: $DateFR >>J_0.txt	
	TEMP=`awk -F' ' 'NR == 2 {print $1}' J_0.tmp` ; Farh_to_Cent `awk -F' ' 'NR == 2 {print $1}' J_0.tmp` ; echo TEMP = $temp° ; echo Température:$temp° >>J_0.txt
	CIEL1=`awk 'NR == 3 {print $1}' J_0.tmp` ; echo CIEL1 = $CIEL1
	CIEL2=`awk 'NR == 3 {print $2}' J_0.tmp` ; echo CIEL2 = $CIEL2 ; echo Ciel:$CIEL1' '$CIEL2 >>J_0.txt
	grep -A 1 'Humidité:' J_0.tmp >humid ; hmd=`awk 'NR == 2 {print $1}' humid` ; echo Humidité:$hmd >>J_0.txt ; rm humid 
	grep -A 2 'Vent:' J_0.tmp >vent ; Mph_to_Kmh `awk 'NR == 2 {print $1}' vent` ; obs=`awk 'NR == 3 {print $1 $2 $3 $4}' vent` ; echo Vent:$vit Km/h:$obs >>J_0.txt ; rm vent
	grep -A 1 'Point de rosée' J_0.tmp >pdr ; Farh_to_Cent `awk -F' ' 'NR == 2 {print $1}' pdr` ; echo Point de rosée:$temp° >>J_0.txt ; rm pdr
	grep -A 3 'Pression' J_0.tmp >prs ; p1=`awk -F'.' 'NR == 3 {print $1}' prs` ; p2=`awk -F'.' 'NR == 3 {print $2}' prs` ; echo $p1$p2 ; pression $p1$p2 ; echo Pression:$pression\hPa >>J_0.txt ; rm prs
	grep -A 1 'UV:' J_0.tmp >uvt ; uv=`awk 'NR == 2 {print $1}' uvt` ; echo UV:$uv >>J_0.txt ; rm uvt 
}
	
	echo effectué

et le conky

#emplacement
alignment top_middle
#maximum_width 10000

#pour que corky tourne en arriere plan
background yes
#background no #pour les tests

#nombre d'echantillons a utiliser pour calculer la moyenne d'utilisation
cpu_avg_samples 4
net_avg_samples 4

#affiche le texte sur la sortie standard
out_to_console no

# Utiliser Xft (polices lissées etc)
use_xft yes

#police a utiliser : use_xft doit etre a "yes"
xftfont Terminal Bitstream Vera Sans Mono:size=4

# utiliser sa propre fenetre ?
own_window yes

#type de fenetre : normal(avec le cadre) / override / desktop
own_window_type override

#pseudo transparence?
own_window_transparent yes

# taux de raffraichissement de la fenetre (en secondes)
update_interval 1

# pour eviter le clignotement de la semaine (fonctionne pas chez moi)
double_buffer yes

# afficher les ombres?
draw_shades no

# afficher des contours ?
draw_outline no

#contours autour des blocs de texte?
draw_borders no

# contour en trait-tillés, longueur d'un trait en pixels
stippled_borders 10

#largeur des marges (n'a pas l'air de fonctionner)
border_margin 250

# largeur du contour
border_width 1

# couleur par defaut du texte, de l'ombre et du contour
default_color white
default_shade_color white
default_outline_color white

# ecart avec le bord x=gauche ou droit y= haut ou bas
gap_x 30
gap_y 30

# Ajoute des espaces apres certains objets pour eviter de les faire bouger.
# Fonctionne uniquement avec la police Monospace
use_spacer no

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

# Tout le texte en majuscule ?
uppercase no

#own_window_colour white 

TEXT
${exec 10 ~/.scripts/meteo/meteo_4/meteo4}
#${execi 5 ~/.scripts/meteo/meteo_3/meteo3}
${font Bitstream Vera Sans Mono:size=8}Les prévisions sur 4 jours :
${font Bitstream Vera Sans Mono:size=8}
${image ~/.scripts/etude/meteo/meteo_4/img/1.gif -p 0,20 -s 40x40}
${image ~/.scripts/etude/meteo/meteo_4/img/2.gif -p 80,20 -s 40x40}
${image ~/.scripts/etude/meteo/meteo_4/img/3.gif -p 160,20 -s 40x40}
${image ~/.scripts/etude/meteo/meteo_4/img/4.gif -p 240,20 -s 40x40}
${offset 0}${voffset -22}${exec cat ~/.scripts/etude/meteo/meteo_4/DATAS.txt | sed -n "33p"}
${offset 80}${voffset -12}${exec cat ~/.scripts/etude/meteo/meteo_4/DATAS.txt | sed -n "37p"}
${offset 160}${voffset -12}${exec cat ~/.scripts/etude/meteo/meteo_4/DATAS.txt | sed -n "41p"}
${offset 240}${voffset -15}${exec cat ~/.scripts/etude/meteo/meteo_4/DATAS.txt | sed -n "45p"}
$color$stippled_hr
${font Bitstream Vera Sans Mono:size=8}Aujourd'hui : ${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "1p"}
${font Bitstream Vera Sans Mono:size=8}${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "2p"}
${image ~/.scripts/etude/meteo/meteo_4/img/0.gif -p 0,130 -s 40x40}
${offset 80}${font Bitstream Vera Sans Mono:size=8}${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "3p"}     ${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "4p"}
${offset 80}${font Bitstream Vera Sans Mono:size=8}${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "5p"}     ${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "6p"}
${offset 80}${font Bitstream Vera Sans Mono:size=8}${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "7p"}     ${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "8p"}
${offset 80}${font Bitstream Vera Sans Mono:size=8}${exec cat ~/.scripts/etude/meteo/meteo_4/J_0.txt | sed -n "9p"}
${image ~/.scripts/etude/meteo/meteo_4/img/MOON.png -p 320,120 -s 40x40}
${font}

ubuntu 10.04 lucid - AMD64

Hors ligne

#1759 Le 30/03/2010, à 11:07

MrGalerien

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

Bonjour tout le monde!!
J'ai lu beaucoup de vos messages et me suis inspiré d'un bon nombre de vos contributions.

Donc, il n'y a pas grand chose de moi dans les scripts présentés, mais bon, j'aime bien le résultat alors je partage !
Donc, nous avons un cairo-dock en bas.
Le conkyrc1 à droite
le rc2 en haut à gauche (calendrier et notes)
Le rc3 à en haut (on le vois mal, c'est le rhythmbox, on le voit si on le cherche, sinon on le voit pas et il ne gène pas pour l'image)
le rc4 en haut a gauche mais au dessus du calendrier
le rc5 en bas qui fait office de flux RSS.

Tout d'abord, si vous ne voyez rien s'afficher dans votre répertoire, faites un ctrl + H pour afficher les fichiers cachés

Pour les notes, mettez tout simplement un fichier "notes.txt" dans vos documents (/home/$USER/Documents/notes.txt). Et faites un raccourci (système => préférences => raccourcis clavier. gedit /home/<nomd'utilisateur>/Documents/notes.txt). j'ai mis ctrl alt + t.

Pour lancer le conky en entier, tappez "sh .conky.sh" dans une console (après avoir navigué jusqu'au répertoire concerné)

Pour gmail, allez dans le rc1 et changez <youremailadress> <yourpassword> par votre adresse et votre mot de passe...

Sinon, je sais qu'il y a plein de trucs a installer en plus, comme le weather (faites conky weatherforecast dans google, vous trouverez bien!)
Et les fonts, vous avez besoin de (allez sur dafont) :
- SpaceAge
- Silhouettes from Poser LT
- monaco
- Guifx v2 Transports
- SEXY SPANISH ERASMUS GIRLS V.2.0
- StyleBats
- aaronfaces
- Bitstream Vera Sans Mono

Si vous avez d'autres problèmes, regarder les messages d'erreur de console qui sont une bonne indication, ou encore les commentaires dans les fichiers qui suivent


Donc, image :
myscreenshot2.th.png

Et pour les scripts je vous propose d'aller la bas : ici en faite

Je sais, y'a beaucoup de pub sur ce site, mais bon...
Donc, on extrait le tout dans votre dossier personnel (moi c'est /home/galerien) et on renomme le dossier "conky" en ".conky".

Et le monde il est beau!

ps : le wallpaper : creativewallpaperfearof.th.jpg


Le livre de la vie                 Est le livre suprême
Qu'on ne peut ni fermer     Ni rouvrir à son choix
On voudrait revenir            A la page où l'on aime
Et la page où l'on meurt     Est déjà sous nos doigts

Hors ligne

#1760 Le 30/03/2010, à 11:59

chepioq

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

Bonjour...
Juste une question:
Quelqu'un saurai comment afficher , dans un script lua, une photo ronde? (en forme de cercle et non un rectangle...)
Je m'explique:
j'ai réussi un faire un script lua qui affiche une photo, mais cette photo est rectangulaire, et je voudrai n'afficher que le centre de cette photo sous forme circulaire.


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

Hors ligne

#1761 Le 30/03/2010, à 12:38

RegisBurin

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

chepioq a écrit :

Bonjour...
Juste une question:
Quelqu'un saurai comment afficher , dans un script lua, une photo ronde? (en forme de cercle et non un rectangle...)
Je m'explique:
j'ai réussi un faire un script lua qui affiche une photo, mais cette photo est rectangulaire, et je voudrai n'afficher que le centre de cette photo sous forme circulaire.

Sans se tordre le cerveau, tu ouvres ta photo sous Gimp, tu fais une selection circulaire ou tu le souhaites, ctrl+I pour inverser la selection, ctrl+k ou ctrl+x (supprimer). Enregistres en .png (gère la transparence)...

Tadaaaa...!

Dernière modification par RegisBurin (Le 30/03/2010, à 12:38)


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

Hors ligne

#1762 Le 30/03/2010, à 15:47

breakolami

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

J'ai refait la section téléchargements dans mon conky en utilisant les nouvelles commandes simplifiées et ça fonctionne

${color5}Hier${color}${alignc}down: ${color3}${execi 300 vnstat | grep "yesterday" | awk '{print $2 $3}'}${alignr}${color}up: ${color2}${execi 300 vnstat | grep "yesterday" | awk '{print $5 $6}'}
${color}Total: ${color2}${execi 300 vnstat | grep "yesterday" | awk '{print $8 $9}'}
${color5}Today${color}${alignc}down: ${color3}${execi 300 vnstat --oneline | cut -d\; -f4}${alignr}${color}up: ${color2}${execi 300 vnstat --oneline | cut -d\; -f5}
${color}Total: ${color2}${execi 300 vnstat --oneline | cut -d\; -f6}
${color5}Semaine${color}${alignc}down: ${color3}${execi 300 vnstat -w | grep "current week" | awk '{print $3 $4}'}${alignr}${color}up: ${color2}${execi 300 vnstat -w | grep "current week" | awk '{print $6 $7}'}
${color}Total: ${color2}${execi 300 vnstat -w | grep "current week" | awk '{print $9 $10}'}
${color5}Ce mois${color}${alignc}down: ${color3}${execi 300 vnstat --oneline | cut -d\; -f9}${alignr}${color}up: ${color2}${execi 300 vnstat --oneline | cut -d\; -f10}
${color}Total: ${color2}${execi 300 vnstat --oneline | cut -d\; -f11}
${color5}Général :${color}${alignc}down: ${color3}${execi 300 vnstat --oneline | cut -d\; -f13}${alignr}${color}up: ${color2}${execi 300 vnstat --oneline | cut -d\; -f14}

${color6}Total général down + up: ${alignr}${color2}${execi 300 vnstat --oneline | cut -d\; -f15}${color}

Mais je n'ai pas trouvé pour hier et semaine

J'avais détaillé ces commandes en novembre 2009 sur ce message
http://forum.ubuntu-fr.org/viewtopic.ph … 9#p3033649

Donc j'ai mélangé 2 conkyrc et voila ce que ça donne, en bas l'affichage des téléchargements avec les commandes simplifiées

00022.jpg

@[D]uplicity-[C]orp avec ces commandes simplifiées plus besoin de changer chaque mois le nom du mois en cours


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

Hors ligne

#1763 Le 30/03/2010, à 16:30

chepioq

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

RegisBurin a écrit :

Sans se tordre le cerveau, tu ouvres ta photo sous Gimp, tu fais une selection circulaire ou tu le souhaites, ctrl+I pour inverser la selection, ctrl+k ou ctrl+x (supprimer). Enregistres en .png (gère la transparence)...

Tadaaaa...!

Je sais transformer une photo sous gimp, mais le problème c'est que la photo, même avec un fond transparent, sera toujours de forme rectangulaire(ou carré...).
Ce que je souhaite c'est une photo ronde...


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

Hors ligne

#1764 Le 30/03/2010, à 20:04

informaticous

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

Une petit question, dans firefox il y a moyen de récupéré les avancement de téléchargement et de le mètre dans un conky.

Et pour les mail avec thundeberd ?


j'y suis, j'y reste

Hors ligne

#1765 Le 30/03/2010, à 20:28

JB-home

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

il faut que tu puisse récupéré des logs des téléchargements pour firefox, je croit que le plugins "Flashgot" à des logs de téléchargement, ensuite à toi de traité les infos et de les afficher dans conky, pour thunderbird je sait pas je ne l'utilise pas.

Dernière modification par z0rg> (Le 30/03/2010, à 20:29)

Hors ligne

#1766 Le 30/03/2010, à 20:47

wlourf

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

chepioq a écrit :
RegisBurin a écrit :

Sans se tordre le cerveau, tu ouvres ta photo sous Gimp, tu fais une selection circulaire ou tu le souhaites, ctrl+I pour inverser la selection, ctrl+k ou ctrl+x (supprimer). Enregistres en .png (gère la transparence)...

Tadaaaa...!

Je sais transformer une photo sous gimp, mais le problème c'est que la photo, même avec un fond transparent, sera toujours de forme rectangulaire(ou carré...).
Ce que je souhaite c'est une photo ronde...

T'as bien raison, pour avoir un truc dynamique, gimp c'est pas le pied sauf si tu utilises des scripts mais ça sera gourmand.
Pour ce que tu veux, il y a un exemple , ce qui doit donner à peu près ça pour Lua :

surface = cairo_image_surface_create_from_png("/home/wlourf/test.png")
w = cairo_image_surface_get_width (surface);
h = cairo_image_surface_get_height (surface);
cw = conky_window.width
ch = conky_window.height
radius = math.min(cw,ch)/2

local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, cw, ch)
local cr=cairo_create(cs)
cairo_arc (cr, cw/2,ch/2, radius, 0, 2*math.pi)
cairo_clip (cr)
cairo_new_path (cr)

if h>w then 
	ratio = ch/h
else
	ratio = cw/w
end

cairo_scale (cr, ratio,ratio)
cairo_set_source_surface (cr, surface, 0, 0)
cairo_paint (cr)

cairo_surface_destroy (surface)
cairo_surface_destroy (cs)

Il te restera des ajustements à faire pour centrer tes images si celles-ci n'ont pas le même ratio que ton conky, mais le problème (enfin, c'est pas vraiment un problème), c'est que ça ne fonctionne que pour les PNG. Si tu veux travailler sur des JPG directement, il faut sans doute passer par imlib2 qui fonctionne aussi avec le Lua de conky.

Hors ligne

#1767 Le 30/03/2010, à 21:44

wlourf

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

conky 1.8.0 est vient de sortir il y a quelques heures : http://sourceforge.net/news/?group_id=143975&id=284759
et http://wiki.conky.be/index.php/1.8.0_tour

Hors ligne

#1768 Le 30/03/2010, à 21:52

MrGalerien

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

breakolami a écrit :

J'ai refait la section téléchargements dans mon conky en utilisant les nouvelles commandes simplifiées et ça fonctionne

${color5}Hier${color}${alignc}down: ${color3}${execi 300 vnstat | grep "yesterday" | awk '{print $2 $3}'}${alignr}${color}up: ${color2}${execi 300 vnstat | grep "yesterday" | awk '{print $5 $6}'}
${color}Total: ${color2}${execi 300 vnstat | grep "yesterday" | awk '{print $8 $9}'}
${color5}Today${color}${alignc}down: ${color3}${execi 300 vnstat --oneline | cut -d\; -f4}${alignr}${color}up: ${color2}${execi 300 vnstat --oneline | cut -d\; -f5}
${color}Total: ${color2}${execi 300 vnstat --oneline | cut -d\; -f6}
${color5}Semaine${color}${alignc}down: ${color3}${execi 300 vnstat -w | grep "current week" | awk '{print $3 $4}'}${alignr}${color}up: ${color2}${execi 300 vnstat -w | grep "current week" | awk '{print $6 $7}'}
${color}Total: ${color2}${execi 300 vnstat -w | grep "current week" | awk '{print $9 $10}'}
${color5}Ce mois${color}${alignc}down: ${color3}${execi 300 vnstat --oneline | cut -d\; -f9}${alignr}${color}up: ${color2}${execi 300 vnstat --oneline | cut -d\; -f10}
${color}Total: ${color2}${execi 300 vnstat --oneline | cut -d\; -f11}
${color5}Général :${color}${alignc}down: ${color3}${execi 300 vnstat --oneline | cut -d\; -f13}${alignr}${color}up: ${color2}${execi 300 vnstat --oneline | cut -d\; -f14}

${color6}Total général down + up: ${alignr}${color2}${execi 300 vnstat --oneline | cut -d\; -f15}${color}

Mais je n'ai pas trouvé pour hier et semaine

J'avais détaillé ces commandes en novembre 2009 sur ce message
http://forum.ubuntu-fr.org/viewtopic.ph … 9#p3033649

Je récupère des =" Unknown arg "--oneline". Use --help for help"
Tu vois d'où ça peu provenir ? (en effet il n'y a pas de --oneline dans le help, mais dans le man il est présent...???)

Merci d'avance!


Le livre de la vie                 Est le livre suprême
Qu'on ne peut ni fermer     Ni rouvrir à son choix
On voudrait revenir            A la page où l'on aime
Et la page où l'on meurt     Est déjà sous nos doigts

Hors ligne

#1769 Le 31/03/2010, à 00:30

breakolami

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

je rentre juste du boulot smile

Il faut vnstat 1.9 ou supérieur pour les oneline


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

Hors ligne

#1770 Le 31/03/2010, à 07:24

fautedorthographe

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

wlourf a écrit :

conky 1.8.0 est vient de sortir il y a quelques heures : http://sourceforge.net/news/?group_id=143975&id=284759
et http://wiki.conky.be/index.php/1.8.0_tour

merci pour l'info

je n'arrive pas a dl vos scripts pour les barres de couleur pourriez vous me filez lien? merci

edit: c'est bon

Dernière modification par fautedorthographe (Le 31/03/2010, à 09:47)

#1771 Le 31/03/2010, à 08:15

informaticous

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

@z0rg> ta solution ne marche pas, j'ai bien des log mais qui donne pas d'information sur le téléchargement.


j'y suis, j'y reste

Hors ligne

#1772 Le 31/03/2010, à 11:18

Fenouille84

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

MrGalerien a écrit :

Bonjour tout le monde!!
J'ai lu beaucoup de vos messages et me suis inspiré d'un bon nombre de vos contributions.

Donc, il n'y a pas grand chose de moi dans les scripts présentés, mais bon, j'aime bien le résultat alors je partage !

Tiens, sa me rappelle quelque chose ces conky... roll lol

Un conseil pour ton calendrier : utilise une police à chasse fixe.
Comme sa il sera aligné et sa fera plus joli je pense wink


Ma page Deviant Art : conky inside ;-)
.
-- DropBox (online backup) : 2Go + 250 Mo pour vous et moi par parrainage --

Hors ligne

#1773 Le 31/03/2010, à 11:47

breakolami

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

wlourf a écrit :

conky 1.8.0 est vient de sortir il y a quelques heures

Je vous l'avais déjà dit dans ce message du 9 mars http://forum.kubuntu-fr.org/viewtopic.p … 2#p3327222 mais parfois mes messages passent inaperçus


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

Hors ligne

#1774 Le 31/03/2010, à 12:16

JB-home

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

informaticous a écrit :

@z0rg> ta solution ne marche pas, j'ai bien des log mais qui donne pas d'information sur le téléchargement.

je ne voit pas comment tu peut procédé alors hmm

Hors ligne

#1775 Le 31/03/2010, à 12:27

wlourf

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

breakolami a écrit :
wlourf a écrit :

conky 1.8.0 est vient de sortir il y a quelques heures

Je vous l'avais déjà dit dans ce message du 9 mars http://forum.kubuntu-fr.org/viewtopic.p … 2#p3327222 mais parfois mes messages passent inaperçus

ah ok, je suis encore sous Jaunty et Lucid n'est pas encore sorti !

Hors ligne