Hi boys...

How can I do for moving the whole clock toward left?



Code:
--[[
При сборке скрипта использованы данные из следующих скриптов

Conky Widgets by londonali1010 (2009) - часы и кольца
Conky vertical bar graph by iggykoopa - горизонтальный и вертикальный бары
Shadowed clock by wlourf (10 jan. 2010) - стрелки часов с тенью
calendar wheel by Wlourf (14 jan. 2010) - календарь

Собрал все это Борис Кринкель <olgmen> krinkel@rambler.ru

Для этого серипта требуется CONKY версии 1.7.2

Для вызова этого скрипта в Conky вставьте следующие строки до TEXT (при условии, что скрипт сохранен в ~/scripts/conky_widgets.lua):
    lua_load ~/scripts/widgets.lua
    lua_draw_hook_pre widgets
]]

require 'cairo'
require 'imlib2'

--[[ AIR CLOCK WIDGET ]]
--[[ Виджет выводит изображение часов с объемными стрелками и тенью от стрелок.
	Часть настроек находится в виджете
]]

function clock(cr, x, y, s, bgc, bga, fgc, fga)

-- функция перекодировки цвета

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

		-- перехватываем данные часы, минуты, секунды

		local hours=os.date("%I")
		local mins=os.date("%M")
		local secs=os.date("%S")
	
		-- назначаем максимальные значения

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



-- назначаем толщину выводимых линий

		local s_th = 2
		local radius = s/2	
		local m_x,m_y = x + s/2, y + s/2

-- рисуем черный фон основы часов

-- задаем границы внешней окружности
		cairo_arc(cr, m_x,m_y, radius, 0, math.rad(360))
-- задаем цвет
		cairo_set_source_rgba(cr, 0, 0, 0, 1)
-- окрашиваем
		cairo_fill_preserve(cr)
-- завершаем действие
		cairo_stroke(cr)

-- рисуем верхнюю шестерню

		local i = 0
-- зубцы шестерни располагаем через 15 градусов
		local winkel = math.rad(15)	
-- рисуем обод шестерни
		cairo_arc(cr, m_x,m_y-s*0.275, radius*0.26, 0, math.rad(360))
-- задаем ширину обода
		cairo_set_line_width(cr,s_th*4)
-- задаем цвет
		cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
-- выводим рисунок
		cairo_stroke(cr)	
-- рисуем пустые места между зубцами шестерни, что бы показать сцепление зубцов
-- будем выводить 24 зубца		
		for i=0,23,1 do
-- задаем ширину
		cairo_set_line_width(cr,4)
-- задаем начальные точки
		cairo_move_to(cr, m_x-math.cos(secs+winkel*i)*(radius*0.25), m_y-s*0.275-math.sin(secs+winkel*i)*(radius*0.25))
-- задаем конечные точки
		cairo_line_to(cr, m_x-math.cos(secs+winkel*i)*(radius*0.32), m_y-s*0.275-math.sin(secs+winkel*i)*(radius*0.32))
-- задаем цвет
		cairo_set_source_rgba(cr, 0, 0, 0, 1)
-- выводим рисунок
		cairo_stroke(cr)
		end
-- рисуем спицы шестерни
		local i = 0
-- спицы располагаем через 60 градусов
		local winkel = math.rad(60)		
-- будем выводить 6 спиц
		for i=0,5,1 do
		cairo_set_line_width(cr,s_th*1.5)
		cairo_move_to(cr, m_x-math.cos(secs+winkel*i)*(radius*0.25), m_y-s*0.275-math.sin(secs+winkel*i)*(radius*0.25))
		cairo_line_to(cr, m_x-math.cos(secs+winkel*i), m_y-s*0.275-math.sin(secs+winkel*i))
		cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
		cairo_stroke(cr)
		end
-- --------------------------------------------------
-- рисуем левую шестерню

		local i = 0
		local winkel = math.rad(15)	

		cairo_arc(cr, m_x-s*0.2,m_y+s*0.1, radius*0.3, 0, math.rad(360))
		cairo_set_line_width(cr,s_th*4)
		cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
		cairo_stroke(cr)	
		
		for i=0,23,1 do
		cairo_set_line_width(cr,4)
		cairo_move_to(cr, m_x-s*0.2-math.cos(secs+winkel*i)*(radius*0.29), m_y+s*0.1-math.sin(secs+winkel*i)*(radius*0.29))
		cairo_line_to(cr, m_x-s*0.2-math.cos(secs+winkel*i)*(radius*0.36), m_y+s*0.1-math.sin(secs+winkel*i)*(radius*0.36))

		cairo_set_source_rgba(cr, 0, 0, 0, 1)
		cairo_stroke(cr)
		end
		
		local i = 0
		local winkel = math.rad(60)		
		
		for i=0,5,1 do
		cairo_set_line_width(cr,s_th*1.5)
		cairo_move_to(cr, m_x-s*0.2-math.cos(secs+winkel*i)*(radius*0.29), m_y+s*0.1-math.sin(secs+winkel*i)*(radius*0.29))
		cairo_line_to(cr, m_x-s*0.2-math.cos(secs+winkel*i), m_y+s*0.1-math.sin(secs+winkel*i))
		cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
		cairo_stroke(cr)
		end
-- -----------------------------------------------------
-- рисуем центральную шестерню

		local i = 0
		local winkel = math.rad(15)
-- рисуем обод
		cairo_arc(cr, m_x,m_y, radius*0.24, 0, math.rad(360))
		cairo_set_line_width(cr,s_th*2)
		cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
		cairo_stroke(cr)		
		
		for i=0,23,1 do
		cairo_set_line_width(cr,s_th)
		cairo_move_to(cr, m_x-math.sin(secs+winkel*i)*(radius*0.25), m_y-math.cos(secs+winkel*i)*(radius*0.25))
		cairo_line_to(cr, m_x-math.sin(secs+winkel*i)*(radius*0.3), m_y-math.cos(secs+winkel*i)*(radius*0.3))

		cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
		cairo_stroke(cr)
		end

		local i = 0
		local winkel = math.rad(60)		
		
		for i=0,5,1 do
		cairo_set_line_width(cr,s_th*1.5)
		cairo_move_to(cr, m_x-math.sin(secs+winkel*i)*(radius*0.25), m_y-math.cos(secs+winkel*i)*(radius*0.25))
-- рисуем спицы
cairo_line_to(cr, m_x-math.sin(secs+winkel*i), m_y-math.cos(secs+winkel*i))
		cairo_set_source_rgba(cr, 1, 0.75, 0, 1)
		cairo_stroke(cr)
		end

-- ---------------------------------------

		-- рисуем циферблат
-- задаем границы внешней окружности
		cairo_arc(cr, m_x,m_y, radius, 0, math.rad(360))
-- начинаем новое задание
		cairo_new_sub_path(cr)
-- задаем границы внутренней окружности
		cairo_arc(cr, m_x,m_y, radius*0.5, 0, math.rad(360))
-- даем задание окрасить пространство между окружностями
		cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD)
-- задаем цвет
		cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
-- окрашиваем
		cairo_fill_preserve(cr)
-- завершаем действие
		cairo_stroke(cr)

-- рисуем внешнюю окружность
		cairo_arc(cr, m_x,m_y, radius, 0, math.rad(360))
-- задаем толщину линии
		cairo_set_line_width(cr,6)
-- задаем цвет линии
		cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
-- рисуем
		cairo_stroke(cr)

-- прозрачный "корпус часов"
	
		cairo_arc(cr, m_x, m_y, radius*1.25, 0, 2*math.pi)
		cairo_set_source_rgba(cr, 0.5, 0.5, 0.5, 0.8)
		cairo_set_line_width(cr,1)
		cairo_stroke(cr)
	
		local border_pat=cairo_pattern_create_linear(m_x, m_y - radius*1.25, m_x, m_y + radius*1.25)
	
		cairo_pattern_add_color_stop_rgba(border_pat,0,0,0,0,0.7)
		cairo_pattern_add_color_stop_rgba(border_pat,0.3,1,1,1,0)
		cairo_pattern_add_color_stop_rgba(border_pat,0.5,1,1,1,0)
		cairo_pattern_add_color_stop_rgba(border_pat,0.7,1,1,1,0)
		cairo_pattern_add_color_stop_rgba(border_pat,1,0,0,0,0.7)
		cairo_set_source(cr,border_pat)
		cairo_arc(cr, m_x, m_y, radius*1.125, 0, 2*math.pi)
		cairo_close_path(cr)
		cairo_set_line_width(cr, radius*0.25)
		cairo_stroke(cr)

-- вывод часовых делений

		local i = 0
		local winkel = math.rad(30)		
		
		for i=0,11,1 do
		cairo_set_line_width(cr,s_th*1.5)
		cairo_move_to(cr, m_x-math.sin(winkel*i)*radius, m_y-math.cos(winkel*i)*radius)
		cairo_line_to(cr, m_x-math.sin(winkel*i)*(radius*0.9), m_y-math.cos(winkel*i)*(radius*0.9))
		cairo_fill_preserve(cr)
		cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
		cairo_stroke(cr)
		end

-- вывод минутных делений

		local i = 0
		local winkel = math.rad(6)

		for i=0,59,1 do
		cairo_set_line_width(cr,1)
		cairo_move_to(cr, m_x-math.sin(winkel*i)*radius, m_y-math.cos(winkel*i)*radius)
		cairo_line_to(cr, m_x-math.sin(winkel*i)*(radius*0.9), m_y-math.cos(winkel*i)*(radius*0.9))
		cairo_stroke(cr)
		end

