SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#6526 2013-11-02 12:05:27

mf
Member
From: Slovenia
Registered: 2013-10-28
Posts: 37

Re: Conky v1.9 Thread

Naik wrote:

^ you can achive a fixed position by using ${goto 42} or something similar.
I`m just not sure whether "42" is set in px or characters or something, because i expierienced a change of the achieved offset depending to the font used...

greetz -naik

Sweet, thanks, works as advertised smile

Offline

Be excellent to each other!

#6527 2013-11-02 12:22:14

mf
Member
From: Slovenia
Registered: 2013-10-28
Posts: 37

Re: Conky v1.9 Thread

abh4CPTi.jpg

This is what I wanted to achieve in the first place: conky visible even if 1000 windows are maximized. It's hiding under tint2 and the taskbar is moved to the right. Emails, updates, CPU and RAM are displayed everywhere.

Offline

#6528 2013-11-02 12:34:38

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

mf wrote:

Hey guys, I decided to create a horizontal conky. This is what I have so far.

http://t.imgbox.com/adkHrrAt.jpg

I have a couple of questions though. If I get, let's say, 10 emails, the whole upper line would move for one char to the right, ergo everything would be misplaced. That's because I'm arranging the object in two lines. How would I make "blocks" for every section (the text on left, CPU, RAM and HDD) and position them so, that even if the dynamic text gets bigger, the others would not move to the right. Is this even possible?

First ... the 9 to 10 trick:

${if_match ${your email command} == 0}00${else}\
${if_match ${your email command} < 10}0\
${your email command}${else}\
${your email command}${endif}${endif}

or if you prefer empty space when no numbers:

${if_match ${your email command} == 0}  ${else}\
${if_match ${your email command} < 10} \
${your email command}${else}\
${your email command}${endif}${endif}

Those will reserve space for upto 99 emails.  the ending " \ " keeps everything on one line.
2013_11_02_08_47_10_1920x1080_Sector11.jpg
I repeat that code 4 times for 4 email accounts.

What I use for CPU usage:

 CPU % in use ${alignr 5}Avg ${if_match ${cpu cpu0}<10}00${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100}0${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}
${alignc}1 ${if_match ${cpu cpu1}<10}00${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100}0${cpu cpu1}\
${else}$color9}${cpu cpu1}${endif}${endif}${color}\
  2 ${if_match ${cpu cpu2}<10}00${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100}0${cpu cpu2}\
${else}$color9}${cpu cpu2}${endif}${endif}${color}\
  3 ${if_match ${cpu cpu3}<10}00${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100}0${cpu cpu3}\
${else}$color9}${cpu cpu3}${endif}${endif}${color}

Again with empty spaces if not used:

 CPU % in use ${alignr 5}Avg ${if_match ${cpu cpu0}<10}  ${cpu cpu0}\
${else}${if_match ${cpu cpu0}<100} ${cpu cpu0}\
${else}${cpu cpu0}${endif}${endif}
${alignc}1 ${if_match ${cpu cpu1}<10}  ${cpu cpu1}\
${else}${if_match ${cpu cpu1}<100} ${cpu cpu1}\
${else}$color9}${cpu cpu1}${endif}${endif}${color}\
  2 ${if_match ${cpu cpu2}<10}  ${cpu cpu2}\
${else}${if_match ${cpu cpu2}<100} ${cpu cpu2}\
${else}$color9}${cpu cpu2}${endif}${endif}${color}\
  3 ${if_match ${cpu cpu3}<10}  ${cpu cpu3}\
${else}${if_match ${cpu cpu3}<100} ${cpu cpu3}\
${else}$color9}${cpu cpu3}${endif}${endif}${color}

2013_11_02_09_08_01_222x476_Sector11.jpg

Naik has it!  ${goto 42} is 42 pixels from the left edge of your conky my preferred method over ${offset 42} which is 42 pixels from where you use it.

You can build your conky like this:

line1 section 1\
	${goto 100}line 1 - section 2\
		${goto 200}line 1 - section 3\
			${goto 300}line 1 - section 4
line2 section 1\
	${goto 100}line 2 - section 2\
		${goto 200}line 2 - section 3\
			${goto 300}line 2 - section 4

The spaces or tabs keep sections in a way it's easy to read, and by putting them directly in front of the ${goto xx} for that section it means as far as conky "display" those spaces or tabs are negated.

or use ${voffset XXX} which has it's own pitfalls.  big_smile

Last edited by Sector11 (2013-11-02 12:55:56)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6529 2013-11-02 13:35:01

cloverskull
#! Junkie
Registered: 2013-10-26
Posts: 377

Re: Conky v1.9 Thread

cloverskull wrote:

This is excellent, I love throwing if/endif's in my conky config.  In fact, I haven't messed with it much, I really should sit down and learn it completely smile

Hey guys, sorry to quote myself here smile but I have a question. The if and end if lines in my conkyrc are interpreted correctly but display as a blank line, or rather they output a line feed in conky. Is there a workaround, or an easy way to tell conky to move remaining text up by one line?

Offline

#6530 2013-11-02 14:00:22

mf
Member
From: Slovenia
Registered: 2013-10-28
Posts: 37

Re: Conky v1.9 Thread

cloverskull wrote:
cloverskull wrote:

This is excellent, I love throwing if/endif's in my conky config.  In fact, I haven't messed with it much, I really should sit down and learn it completely smile

Hey guys, sorry to quote myself here smile but I have a question. The if and end if lines in my conkyrc are interpreted correctly but display as a blank line, or rather they output a line feed in conky. Is there a workaround, or an easy way to tell conky to move remaining text up by one line?

You can use $if $else $endif structure.

Offline

#6531 2013-11-02 15:32:58

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

cloverskull wrote:
cloverskull wrote:

This is excellent, I love throwing if/endif's in my conky config.  In fact, I haven't messed with it much, I really should sit down and learn it completely smile

Hey guys, sorry to quote myself here smile but I have a question. The if and end if lines in my conkyrc are interpreted correctly but display as a blank line, or rather they output a line feed in conky. Is there a workaround, or an easy way to tell conky to move remaining text up by one line?

Check out this post and this one as well

Last edited by Sector11 (2013-11-02 15:55:33)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6532 2013-11-02 18:03:30

easysid
#! CrunchBanger
From: India
Registered: 2013-01-25
Posts: 150

Re: Conky v1.9 Thread

No progress on the conky front .... been really busy in the real world tongue. Festive season here at home.
I just wanted to wish A VERY HAPPY DIWALI TO EVERYONE smile

Offline

#6533 2013-11-02 18:18:58

mf
Member
From: Slovenia
Registered: 2013-10-28
Posts: 37

Re: Conky v1.9 Thread

adyQ0QLj.jpg

Todays progress. The dots in the lower left corner indicate that I have new email and no updates. The CPU and RAM bars turn to red, if there is not enough RAM or if the CPU is overloaded. The top bar still needs a lot of work though.

I have a question, but it's not really related to Conky. I would like to change the icons in the tray area. I'm looking for white pixelated icons. Anyone know any?

Last edited by mf (2013-11-02 18:19:37)

Offline

#6534 2013-11-02 18:34:15

PackRat
#! Die Hard
From: USA
Registered: 2011-03-03
Posts: 1,572

Re: Conky v1.9 Thread

^ I don't know about pixelated, but this artist's work might suit you -\

brsev icons at deviantArt

deviantArt is probably a good place to look.


"It does not require many words to speak the truth." - Chief Joseph, Nez Perce tribe

Offline

#6535 2013-11-02 20:02:14

Murpe
Member
From: North Carolina
Registered: 2013-10-13
Posts: 40

Re: Conky v1.9 Thread

Hi all!

I need some assistance with the conky I'm working on. As seen in the screenshot below, the battery bar and the CPU temp. bar don't show the colors correctly. Currently, the battery is showing 51% but the bar doesn't fill like it should. Any assistance is greatly appreciated.

Va4EYoQl.png

Offline

#6536 2013-11-02 20:09:51

Inodoro Pereyra
#! Die Hard
From: Back in Buenos Aires
Registered: 2013-07-01
Posts: 844

Re: Conky v1.9 Thread

@Murpe: could you post your code, please? smile

Offline

#6537 2013-11-02 20:25:30

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

My new look!
2013_11_02_17_06_35_1920x1080_Sector11.jpg

11 images, an awk script by dk75 (calendar) 3 lua scripts; draw-bk.lua (a CCCC thing), v9000 lua {weather} by mrpeachy and easysid's Mechanical Clock.  big_smile


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6538 2013-11-02 20:34:41

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

easysid wrote:

No progress on the conky front .... been really busy in the real world tongue. Festive season here at home.
I just wanted to wish A VERY HAPPY DIWALI TO EVERYONE smile

And the same to you... enjoy this time with your family to the fullest!

We'll be here when you come back.


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

#6539 2013-11-02 21:57:18

Murpe
Member
From: North Carolina
Registered: 2013-10-13
Posts: 40

Re: Conky v1.9 Thread

Sorry about that.

This is the bargraph.lua:

--[[ BARGRAPH WIDGET
	v2.0 by wlourf (12.07.2010)
	this widget draws a bargraph with differe,ts effects 
	http://u-scripts.blogspot.com/2010/07/bargraph-widget.html
	
	
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 numericla 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, défaut = 0
skew_y	- skew bar around y axis, défaut = 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, défaut = {width=500x00FF00,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


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
v2.0 (12 Jul. 2010) rewrite script + add reflection effects and parameters are now set into tables
]]



----------------START OF PARAMETERS ----------
function conky_main_bars()
	bars_settings={
		
		{ -- bar for dl
			name="downspeedf",
			arg="eth0",
			max=1000,
			bg_colour={0x000000,1},
			bg_led={0x00BBBB,0.5},
			fg_colour={0x000000,1},
			fg_led={0xffff00,1},
			blocks=15,
			x=225,
			y=135,
			height=4,width=30,
			angle=-90,
			led_effect="e",
			reflection_alpha=0.9,
			reflection="l",
			reflection_length=0.7,		
			space=1,
			skew_y=-15,
		},	

		{ -- bar for ul
			name="upspeedf",
			arg="eth0",
			max=100,
			bg_colour={0x000000,1},
			bg_led={0x00BBBB,0.5},
			fg_colour={0x000000,1},
			fg_led={0xffff00,1},				
			blocks=15,
			x=275,
			y=105,
			height=4,width=30,
			angle=90,
			led_effect="e",
			reflection_alpha=0.9,
			reflection_length=0.7,
			reflection="r",
			space=1,
			skew_y=15,
		},	

		{ -- bar for cpu1
			name="cpu",
			arg="cpu1",
			max=100,
			bg_colour={0x00BBBB,0},
			bg_led={0x00BBBB,0.5},
			fg_colour={0x00BBBB,0},
			fg_led={0xffff00,1},				
			blocks=10,
			y=250,
			x=250,
			height=5,
			space=0,
			led_effect="a",
			space=1,
			angle=-90+90/2,
			angle_bar=90,
			radius=30,
			reflection="b",
			reflection_alpha=1
		},	

		{ -- bar for cpu2
			name="cpu",
			arg="cpu2",
			max=100,
			bg_colour={0x00BBBB,0},
			bg_led={0x00BBBB,0.5},
			fg_colour={0x00BBBB,0},
			fg_led={0xffff00,1},				
			blocks=10,
			y=250,
			x=250,
			height=5,
			space=0,
			led_effect="a",
			space=1,
			angle=90/2,
			angle_bar=90,
			radius = 30
		},	
		
		{
		name="fs_used_perc",
		arg="/home",
		max=100,
		x=150,y=400,
		alarm=80,
		blocks=20,
		height=5,width=20,
		bg_colour={0x00BBBB,0},
		bg_led={0x00BBBB,0.5},
		fg_colour={0xffff00,0},
		fg_led={0xffff00,1},
		alarm_colour={0xff0000,0},
		alarm_led={0xff0000,1},
		led_effect="e",			
		},
		{
		name="fs_used_perc",
		arg="/data",
		max=100,
		x=195,y=400,
		alarm=80,
		blocks=20,
		height=5,width=20,
		bg_colour={0x00BBBB,0},
		bg_led={0x00BBBB,0.5},
		fg_colour={0xffff00,0},
		fg_led={0xffff00,1},
		alarm_colour={0xff0000,0},
		alarm_led={0xff0000,1},
		led_effect="e",			
		},	
	
		{ -- chipset temp
		name="exec",
		arg="sensors | grep 'Sys Temp' | cut -c15-16",
		max=100,
		x=240,y=400,
		alarm=80,
		blocks=20,
		height=5,width=20,
		bg_colour={0x00BBBB,0},
		bg_led={0x00BBBB,0.5},
		fg_colour={0xffff00,0},
		fg_led={0xffff00,1},
		alarm_colour={0xff0000,0},
		alarm_led={0xff0000,1},
		led_effect="e",	
		},
				
		{--cpu temp
		name="exec",
		arg="sensors | grep 'CPU Temp' | cut -c15-16",
		max=100,
		x=285,y=400,
		alarm=80,
		blocks=20,
		height=5,width=20,
		bg_colour={0x00BBBB,0},
		bg_led={0x00BBBB,0.5},
		fg_colour={0xffff00,0},
		fg_led={0xffff00,1},
		alarm_colour={0xff0000,0},
		alarm_led={0xff0000,1},
		led_effect="e",	
		},
		
		{--cpu temp
		name="exec",
		arg="sensors | grep 'CPU Temp' | cut -c15-16",
		max=100,
		x=330,y=400,
		alarm=80,
		blocks=20,
		height=5,width=20,
		bg_colour={0x00BBBB,0},
		bg_led={0x00BBBB,0.5},
		fg_colour={0xffff00,0},
		fg_led={0xffff00,1},
		alarm_colour={0xff0000,0},
		alarm_led={0xff0000,1},
		led_effect="e",	
		},
		
	
	}
	
-----------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)

end



function draw_multi_bar_graph(t)
	cairo_save(cr)
	--check values
	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
	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=nil
		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
			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)
		
			-- 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
			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)))
		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()
		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()
			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
		
		
	end --setup_bar_graph()

	
	--start here !
	setup_bar_graph()
	cairo_restore(cr)
end

This is the text.lua:

--[[TEXT WIDGET v1.. by Wlourf 25/06/2010
This widget can drawn texts set in the "text_settings" table with some parameters
http://u-scripts.blogspot.com/2010/06/text-widget.html

The parameters (all optionals) are :
text        - text to display, default = "Conky is good for you"
			  use conky_parse to display conky value ie text=conly_parse("${cpu cpu1}")
            - coordinates below are relative to top left corner of the conky window
x           - x coordinate of first letter (bottom-left), default = center of conky window
y           - y coordinate of first letter (bottom-left), default = center of conky window
h_align		- horizontal alignement of text relative to point (x,y), default="l"
			  available values are "l": left, "c" : center, "r" : right
v_align		- vertical alignment of text relative to point (x,y), default="b"
			  available values "t" : top, "m" : middle, "b" : bottom
font_name   - name of font to use, default = Free Sans
font_size   - size of font to use, default = 14
italic      - display text in italic (true/false), default=false
oblique     - display text in oblique (true/false), default=false (I don' see the difference with italic!)
bold        - display text in bold (true/false), default=false
angle       - rotation of text in degrees, default = 0 (horizontal)
colour      - table of colours for text, default = plain white {{1,0xFFFFFF,1}}
			  this table contains one or more tables with format {P,C,A}
              P=position of gradient (0 = beginning of text, 1= end of text)
              C=hexadecimal colour 
              A=alpha (opacity) of color (0=invisible,1=opacity 100%)
              Examples :
              for a plain color {{1,0x00FF00,0.5}}
              for a gradient with two colours {{0,0x00FF00,0.5},{1,0x000033,1}}
              or {{0.5,0x00FF00,1},{1,0x000033,1}} -with this one, gradient will start in the middle of the text
              for a gradient with three colours {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
			  and so on ...
orientation	- in case of gradient, "orientation" defines the starting point of the gradient, default="ww"
			  there are 8 available starting points : "nw","nn","ne","ee","se","ss","sw","ww"
			  (n for north, w for west ...)
			  theses 8 points are the 4 corners + the 4 middles of text's outline
			  so a gradient "nn" will go from "nn" to "ss" (top to bottom, parallele to text)
			  a gradient "nw" will go from "nw" to "se" (left-top corner to right-bottom corner)
radial		- define a radial gradient (if present at the same time as "orientation", "orientation" will have no effect)
			  this parameter is a table with 6 numbers : {xa,ya,ra,xb,yb,rb}
			  they define two circle for the gradient :
			  xa, ya, xb and yb are relative to x and y values above
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
skew_x,skew_y    - skew text around x or y axis
			  

Needs conky 1.8.0 

To call this script in the conkyrc, in before-TEXT section:
    lua_load /path/to/the/lua/script/text.lua
    lua_draw_hook_pre draw_text
 
v1.0	07/06/2010, Original release
v1.1	10/06/2010	Add "orientation" parameter
v1.2	15/06/2010  Add "h_align", "v_align" and "radial" parameters
v1.3	25/06/2010  Add "reflection_alpha", "reflection_length", "reflection_scale", 
                    "skew_x" et "skew_y"


]]

require 'cairo'

function conky_draw_text()
	--DEBUT DES PARAMETRES
	--couleurs utilisées plusieurs fois placées dans des variables

	local col0,col1,col2=0x00ffff,0x00ff00,0x0000ff -- 0xFFFFCC,0xCCFF99,0x99FF00
	local colbg=0xffff00--99CCFF
    text_settings={

		{
			text=conky_parse("${time %m/%d/%y}"),
			font_name="CaviarDreams",
			font_size=18,
			h_align="c",
			bold=true,
			x=240,
			y=15,
			reflection_alpha=0.9,
			reflection_length=0.7,			
			colour={{0,0xffff00,0.5},{0.5,0xffff00,1},{1,0xffff00,0.5}},
		},

		{
			text=conky_parse("${time %H:%M}"),
			font_name="CaviarDreams",
			font_size=36,
			h_align="c",
			bold=true,
			x=235,
			y=65,
			reflection_alpha=0.9,
			reflection_length=0.7,
			colour={{0,0xffff00,1},{1,0x00bbbb,1}},
			},

        {
		    text='dl/ul',
		    y=125,
		    x=262,
		    v_align="m",
		    h_align="r",
		    font_name="CaviarDreams",
		    font_size=18,
		   	colour={{0,0xffff00,0.5},{0.5,0xffff00,1},{1,0xffff00,0.5}},
			orientation="nn",
    		reflection_alpha=0.9,
    		reflection_length=0.7,			
        },  
        {
		    text=conky_parse('${downspeed wlan0}'),
		    x=125,
		    y=125,
		    v_align="m",
		    h_align="l",
		    font_name="CaviarDreams",
		    font_size=12,
		   	colour={{0,0xffff00,0.5},{0.5,0xffff00,1},{1,0xffff00,0.5}},
			orientation="nn",
    		reflection_alpha=0.9,
    		reflection_length=0.7,			
        },          
        {
		    text=conky_parse('${upspeed wlan0}'),
		    x=365,
		    y=125,
		    v_align="m",
		    h_align="r",
		    font_name="CaviarDreams",
		    font_size=12,
		    colour={{0,0xffff00,0.5},{0.5,0xffff00,1},{1,0xffff00,0.5}},
			orientation="nn",
    		reflection_alpha=0.9,
    		reflection_length=0.7,			
        },    
        
        
        {
		    text="cpu",
		    y=245,
		    x=250,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=18,
		   	colour={{0,0xffff00,0.5},{0.5,0xffff00,1},{1,0xffff00,0.5}},
			orientation="nn",
        },  
 
 
        {
		    text="home",
		    x=160,y=415,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=10,
		   	colour={{0,0xffff00,1}},
        }, 
        {
		    text=conky_parse("${fs_used_perc /home}%"),
		    x=160,y=430,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=11,
		   	colour={{0,0x00bbbb,1}},
        }, 


        {
		    text="data",
		    x=205,y=415,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=10,
		   	colour={{0,0xffff00,1}},
        },  
         {
		    text=conky_parse("${fs_used_perc /data}%"),
		    x=205,y=430,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=11,
		   	colour={{0,0x00bbbb,1}},
        }, 
 
        
        {
		    text="mobo",
		    x=250,y=415,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=10,
		   	colour={{0,0xffff00,1}},
        }, 
         {
		    text=conky_parse("${exec sensors | grep 'Sys Temp' | cut -c15-16}°C"),
		    x=250,y=430,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=11,
		   	colour={{0,0x00bbbb,1}},
        },      
           
        {
		    text="cpu",
		    x=295,y=415,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=10,
		   	colour={{0,0xffff00,1}},
        },  
        
        {
		    text=conky_parse("${acpitemp}°C"),
		    x=295,y=430,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=11,
		   	colour={{0,0x00bbbb,1}},
        },      
           
           {
		    text="bat",
		    x=340,y=415,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=10,
		   	colour={{0,0xffff00,1}},
        },  
        
        {
		    text=conky_parse("$battery_percent%"),
		    x=340,y=430,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=11,
		   	colour={{0,0x00bbbb,1}},
        },
           
        {
		    text="space",
		    x=180,y=450,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=18,
		   	colour={{0,0xffff00,1},{1,0x00bbbb,1}},
			orientation="nn"
        },         		
        {
		    text=("temp."),
		    x=275,y=450,
		    h_align="c",
		    font_name="CaviarDreams",
		    font_size=18,
		   	colour={{0,0xffff00,1},{1,0x00bbbb,1}},
	   		orientation="nn"
        },  
        
                
   	{
    		text=conky_parse("$kernel"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="c",
    		x=350,
    		y=475,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	},
    	
    	{
    		text=conky_parse("Kernel:"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="l",
    		x=125,
    		y=475,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	},
    	
    	{
    		text=conky_parse("Node Name:"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="l",
    		x=125,
    		y=500,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
    	
    	{
    	text=conky_parse("$nodename"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="c",
    		x=350,
    		y=500,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	},
    	
    	{
    		text=conky_parse("Conky Version:"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="l",
    		x=125,
    		y=525,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
    	
    	{
    		text=conky_parse("$conky_version"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="c",
    		x=350,
    		y=525,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
    	
    	{
    		text=conky_parse("Uptime:"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="l",
    		x=125,
    		y=550,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
    	
    	{
    		text=conky_parse("$uptime"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="c",
    		x=350,
    		y=550,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
    	
    	{
    		text=conky_parse("Wireless:"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="l",
    		x=125,
    		y=575,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
    	
    	{
    		text=conky_parse("$wireless_essid "),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="c",
    		x=350,
    		y=575,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
    	
    	{
    		text=conky_parse("Updates Available:"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="l",
    		x=125,
    		y=600,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
    	
    	{
    		text=conky_parse("${execi 28800 ~/.conky/debupdates.sh}"),
    		font_size=12,
    		bold=true,
    		font_name="CaviarDreams",
    		h_align="c",
    		x=350,
    		y=600,
    		reflection_alpha=0.8,
    		reflection_length=0.7,
    		colour={{0,0xffff00,1},{1,0x00bbbb,1}},
    		radial={0,-550,500,00,-4995,5000},
    		
    	}, 
 

    }
	
 
           
    
    
--------------FIN DES PARAMETERES----------------
    if conky_window == nil then return end
    if tonumber(conky_parse("$updates"))<3 then return end
   	
	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)

    for i,v in pairs(text_settings) do	
    	cr = cairo_create (cs)
		display_text(v)
	    cairo_destroy(cr)
    end
	
	cairo_surface_destroy(cs)
	


end

function rgb_to_r_g_b2(tcolour)
    colour,alpha=tcolour[2],tcolour[3]
    return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

function display_text(t)

	local function set_pattern()
		--this function set the pattern
		if #t.colour==1 then 
		    cairo_set_source_rgba(cr,rgb_to_r_g_b2(t.colour[1]))
		else
			local pat
			
			if t.radial==nil then
				local pts=linear_orientation(t,te)
				pat = cairo_pattern_create_linear (pts[1],pts[2],pts[3],pts[4])
			else
				pat = cairo_pattern_create_radial (t.radial[1],t.radial[2],t.radial[3],t.radial[4],t.radial[5],t.radial[6])
			end
		
		    for i=1, #t.colour do
		        cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgb_to_r_g_b2(t.colour[i]))
		    end
		    cairo_set_source (cr, pat)
		end
    end
    
    --set default values if needed
    if t.text==nil then t.text="Conky is good for you !" end
    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.colour==nil then t.colour={{1,0xFFFFFF,1}} end
    if t.font_name==nil then t.font_name="Free Sans" end
    if t.font_size==nil then t.font_size=14 end
    if t.angle==nil then t.angle=0 end
    if t.italic==nil then t.italic=false end
    if t.oblique==nil then t.oblique=false end
    if t.bold==nil then t.bold=false end
    if t.radial ~= nil then
    	if #t.radial~=6 then 
    		print ("error in radial table")
    		t.radial=nil 
    	end
    end
    if t.orientation==nil then t.orientation="ww" end
    if t.h_align==nil then t.h_align="l" end
    if t.v_align==nil then t.v_align="b" 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
    if t.rotx==nil then t.rotx=0 end
    if t.roty==nil then t.roty=0 end    
    cairo_translate(cr,t.x,t.y)
    cairo_rotate(cr,t.angle*math.pi/180)
    cairo_save(cr)       
 	
 

    local slant = CAIRO_FONT_SLANT_NORMAL
    local weight =CAIRO_FONT_WEIGHT_NORMAL
    if t.italic then slant = CAIRO_FONT_SLANT_ITALIC end
    if t.oblique then slant = CAIRO_FONT_SLANT_OBLIQUE end
    if t.bold then weight = CAIRO_FONT_WEIGHT_BOLD end
    
    cairo_select_font_face(cr, t.font_name, slant,weight)
 
    for i=1, #t.colour do    
        if #t.colour[i]~=3 then 
        	print ("error in color table")
        	t.colour[i]={1,0xFFFFFF,1} 
        end
    end

	local matrix0 = cairo_matrix_t:create()
	rotx,roty=t.rotx/t.font_size,t.roty/t.font_size
	cairo_matrix_init (matrix0, 1,roty,rotx,1,0,0)
	cairo_transform(cr,matrix0)
	cairo_set_font_size(cr,t.font_size)
	te=cairo_text_extents_t:create()
    cairo_text_extents (cr,t.text,te)
	
	set_pattern()


			
    mx,my=0,0
    
    if t.h_align=="c" then
	    mx=-te.width/2
    elseif t.h_align=="r" then
	    mx=-te.width
	end
    if t.v_align=="m" then
	    my=-te.height/2-te.y_bearing
    elseif t.v_align=="t" then
	    my=-te.y_bearing
	end
	cairo_move_to(cr,mx,my)
	
    cairo_show_text(cr,t.text)

 	
		
		
   if t.reflection_alpha ~= 0 then 
		local matrix1 = cairo_matrix_t:create()
		cairo_set_font_size(cr,t.font_size)

		cairo_matrix_init (matrix1,1,0,0,-1*t.reflection_scale,0,(te.height+te.y_bearing+my)*(1+t.reflection_scale))
		cairo_set_font_size(cr,t.font_size)
		te=cairo_text_extents_t:create()
		cairo_text_extents (cr,t.text,te)
		
				
		cairo_transform(cr,matrix1)
		set_pattern()
		cairo_move_to(cr,mx,my)
		cairo_show_text(cr,t.text)


		local pat2 = cairo_pattern_create_linear (0,
										(te.y_bearing+te.height+my),
										0,
										te.y_bearing+my)
		cairo_pattern_add_color_stop_rgba (pat2, 0,1,0,0,1-t.reflection_alpha)
		cairo_pattern_add_color_stop_rgba (pat2, t.reflection_length,0,0,0,1)	
		
		
		cairo_set_line_width(cr,0)
		dy=te.x_bearing
		if dy<0 then dy=dy*(-1) end
		cairo_rectangle(cr,mx+te.x_bearing,te.y_bearing+te.height+my,te.width+dy,-te.height*1.05)
		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
    
end


function linear_orientation(t,te)
	local w,h=te.width,te.height
	local xb,yb=te.x_bearing,te.y_bearing
	
    if t.h_align=="c" then
	    xb=xb-w/2
    elseif t.h_align=="r" then
	    xb=xb-w
   	end	
    if t.v_align=="m" then
	    yb=-h/2
    elseif t.v_align=="t" then
	    yb=0
   	end	
   	
	if t.orientation=="nn" then
		p={xb+w/2,yb,xb+w/2,yb+h}
	elseif t.orientation=="ne" then
		p={xb+w,yb,xb,yb+h}
	elseif t.orientation=="ww" then
		p={xb,h/2,xb+w,h/2}
	elseif vorientation=="se" then
		p={xb+w,yb+h,xb,yb}
	elseif t.orientation=="ss" then
		p={xb+w/2,yb+h,xb+w/2,yb}
	elseif vorientation=="ee" then
		p={xb+w,h/2,xb,h/2}		
	elseif t.orientation=="sw" then
		p={xb,yb+h,xb+w,yb}
	elseif t.orientation=="nw" then
		p={xb,yb,xb+w,yb+h}
	end
	return p
end

Offline

#6540 2013-11-03 04:59:25

cloverskull
#! Junkie
Registered: 2013-10-26
Posts: 377

Re: Conky v1.9 Thread

Here's my super simple conky setup smile  I like to monitor cpu, gpu, ram, top running processes, networking, simple calendar, and a big fat clock.  smile

ryan_conky_3nov2013.png

Here's my .conkyrc:

# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
# http://crunchbanglinux.org/forums/topic/2047/conky-help/
#
# Enjoy! 
##############################################
# Settings
##############################################
background yes
use_xft yes
xftfont HandelGotD:size=8
xftalpha 0.5
update_interval 4.0
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 200 5
maximum_width 240
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color grey
default_shade_color red
default_outline_color green
alignment top_right
gap_x 5
gap_y 5
#no_buffers yes
text_buffer_size 512
uppercase no
cpu_avg_samples 2
override_utf8_locale no

TEXT

System $alignr ${nodename}
$alignr ${pre_exec lsb_release -sd || cat /etc/*release}
Kernel ${alignr} ${kernel}

CPU $alignr Intel Core i7 Q740 @ 1.73GHz
CPU Current Speed $alignr ${freq cpu0}MHz
CPU usage $alignr ${cpu cpu0}%
CPU Temp $alignr ${hwmon temp 1}C
${cpugraph cpu0}

GPU $alignr NVIDIA Quadro FX 2800M
GPU Mem Clock $alignr ${nvidia memfreq}MHz
GPU Mem Used $alignr ${execi 5 nvidia-settings -q [gpu:0]/UsedDedicatedGPUMemory -t} / ${exec nvidia-settings -q [gpu:0]/TotalDedicatedGPUMemory -t} MiB
GPU Temp $alignr ${nvidia temp}C

MEM $alignc $mem / $memmax $alignr $memperc%
$membar

swap $alignc $swap / $swapmax $alignr $swapperc%
${swapbar}

/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_free_perc /}%
${fs_bar /}

$processes processes ($running_processes running)

NAME $alignr PID   CPU
${top name 1} $alignr ${top pid 1} ${top cpu 1}
${top name 2} $alignr ${top pid 2} ${top cpu 2}
${top name 3} $alignr ${top pid 3} ${top cpu 3}
${top name 4} $alignr ${top pid 4} ${top cpu 4}
${top name 5} $alignr ${top pid 5} ${top cpu 5}
${top name 6} $alignr ${top pid 6} ${top cpu 6}
${top name 7} $alignr ${top pid 7} ${top cpu 7}
${top name 8} $alignr ${top pid 8} ${top cpu 8}
${top name 9} $alignr ${top pid 8} ${top cpu 9}
${if_existing /proc/net/route eth0}
Network: $alignr ${execi 10 ~/.conky/pingtest.sh 74.125.228.46}
Private IP: $alignr ${addr eth0}
Public IP: $alignr ${execi 3600 wget -O - -q icanhazip.com}
Inbound eth0 $alignr ${downspeed eth0} kb/s
${downspeedgraph eth0}
Outbound eth0 $alignr ${upspeed eth0} kb/s
${upspeedgraph eth0}
Downloaded $alignr ${totaldown eth0}
Uploaded $alignr ${totalup eth0}
${endif}
${if_existing /proc/net/route wlan0}
Network: $alignr ${execi 10 ~/.conky/pingtest.sh 74.125.228.46}
Private IP: $alignr ${addr wlan0}
Public IP: $alignr ${execi 3600 wget -O - -q icanhazip.com}
Inbound wlan0 $alignr ${downspeed wlan0} kb/s
${downspeedgraph wlan0}
Outbound wlan0 $alignr ${upspeed wlan0} kb/s
${upspeedgraph wlan0}
Downloaded $alignr ${totaldown wlan0}
Uploaded $alignr ${totalup wlan0}
${endif}

Alt+F2$alignr Run Dialog
Alt+F3$alignr Alt Menu
Super+space$alignr Main Menu
Super+t$alignr Terminal
Super+f$alignr File Manager
Super+e$alignr Editor
Super+m$alignr Media Player
Super+w$alignr Web Browser
Super+g$alignr Graphics Editor
Super+l$alignr Lock Screen
Super+v$alignr Volume Control
Super+x$alignr Logout
PrtSc$alignr Screenshot

${font DejaVu Sans Mono:size=8}${execpi 60 VinDSL_Cal_8=`date +%-d`; cal -h | sed -e '1d' -e 's/\<'"$VinDSL_Cal_8"'\>/${color ffffff}&${color d7d7d7}/' -e 's/^/${offset 30}/'}
${alignc 35}${color0}${font Arial Black:size=26}${time %H:%M}${font}
${alignc} ${time %A %d.%m.%y}

The things I do probably a bit differently than most are how I test for eth0 or wlan0 and then only display networking characteristics associated with that device if it's on.  Also, the Public IP is pretty neat, but I had to black that out smile

One question I have for people, right now my calendar kind of sucks, because I wanted to keep the text gray for continuity and change the highlighted date to white, but it doesn't show very well.  How can I draw a circle around the number, or something like that?  Thanks!

Offline

#6541 2013-11-03 13:34:52

Murpe
Member
From: North Carolina
Registered: 2013-10-13
Posts: 40

Re: Conky v1.9 Thread

I've managed to get the battery meter working correctly, but I just can't figure out the script for the CPU temperature gauge. I've done a lot of searching, but none of the scripts I found will work.

Zpy9rOHs.png

Offline

#6542 2013-11-03 14:31:18

dk75
#! Junkie
Registered: 2012-06-14
Posts: 250

Re: Conky v1.9 Thread

What is sensors give you in terminal?

My output:

:~$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +46.0°C  (crit = +127.0°C)
temp2:        +46.0°C  (crit = +100.0°C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        2902 RPM
temp1:        +46.0°C  
temp2:        +40.0°C  
temp3:        +34.0°C  
temp4:            N/A  
temp5:        +32.0°C  
temp6:            N/A  
temp7:        +30.0°C  
temp8:            N/A  
temp9:        +38.0°C  
temp10:       +43.0°C  
temp11:       +41.0°C  
temp12:           N/A  
temp13:           N/A  
temp14:           N/A  
temp15:           N/A  
temp16:           N/A  

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +46.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:       +46.0°C  (high = +100.0°C, crit = +100.0°C)

:~$

Debian Sid (Minted) x86_64/3.12-10, Conky 2.0_pre, Xorg 7.7/1.15.0, KDE 4.11.5, Intel X3100
Lenovo T61, HITACHI HTS722010K9SA00 100GB, WDC_WD5000BEVT 500GB
Linux user No.: 483055 | Conky Pitstop

Offline

#6543 2013-11-03 16:30:46

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: Conky v1.9 Thread

Hello Conky hackers! I have a question regarding Conky. It's been so long since I played with it that I have forgotten what is possible. I would like to know if I can create a Conky that I can call and dismiss with a keybinding/script. Is this possible? If not, what are my other options?


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

#6544 2013-11-03 16:34:12

Tobu
Member
Registered: 2013-10-23
Posts: 19

Re: Conky v1.9 Thread

Can anyone help me? I would like to make my conky completely transparent by default, and visible on mouseover. How can I go about doing this?

Offline

#6545 2013-11-03 16:40:23

photonucleon
Quantum Geek
From: Hogwarts
Registered: 2013-06-10
Posts: 952

Re: Conky v1.9 Thread

Unia wrote:

Hello Conky hackers! I have a question regarding Conky. It's been so long since I played with it that I have forgotten what is possible. I would like to know if I can create a Conky that I can call and dismiss with a keybinding/script. Is this possible? If not, what are my other options?

In the past, I've written a bash script that, if conky is running, runs "killall conky", and if not, runs "conkywonky", then put it in ~/bin and added a keybind in Openbox's rc.xml file. Thus I could make the conky appear and disappear by a keypress. Obviously it only works if you want to show/hide all your conkys, or if you only have one.


- Ai! Aníron Undómiel. -
- Some things are certain. -
- Et Eärello Endorenna utúlien. Sinome maruvan ar Hildinyar tenn' Ambar-metta. -

Offline

#6546 2013-11-03 16:43:20

Unia
#! Octo-portal-pussy
From: The Netherlands
Registered: 2010-07-17
Posts: 4,634
Website

Re: Conky v1.9 Thread

D'oh, why haven't I thought of that... Calculus and other things at the same time do not go well!  ]:D Thanks photonucleon!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

I am a #! forum moderator. Feel free to send me a PM with any question you have!

Offline

#6547 2013-11-03 16:45:01

photonucleon
Quantum Geek
From: Hogwarts
Registered: 2013-06-10
Posts: 952

Re: Conky v1.9 Thread

Unia wrote:

D'oh, why haven't I thought of that... Calculus and other things at the same time do not go well!  ]:D Thanks photonucleon!

It's the simple things that are so often missed (especially when calculus is involved) - and you're welcome big_smile


- Ai! Aníron Undómiel. -
- Some things are certain. -
- Et Eärello Endorenna utúlien. Sinome maruvan ar Hildinyar tenn' Ambar-metta. -

Offline

#6548 2013-11-03 16:53:29

Murpe
Member
From: North Carolina
Registered: 2013-10-13
Posts: 40

Re: Conky v1.9 Thread

dk75 wrote:

What is sensors give you in terminal?

My output:

:~$ sensors
acpitz-virtual-0
Adapter: Virtual device
temp1:        +46.0°C  (crit = +127.0°C)
temp2:        +46.0°C  (crit = +100.0°C)

thinkpad-isa-0000
Adapter: ISA adapter
fan1:        2902 RPM
temp1:        +46.0°C  
temp2:        +40.0°C  
temp3:        +34.0°C  
temp4:            N/A  
temp5:        +32.0°C  
temp6:            N/A  
temp7:        +30.0°C  
temp8:            N/A  
temp9:        +38.0°C  
temp10:       +43.0°C  
temp11:       +41.0°C  
temp12:           N/A  
temp13:           N/A  
temp14:           N/A  
temp15:           N/A  
temp16:           N/A  

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +46.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:       +46.0°C  (high = +100.0°C, crit = +100.0°C)

:~$

I get this:

acpitz-virtual-0
Adapter: Virtual device
temp1:        +45.0°C  (crit = +110.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Core 0:       +43.0°C  (high = +100.0°C, crit = +100.0°C)

Offline

#6549 2013-11-03 17:04:38

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Unia wrote:

Hello Conky hackers! I have a question regarding Conky. It's been so long since I played with it that I have forgotten what is possible. I would like to know if I can create a Conky that I can call and dismiss with a keybinding/script. Is this possible? If not, what are my other options?

If you can run a bash script from a keybind ... yes it's possible:
sscn

#!/bin/bash
## Original idea by: GrouchyGaijin
## This idea by: Stinkeye - Jan 2013
## With another tweak by: arclance
## Final tweak by: Sector11
## click to start, click to stop

##if pgrep -f "conky -c /media/5/Conky/conkyrc"
##then
##	pkill -xf "conky -c /media/5/Conky/conkyrc"
##else
##	gnome-terminal -e "conky -c /media/5/Conky/conkyrc"
##fi

## not running in a terminal
## remove: gnome-terminal -e

## Tweaked

if pgrep -f "conky -c $1"
then
	pkill -xf "conky -c $1"
else
#	wmctrl -s 3 && conky -c "$1"
	conky -c "$1"
fi

2013_11_03_13_50_40_1920x1080_Sector11.jpg «-» 2013_11_03_13_50_55_1920x1080_Sector11.jpg «-» 2013_11_03_13_51_14_1920x1080_Sector11.jpg

use it in a terminal  with the name of the conky OR rename the script: sscn-myconky and use a hard coded:

if pgrep -f "conky -c /path-to/myconky"
then
	pkill -xf "conky -c /path-to/myconky"
else
	gnome-terminal -e "conky -c /path-to/myconky"
fi
EDIT

- Took a while to put this together and I see other replies.  This little script started by GG will "start stop" just the conky named - all other conkys remain untouched!

I use various forms of this script (hard coded to a specific conky) via OB Menu to start/stop various conkys ... a few examples:

  • /media/5/Conky/SSC/ssc-all-text.sh

  • /media/5/Conky/SSC/ssc-Arg-blue.sh

  • /media/5/Conky/SSC/ssc-Binary.sh

  • /media/5/Conky/SSC/ssc-cal.C512.sh

  • /media/5/Conky/SSC/ssc-Chronograph_mrpeachy.sh

  • /media/5/Conky/SSC/ssc-conkybarre_v9000.sh

Last edited by Sector11 (2013-11-03 17:23:01)


·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Be excellent to each other!

#6550 2013-11-03 17:21:40

Sector11
#!'er to BL'er
From: SR11 Cockpit
Registered: 2010-05-05
Posts: 15,667
Website

Re: Conky v1.9 Thread

Murpe wrote:

I get this:

When you ran "sudo sensors-detect" there is a comment:

Monitoring programs won't work until the needed modules are
loaded. You may want to run '/etc/init.d/kmod start'
to load them.

did you?

 03 Nov 13 | 14:13:45 ~
    $ /etc/init.d/kmod start
[info] Loading kernel module fuse.
[info] Loading kernel module firewire-sbp2.
[info] Loading kernel module loop.
[info] Loading kernel module f71882fg.
[info] Loading kernel module f71882fg.
 
 03 Nov 13 | 14:14:36 ~
    $ 

·  ↓   ↓   ↓   ↓   ↓   ↓  ·
BunsenLabs Forums now Open for Registration
·  ↑   ↑   ↑   ↑   ↑   ↑  · BL ModSquad

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo