J'ai rajouté l'heure (indispensable)
le conkyJP :
# Use Xft?
use_xft yes
xftfont Trebuchet MS:size=8
xftalpha 0.8
text_buffer_size 2048
background yes
# Update interval in seconds
update_interval 1
xftalpha 0.8
own_window_argb_visual yes
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 180 0
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders 0
# border margins
border_margin 5
# border width
border_width 1
# Default colors and also border colors
# default_color white
# own_window_colour white
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2
# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2
# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer none
minimum_size 300 300
maximum_width 145
alignment tl
gap_x 100
gap_y 130
lua_draw_hook_post draw_text
lua_load /home/voyager/.conky/conky22/text.lua
TEXT
Et le lua :
--[[TEXT WIDGET by Wlourf 07/06/2010
Ce widget permet d'afficher différents textes définis dans la table
text_settings{} avec différentes options
Les paramètres (tous facultatifs) sont :
text - texte à afficher, défaut = "Conky is good for you"
- coordonées relatives au coin supérieur gauche de la fenêtre conky
x - coordonnée x de la première lettre, en bas à droite, défaut = milieu de la fenêtre conky
y - coordonnée y de la première lettre, en bas à droite, défaut = milieu de la fenêtre conky
font_name - nom de la police à utiliser, défaut = Free Sans
font_size - taille de la police à utiliser, défaut = 14
italic - afficher le texte en italic si true, défaut=false
oblique - afficher le texte en oblique si true, défaut=false (je vois pas bien la différence avec italique!)
bold - afficher le texte en gras si true, défaut=false
angle - angle de rotation du texte, défaut = 0 (horizontal)
colour - table de couleur du texte, défaut = texte blanc uni {{1,0xFFFFFF,1}}
cette table contient une ou plusieurs table au format {P,C,A}
P=position pour un dégradé (0 = début du texte, 1= fin du texte)
C=couleur au format Hexadécimal (il y a plein de tables sur le net)
A=alpha (opacité) de la couleur (0=invisible,1=opacité 100%)
pour une couleur unie {{1,0x00FF00,0.5}}
pour un dégradé 2 couleurs {{0,0x00FF00,0.5},{1,0x000033,1}}
ou {{0.5,0x00FF00,1},{1,0x000033,1}} -avec celui ci le dégradé ne commensera qu'au milieu du texte
pour un dégradé 3 couleurs {{0,0x00FF00,0.5},{0.5,0x000033,1},{1,0x440033,1}}
et ainsi de suite
Necessite conky 1.8.0
Pour appeler ce script dans Conky, dans la section avant-TEXT:
lua_load /path/to/the/lua/script/text.lua
lua_draw_hook_pre draw_text
]]
require 'cairo'
function conky_draw_text()
text_settings={
--DEBUT DES PARAMETRES
{
text="" .. conky_parse("${time %A}") .. " ",--jour semaine
x=80,
y=3,
colour={{0 ,0x95b3b3,1},
},
angle=90,
font_name="geminaexpandital",
font_size=25,
bold=true
},
{
text="" .. conky_parse("${time %e}") .. " ",--numero jour
x=20,
y=90,
colour={{0 ,0xb7b88b,1},
},
angle=0,
font_name="geminaexpandital",
font_size=40,
bold=true
},
{
text="" .. conky_parse("${time %b}") .. " ",--mois
x=20,--->
y=140,--|
colour={{0 ,0xa0c3a0,1},
},
angle=-90,
font_name="geminaexpandital",
font_size=35,
bold=true
},
{
text="" .. conky_parse("${time %Y}") .. " ",--annee
x=28,
y=140,
colour={{0 ,0xda8e05,1},
},
angle=0,
font_name="geminaexpandital",
font_size=17,
italic=true
},
{
text="" .. conky_parse("${time %H}") .. ":",--heure
x=0,
y=230,
colour={{0 ,0xE4DDDD,1},
},
angle=0,
font_name="Ubuntu",
font_size=60,
italic=false
},
{
text="" .. conky_parse("${time %m}") .. " ",--minutes
x=82,
y=230,
colour={{0 ,0xE4DDDD,1},
},
angle=0,
font_name="Ubuntu",
font_size=60,
italic=false
},
}
--------------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)
cr = cairo_create (cs)
for i,v in pairs(text_settings) do
display_text(v)
end
cairo_destroy(cr)
cairo_surface_destroy(cs)
end
function rgb_to_r_g_b(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)
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
cairo_save(cr)
cairo_translate(cr,t.x,t.y)
cairo_rotate(cr,t.angle*math.pi/180)
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)
cairo_set_font_size(cr,t.font_size)
for i=1, #t.colour do
if #t.colour[i]~=3 then t.colour[i]={1,0xFFFFFF,1} end
end
if #t.colour==1 then
cairo_set_source_rgba(cr,rgb_to_r_g_b(t.colour[1]))
else
local te=cairo_text_extents_t:create()
cairo_text_extents (cr,t.text,te)
local pat = cairo_pattern_create_linear (0,0,te.width+te.x_bearing,0)
for i=1, #t.colour do
cairo_pattern_add_color_stop_rgba (pat, t.colour[i][1], rgb_to_r_g_b(t.colour[i]))
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
cairo_move_to(cr,0,0)
cairo_show_text(cr,t.text)
cairo_stroke(cr)
cairo_restore(cr)
end
Ne pas oublier de laisser la référence a "Wlourf" dans le .lua .