-- рисуем деления 3, 6, 9 и 12 часовые

		cairo_set_line_width(cr,s_th/2)		-- устанавливаем толщину линий

		cairo_move_to (cr, x + 0.12*s, y + 0.5*s)
		cairo_line_to (cr, x + 0.25*s, y + 0.5*s)
		cairo_move_to (cr, x + 0.75*s, y + 0.5*s)
		cairo_line_to (cr, x + 0.88*s, y + 0.5*s)
		cairo_move_to (cr, x + 0.5*s, y + 0.12*s)
		cairo_line_to (cr, x + 0.5*s, y + 0.25*s)
		cairo_move_to (cr, x + 0.5*s, y + 0.75*s)
		cairo_line_to (cr, x + 0.5*s, y + 0.88*s)
		cairo_stroke(cr)

-- часовые стрелки с тенью, взято из Shadowed clock by wlourf (10 jan. 2010)

		function draw_hand(a_trame,arc,arc0,arc1,lg,r,border,rgb)
		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)

		if border ~= nil then
		cairo_set_line_width(cr,1)
		cairo_set_source_rgba(cr,border[1],border[2],border[3],0.5)
		cairo_move_to (cr, x0, y0)
		cairo_curve_to (cr, x0, y0, xx, yy, x1, y1)
		cairo_arc(cr,xc,yc,r,arc1-math.pi/2,arc0-math.pi/2)
		cairo_stroke(cr)
		end

-- рисуем тень

		cairo_move_to (cr, x0, y0)
		cairo_curve_to (cr, x0, y0, xx+shadow_xoffset, yy+shadow_yoffset, x1, y1)
		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)
		cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0, 0, shadow_opacity)
		cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 0)
		cairo_set_source (cr, pat)
		cairo_fill (cr)

-- рисуем стрелки

		cairo_move_to (cr, x0, y0)
		cairo_curve_to (cr, x0, y0, xx, yy, x1, y1)
		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[1], rgb[2], rgb[3], 1)
		cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 1)
		cairo_set_source (cr, pat)
		cairo_fill (cr)
		cairo_pattern_destroy (pat)
		end

-- Здесь вводятся основные данные

-- радиус часов в пикселях, задаем половину диаметра часов

		clock_r=s/2

-- координаты центра часов

		xc = x+s/2
		yc = y+s/2

-- координаты источника света относительно центра часов, 0 - источник света над центром
-- может быть положительным, источник света выше центра, или отрицательным

		shadow_xoffset=70
		shadow_yoffset=70

-- прозрачность тени, значения от 0 до 1

		shadow_opacity=0.5

-- Выводить секундную стрелку, Да - true, Нет - false.
-- При выводе секундной стрелки update_interval в .conkyrc должен быть менее 1 сек.

		show_seconds=true

-- Выводить ось стрелок в центре часов, Да - true, Нет - false.

		show_dot = true

-- размеры стрелок, первая цифра ширина, вторая - длина

		rh,lgh=3,1.2	-- часовая стрелка
		rm,lgm=2,1.75	-- минутная стрелка
		rs,lgs=1,1.9	-- секундная стрелка


-- расчет угла движения стрелок

		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_hand(alpha_trame,hours_arc,hours_arc0,hours_arc1,lgh,rh,{0,0,0},{1,1,1})
		draw_hand(alpha_trame,mins_arc,mins_arc0,mins_arc1,lgm,rm,{0,0,0},{.9,.9,.9})
		if show_seconds then
		draw_hand(alpha_trame,secs_arc,secs_arc0,secs_arc1,lgs,rs,{0,0,0},{.8,.8,.8})
		end

-- рисуем ось стрелок

		if show_dot then

		lg_shadow_center=3
		radius=math.min(rh,rm,rs)*0.75
		if radius<1 then radius=1 end
		ang = math.atan(shadow_yoffset/shadow_xoffset)

-- тень от оси

		gamma = -math.atan(1/lg_shadow_center)
		ang0=ang-gamma
		ang1=ang+gamma

-- тень от стрелок

		if shadow_xoffset<0 and shadow_yoffset>0 then
		ang0=ang0+math.pi
		ang1=ang1+math.pi
		ang=ang+math.pi
		end

		if shadow_yoffset<0 and shadow_xoffset>0 then
		ang0=ang0-math.pi/2
		ang1=ang1-math.pi/2
		ang=ang-math.pi/2
		end

		if shadow_yoffset<0 and shadow_xoffset<0 then
		ang0=ang0-math.pi/2
		ang1=ang1-math.pi/2
		ang=ang-math.pi/2
		end

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

		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*4)
		cairo_pattern_add_color_stop_rgba (pat, 0, 0, 0,0, shadow_opacity)
		cairo_pattern_add_color_stop_rgba (pat, 1, 0,0,0, 0)
		cairo_set_source (cr, pat)
		cairo_fill (cr)

		ang = ang-math.pi/2
		xshad = xc + radius*math.sin(ang)*.5
		yshad = yc - radius*math.cos(ang)*.5

		local ds_pat=cairo_pattern_create_radial(xc, yc, 0, xshad, yshad, radius)
		cairo_pattern_add_color_stop_rgba(ds_pat,0,.9,.9,.9,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)

