logo Debian Debian Debian-France Debian-Facile Debian-fr.org Forum-Debian.fr Debian ? Communautés logo inclusivité

Debian-facile

Bienvenue sur Debian-Facile, site d'aide pour les nouveaux utilisateurs de Debian.

Vous n'êtes pas identifié(e).


L'icône rouge permet de télécharger chaque page du wiki visitée au format PDF et la grise au format ODT → ODT PDF Export

Conky : horloge

Fichier conkyrc

~/.conky/conkyrc-H
background yes
update_interval 60
 
double_buffer yes
no_buffers yes
 
own_window yes
own_window_class conky
own_window_transparent yes
own_window_argb_visual yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
 
minimum_size 256 256
gap_x 64
gap_y 48
 
alignment tl
 
lua_load ~/.conky/scripts/cairo_clock.lua
 
lua_draw_hook_post cairo_clock ~/.conky/images 256 128 128   
 
TEXT

Fichier Lua

~/.conky/scripts/cairo_clock.lua
--[[ Another Clock by kit_oz
Simple clock, written using cairo
 
To use this script in Conky
1. load scripts:
    lua_load ~/.conky/just_another_clock/cairo_clock.lua
2. call function as you like:
    ${lua cairo_clock theme}
   or
    lua_draw_hook_pre cairo_clock theme
3. ?????
4. PROFIT
 
Options are:
Theme - name of the folder with the theme. Mandatory parameter
Width - width of clock in pixels. The default 200px
X and Y positions. By default center of conky window
 
2011.12.11 First release!
2011.12.13 Redesign back to original idea
]]
 
require 'cairo'
 
home = os.getenv ('HOME')
 
function conky_cairo_clock(theme,w,x,y)
	theme = string.gsub(theme, "~", home)
	theme = string.gsub(theme, "$HOME", home)
 
	if conky_window==nil then return ' ' end
 
	local w = w or 200
	local x = x or conky_window.width / 2
	local y = y or conky_window.height / 2
 
	local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
 
	local function fDrawImage(path,x,y,w,h,arc)
		local img =  cairo_image_surface_create_from_png(path)
		local w_img, h_img = cairo_image_surface_get_width (img), cairo_image_surface_get_height (img)
 
		local cr = cairo_create (cs)
		cairo_translate (cr, x, y)
		if arc then
			cairo_rotate (cr, arc)
		end
		cairo_scale (cr, w/w_img, h/h_img)
		cairo_set_source_surface (cr, img, -w_img/2, -h_img/2)
 
		cairo_paint (cr)
		cairo_destroy(cr)
		cairo_surface_destroy (img)
 
	end
 
	local arc_s = (2 * math.pi / 60) * os.date("%S")
	local arc_m = (2 * math.pi / 60) * os.date("%M") + arc_s / 60
	local arc_h = (2 * math.pi / 12) * os.date("%I") + arc_m / 12
 
	fDrawImage(theme..'/base.png',x,y,w,w)
	fDrawImage(theme..'/h.png',x,y,w,w,arc_h)
	fDrawImage(theme..'/m.png',x,y,w,w,arc_m)
	fDrawImage(theme..'/s.png',x,y,w,w,arc_s)
 
	cairo_surface_destroy(cs)
 
	return ' '
 
end
utilisateurs/paskal/config/conky-horloge.txt · Dernière modification: 07/07/2014 09:30 par paskal

Pied de page des forums

Propulsé par FluxBB