-- рисуем глянец на стекле

		pat = cairo_pattern_create_radial (115.2, 102.4, 25.6, 102.4, 102.4, 128)
		cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 0.1)
		cairo_pattern_add_color_stop_rgba (pat, 1, 0, 0, 0, 0.4)
		cairo_set_source (cr, pat)
		cairo_arc (cr, xc, yc, s/2, 0, 2 * math.pi)
		cairo_fill (cr)
		cairo_pattern_destroy (pat)
end

--[[ END AIR CLOCK WIDGET ]]

-- ----------------------------------------------------------------------------------

--[[
calendar wheel by Wlourf (14 jan. 2010)

This script is designed to draw dates on a circular way on the left of the screen.
Some text info can be added in the circle with the file calendar.txt (see below)
Some parameters (colors, sizes ... ) can be adjusted (see below).

As this script draw a png file only if necessary, a short update of the conky can be used.

Call this script in Conky using the following before TEXT (assuming you save this script to ~/scripts/calendar.lua):
	lua_load ~/scripts/calendar.lua
	lua_draw_hook_pre main
	
	
v1.0 - 14 jan. 2010 - Original release
v1.1 - 19 jan. 2010 - Calendar are now drawn in an PNG file and this file 
	is called at every conky call, when day change, a new PNG file is created.
	- An x offset can be added to "Today's block"
	- An y offset can be added too to "Today's block"
v1.2 - 28 jan. 2010 - Calendar can be drawn on the right side of the conky (but without text info)
	- Calendar is drawn after the second conky refresh only
v1.2a - 29 jan. 2010 - Minor update, picture was refresh every second instead of every day!
]]

--require 'cairo'
--require 'imlib2'


-------------------------- end of parameters (part one) -----------------------------------	


function string:split(delimiter)
--source for the split function : http://www.wellho.net/resources/ex.php4?item=u108/split
  local result = { }
  local from  = 1
  local delim_from, delim_to = string.find( self, delimiter, from  )
  while delim_from do
    table.insert( result, string.sub( self, from , delim_from-1 ) )
    from  = delim_to + 1
    delim_from, delim_to = string.find( self, delimiter, from  )
  end
  table.insert( result, string.sub( self, from  ) )
  return result
end



function conky_draw_calendar()
--	if conky_window==nil then return end
	local width=conky_window.width
	local height=conky_window.height
--local height = s
--local width = s	
	--sometimes, there is problem with init and width & height are set to 0 or 2 !!
--	if width<3 or height<3 then return end
	
local cs=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height)
	local cr=cairo_create(cs)
	
	-------------------------- parameters (part two) are set here -----------------------------------

	
	-- vertical center of the circle (height/2 for centered circle)
	local yc=s/2+y
	
	--number of days to display before and after today (i.e. with range = 30 --> 60 days are displayed)
	--even number between 20 and 30 for nice effect
	local range = 11
	
	--not sure of the engish words so I leave then in french !	
	--fleche (arrow) is the segment from x=0 to x=radius-xc (with xc =center of the circle) 
	--fleche for the external circle
	--fleche2 for the internal circle
	--fleche2 must be < fleche
	local fleche=125
	local fleche2=fleche*.85
	
	--corde (chord) is the vertical segment (where x=0) of the external circle
	local corde = 1.5*s--height+s/2
			
	--colors RGB (0-255)
	--week day
	local wday={150,150,150}
	--week-end and bank holidays defined in calendar.txt
	local eday={255,200,0}
	--color of today
	local dday={255,255,255}
	
	--vertical gradient (both circle and dates)? (true/false)
	local vgradient=true
	
	--horizontal gradient for the circle? (0 to 1, 0 is the best choice for "moon like" circle )
	local hgradient=0
	
	--you can change the font here
	local font="PT Sans"
	--font_size (of dates) must be less than delta (= heigth of a day)
	local delta = yc/(range+0.5)
	--the font-size has to be adjusted depending on the font used
	local font_size=delta-1
	
	--information text (from calendar.txt)
	local info_color={255,200,0}
	--font size of text infos
	local font_size_info=font_size

	--today_xoffset is the offset for the date of today (can be positive/null/negative, in pixels)
	local today_xoffset=5
	
	--today_yoffset where today will be displayed (value between -range to + range)?
	-- 0 = center of the arc
	-- -range =  top of the arc
	-- +range = bottom of the arc
	local today_yoffset=0	-- -9
	
	--display on right side of the screen (true/false)
	local align_right = true

	
	-------------------------- end of the parameters, ouf -----------------------------------

	--some calculations
	--radius for external circle
	--radius2 for internal circle
	--delta = number of arcs in the circle
	local radius=(corde^2+4*fleche^2)/(8*fleche)
	local radius2=(corde^2+4*fleche2^2)/(8*fleche2)
 	local decal=2*(delta-font_size)
	wday[1]=wday[1]/255
	wday[2]=wday[2]/255
	wday[3]=wday[3]/255	
	eday[1]=eday[1]/255
	eday[2]=eday[2]/255
	eday[3]=eday[3]/255	

	--xc =x center of external circle
	--xc2=x center of internal circle
	local xc = fleche - radius	
	local xc2 = fleche2 - radius2
	
	if align_right then 
		xc = width-xc-1.5*s/2
		xc2 = width-xc2-1.5*s/2
	end

	local h_txt = height/(2*range+1)
	
	local t = os.date('*t') -- date in table
	--get the date
	local s = os.time(t) -- date in seconds

	--read the calendar file
	local file = io.open(calendar_file,"r")	
	local tabcal={}	
	local idx=1
	local line,lineok="",""
	if file ~= nil then
		while true do
		 	line = file:read("*l")
		    if line == nil then break end
			lineok = string.split(line,";")
			if (#lineok)==3 then
				tabcal[idx]={lineok[1],lineok[2],lineok[3]}
				idx=idx+1
			end
		end
	end	
	io.close()
	local angmini=math.atan((corde/2)/(radius-fleche))

	local imageDates=imlib_create_image(width,height)
	imlib_context_set_image(imageDates)
	imlib_image_set_has_alpha(1)
	imlib_save_image(image_dates)

	for i=-range,range do
		local s2 = s + 3600*24*(i-today_yoffset) --date diff in seconds

		local wd = os.date("%w",s2)
		local md = os.date("%m%d",s2)
		local dt = os.date("%a. %d %b.",s2),os.date("%d",s2),os.date("%b",s2)

		--percentage of vertical gradient
		local pc = (range-math.abs(i))/range
		if not vgradient then pc=1 end

		--angle min et max of one block
		local ang0 = angmini*(i-0.5)/range
		local ang1 = angmini*(i+0.5)/range
		if align_right then 
			ang0=math.pi-ang0
			ang1=math.pi-ang1
		end
		local angm = (ang0+ang1)/2
		
		--read the calendar.txt array
		local flag = false
		for idy=1,idx-1 do
			if tabcal[idy][1] == md then
				if (i-today_yoffset) == 0 then
					today = tabcal[idy]
				end
				if tabcal[idy][2] == "1" then
					flag = true
				end
				break
			end
		end

		--colors
		local colR,colG,colB=0,0,0
		if wd=="6" or wd=="0" or flag == true then
			colR,colG,colB=eday[1],eday[2],eday[3]
		else
			colR,colG,colB=wday[1],wday[2],wday[3]
		end
		
		--offset of today 
		local offset_x=0
		local way = 1
		if (i-today_yoffset)==0 then 
			if align_right then way =-1 end
			offset_x=today_xoffset*way 
		end

		local pat = cairo_pattern_create_radial (xc+offset_x, yc, radius,
         			xc2+offset_x,yc,radius2);
		
		cairo_pattern_add_color_stop_rgba (pat, 0, colR, colG, colB, pc);
		cairo_pattern_add_color_stop_rgba (pat, 1, colR, colG, colB, hgradient);
		
		cairo_set_source (cr, pat);
		--draw the portion of arc
		if align_right then
			x1,y1=radius*math.cos(ang0)+xc+offset_x,(radius-offset_x)*math.sin(ang0)+yc
			x2,y2=radius*math.cos(ang1)+xc+offset_x,(radius-offset_x)*math.sin(ang1)+yc
		else
			x1,y1=radius*math.cos(ang0)+xc+offset_x,(radius+offset_x)*math.sin(ang0)+yc
			x2,y2=radius*math.cos(ang1)+xc+offset_x,(radius+offset_x)*math.sin(ang1)+yc
		end
		cairo_move_to(cr,x1,y1)
		cairo_line_to(cr,x2,y2)
		cairo_line_to(cr,xc,yc)
		cairo_fill(cr)
		
		--for tests
		if (i-today_yoffset)==0 then

		end

		--write text info if needed, for left-side calendar only
		local have=""
local height = 20 -- расположение текста из calendar.txt по вертикали

if today ~= nil then
--		if (today ~= nil) and (align_right ~= true) then
			cairo_select_font_face(cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
			cairo_set_line_width(cr,0)
			cairo_set_font_size(cr,font_size_info)
			cairo_set_source_rgba (cr, info_color[1]/255, info_color[2]/255, info_color[3]/255,1);

			have = string.split(today[3],"*")
			for i=1,#have do 
				cairo_move_to(cr,10,height+(i-#have/2)*font_size_info)
				cairo_show_text(cr, have[i])
				cairo_fill(cr)
			end
		end	

		--lenght of the arc
		local dx,dy=math.abs(x2-x1),math.abs(y2-y1)
		local h_txt=math.sqrt(dx*dx+dy*dy)
		local w_txt=font_size*10

		--write text in another image for working (rotate) on it
		--didn't find to work in memory only
		local cs2=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w_txt, h_txt)
		local cr2=cairo_create(cs2)
		cairo_set_font_size (cr2, font_size);
		if (i-today_yoffset)==0 then 
			colR, colG, colB = dday[1]/255,dday[2]/255,dday[3]/255
			pc=1
		end
		cairo_select_font_face(cr2, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)

		--write ONE date in ONE picture		
		local txt_date = " " .. dt .. " "
		--start the drawing date here in order to get the lenght of the text
		--for right alignement
		cairo_move_to(cr2,0,h_txt-decal)--+offset_x*math.atan(ang0))
		cairo_set_source_rgba (cr2, colR, colG, colB,pc)
		cairo_show_text(cr2, txt_date)

		if align_right then
			local xmax,ymax=cairo_get_current_point(cr2,0,0)
			--don't use local for cs2fit cause local will be just for if .. end section
			--and then surface will not be deleted --> memory leak
			cs2fit = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, xmax, h_txt)
			cr2fit = cairo_create(cs2fit)
			
			cairo_set_font_size (cr2fit, font_size);
			cairo_select_font_face(cr2fit, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL)
			cairo_move_to(cr2fit,0,h_txt -decal)
			cairo_set_source_rgba (cr2fit, colR, colG, colB,pc)
			cairo_show_text(cr2fit, txt_date)
			cairo_stroke(cr2fit)
			cairo_surface_write_to_png(cs2fit,image_tmp)
			
		else
			cairo_stroke(cr2)
			cairo_surface_write_to_png(cs2,image_tmp)
		end
	
		--blend date image on cairo surface
		local imageTmp = imlib_load_image(image_tmp)
		imlib_context_set_image(imageTmp)

		if align_right then
			rot_img = imlib_create_rotated_image(angm+math.pi)
		else
			rot_img = imlib_create_rotated_image(angm)
		end

		imlib_context_set_image(imageTmp)
		imlib_free_image()
	
		--image is now a  square
		imlib_context_set_image(rot_img)
		local w_img0, h_img0 = imlib_image_get_width(), imlib_image_get_height()
		
		---look for center of text
		local rt=radius+w_img0/2
		if align_right then	
			rt=rt-offset_x
		else
			rt=rt+offset_x
		end
		local xt=rt*math.cos(angm)+xc-w_img0/2
		local yt=rt*math.sin(angm)+yc-h_img0/2

		imlib_context_set_image(imageDates)
		imlib_blend_image_onto_image(rot_img, 1, 0, 0, w_img0, h_img0, xt,yt, w_img0, h_img0)
		imageDates=imlib_context_get_image()
		imlib_context_set_image(rot_img)
		imlib_free_image()




		if align_right then 
			
			cairo_destroy(cr2fit)
			cairo_surface_destroy(cs2fit)
		end
	
		cairo_destroy(cr2)
		cairo_surface_destroy(cs2)

		cairo_pattern_destroy(pat)
	end --of loop

	--write to disk images with dates only
	imlib_context_set_image(imageDates)
	imlib_save_image(image_dates)	

	--write to disk image with arc only
	cairo_surface_write_to_png(cs,image_calendar)
	
	--make final image
	local imageCal = imlib_load_image(image_calendar)
	imlib_context_set_image(imageCal)
	imlib_blend_image_onto_image(imageDates, 1, 0, 0, width, height, 0,0, width, height)
	
	imlib_save_image(image_calendar)
	imlib_free_image()

	imlib_context_set_image(imageDates)
	imlib_free_image()

	--free memory
	cairo_destroy(cr)
	cairo_surface_destroy(cs)
	
end 
-- ------------------------------------------------------------------------------------------

function calendar()
	--last_date is global 
	local actual_date  = os.date("%Y%m%d") --os.date("%Y%m%d")
	local actual_cal = imlib_load_image(image_calendar)
	if (conky_parse('${updates}')+0) <2  then return end
	if  last_date ~= actual_date or actual_cal == nil then
		--print (os.date("%H%M%S"),'new picture')
		conky_draw_calendar()
		last_date = actual_date
	else
		--print (os.date("%H%M%S"),'use old picture')
	end
	if actual_cal == nil then
		actual_cal = imlib_load_image(image_calendar)
	end
	imlib_context_set_image(actual_cal)
	imlib_render_image_on_drawable(0,0)
	imlib_free_image()
	end
end
-- [[ END CALENDAR WIDGET ]]
-- -----------------------------------------------------------------------------------
function rgb_to_r_g_b(colour,alpha)
  return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end

--[[ BACKGROUND WIDGET by londonali1010 (2009)]]
function background(cr)
  local w=conky_window.width
  local h=conky_window.height
-- "corner_r" is the radius, in pixels, of the rounded corners. If you don't want rounded corners, use 0.
  local corner_r=45
-- Set the colour of your background.
  local bg_colour=0x000000
-- Set the transparency (alpha) of your background.
  local bg_alpha=0.4

  cairo_move_to(cr,corner_r,0)
  cairo_line_to(cr,w-corner_r,0)
  cairo_curve_to(cr,w,0,w,0,w,corner_r)
  cairo_line_to(cr,w,h-corner_r)
  cairo_curve_to(cr,w,h,w,h,w-corner_r,h)
  cairo_line_to(cr,corner_r,h)
  cairo_curve_to(cr,0,h,0,h,0,h-corner_r)
  cairo_line_to(cr,0,corner_r)
  cairo_curve_to(cr,0,0,0,0,corner_r,0)
  cairo_close_path(cr)

  cairo_set_source_rgba(cr,rgb_to_r_g_b(bg_colour,bg_alpha))
  cairo_fill(cr)
end
--[[ END BACKGROUND WIDGET ]]
-- ----------------------------------------------------------------------
--[[ TEXT WIDGET ]]

	function addzero100(num)

if tonumber(num) == nil then return end	--tonumber(num) == 0 end

		if tonumber(num) < 10 then
		return "00" .. num
		elseif tonumber(num) <100 then
		return "0" .. num
		else
		return num
		end
	end

	function string:split(delimiter)

		local result = { }
		local from  = 1
		local delim_from, delim_to = string.find( self, delimiter, from  )
		while delim_from do
		table.insert( result, string.sub( self, from , delim_from-1 ) )
		from  = delim_to + 1
		delim_from, delim_to = string.find( self, delimiter, from  )
		end
		table.insert( result, string.sub( self, from  ) )
		return result
	end

	function circlewriting(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)

		local inum=string.len(text)
		range=finish
		deg=(finish-start)/(inum-1)
		degrads=1*(math.pi/180)
		local textcut=string.gsub(text, ".", "%1@@@")
		texttable=string.split(textcut, "@@@")
		for i = 1,inum do
			ival=i
			interval=(degrads*(start+(deg*(i-1))))+var1
			interval2=degrads*(start+(deg*(i-1)))
			txs=0+radi*(math.sin(interval))
			tys=0-radi*(math.cos(interval))
			cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
			cairo_set_font_size (cr, fsize);
			cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
			cairo_move_to (cr, txs+horiz, tys+verti);
			cairo_rotate (cr, interval2)
			cairo_show_text (cr, (texttable[i]))
			cairo_rotate (cr, -interval2)
		end
	end

	function circlewritingdown(cr, text, font, fsize, radi, horiz, verti, tred, tgreen, tblue, talpha, start, finish, var1)

		local inum=string.len(text)
		deg=(start-finish)/(inum-1)
		degrads=1*(math.pi/180)
		local textcut=string.gsub(text, ".", "%1@@@")
		texttable=string.split(textcut, "@@@")
		for i = 1,inum do
			ival=i
			interval=(degrads*(start-(deg*(i-1))))+var1
			interval2=degrads*(start-(deg*(i-1)))
			txs=0+radi*(math.sin(interval))
			tys=0-radi*(math.cos(interval))
			cairo_select_font_face (cr, font, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
			cairo_set_font_size (cr, fsize);
			cairo_set_source_rgba (cr, tred, tgreen, tblue, talpha);
			cairo_move_to (cr, txs+horiz, tys+verti);
			cairo_rotate (cr, interval2+(180*math.pi/180))
			cairo_show_text (cr, (texttable[i]))
			cairo_rotate (cr, -interval2-(180*math.pi/180))
		end
	end

	function conky_draw_text()

		local updates=conky_parse('${updates}')
		update_num=tonumber(updates)
--		if update_num > 5 then
--			if conky_window==nil then return end
--			local w=conky_window.width
--			local h=conky_window.height
--			local cs=cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, w, h)
--			cr=cairo_create(cs)




	end
--[[ END TEXT WIDGET ]]
-- ---------------------------------------------------------------
--[[ EQUALIZER WIDGET
	v1.0 by wlourf (10 Feb. 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'.
    - "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
	- "w" and "h" are the width and the height of a block (without caps)
	- "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
	
]]

function equalizer(cr, 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)
 	local function rgb_to_r_g_b(colour, alpha)
		return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
	end
local cap_round = CAIRO_LINE_CAP_ROUND
	local cap_square = CAIRO_LINE_CAP_SQUARE
	local cap_butt = CAIRO_LINE_CAP_BUTT	

	local function setup_equalizer()
		
		local str = conky_parse(string.format('${%s %s}', name, arg))
		
		local value = tonumber(str)
		if value == nil then value = 0 end
if value <= 100 then max = 50 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= rotation*math.pi/180
		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)
			local y2=yb-radius0*math.cos(angle)
			
			--line on angle
			local a1=(y2-yb)/(x2-xb)
			local b1=y2-a1*x2

			--line perpendicular to angle
			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)
				yy0=xx0*a2+b2
				yy1=xx1*a2+b2
			end

			--perpendicular segment
			cairo_move_to (cr, xx0 ,yy0)
			cairo_line_to (cr, xx1 ,yy1)
		
			--colors
			local xc,yc=(xx0+xx1)/2,(yy0+yy1)/2
			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 segmentatioon error
	local updates=tonumber(conky_parse('${updates}'))
--	if updates> 3 then
		setup_equalizer()
--	end
end
-- ---------------------------------


function text_mail()

	local x = 0
	local y = 500
	local w=conky_window.width
	local h = 50

local extents = cairo_text_extents_t:create()
-- назначаем шрифт

	--cairo_select_font_face(cr, "PT Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD)

-- размер шрифта

	--size = 10

-- насыщенность цвета

	--alpha = 0.6


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

if updates == nil then updates = 0 end

update_num=tonumber(updates)


if (update_num % 6 == 0) then
if updates_num == nil then updates_num = 0 end
reset_num=update_num
end

if (reset_num >0)then
timer_num=update_num-reset_num

--cairo_set_font_size(cr, size*timer_num)--+1)

--cairo_text_extents(cr, "ПОЧТА !!!", extents)

--cairo_set_source_rgba(cr, 1, 0, 0, alpha+timer_num/10)
--cairo_move_to(cr, x + w/2 - extents.x_advance/2, y + 0.5*h - extents.y_bearing/2)
--cairo_show_text(cr, "ПОЧТА !!!")

end

end



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

	cr = cairo_create(cs)
	--background(cr)
	--cairo_destroy(cr)
-- ---------------------------------------

--[[ Вывод часов ]]
  
	cr = cairo_create(cs)
	clock(cr, 165, 140, 150, 0xffffff, 0.8, 0x606070, 1)
	--cairo_destroy(cr)
-- ---------------------------------------------------------------------------------

	--cr = cairo_create(cs)
	--calendar()
	--cairo_destroy(cr)

-- -------------------------------------------------------------------
	--cr = cairo_create(cs)
	--conky_draw_text()
	--cairo_destroy(cr)
-- ------------------------------------------------------------


--cr = cairo_create(cs)

equalizer(cr, 'downspeedf', 'wlan0', 1000, 10, CAIRO_LINE_CAP_ROUND, 215, 327, 1, 12, 2, 0x606070, 0.5, 0xffdf00, 0.5, 0xff8700, 1, 80, true, 1, true, 0xff0000, 0.5, 90)

equalizer(cr, 'upspeedf', 'wlan0', 100, 10, CAIRO_LINE_CAP_ROUND, 215, 417, 1, 12, 2, 0x606070, 0.5, 0xffdf00, 0.5, 0xff8700, 1, 80, true, 1, true, 0xff0000, 0.5, 90)

	--cairo_destroy(cr)

end
Code:
################## CONKY OROLOGIO ################## 

own_window		yes 
#own_window_class	Conky 
own_window_transparent	yes 
own_window_type		override 
own_window_hints	undecorated,below,sticky,skip_taskbar,skip_pager 

minimum_size 350 
#maximum_width 250 
alignment top_right 
gap_x 15 
gap_y -20 
background no 
draw_borders no
stippled_borders 1
border_width 1
draw_graph_borders no
draw_shades no
draw_outline no 
use_spacer right 
default_color 151515 	
default_shade_color  
default_outline_color 
use_xft yes 
xftfont Archangelsk:size=9 
xftalpha 0.5 
uppercase no 
override_utf8_locale yes 
update_interval 0.5 
total_run_times 0
double_buffer yes 
no_buffers yes 
cpu_avg_samples 2
net_avg_samples 2 
imlib_cache_size 0 
short_units yes 
pad_percents 2 
text_buffer_size 2048 
imlib_cache_size 0 

#--- LUA ---
lua_load ~/Scrivania/orologio.lua
lua_draw_hook_pre widgets

TEXT

${voffset 310}