jlfh0816 a écrit@ jpdipsy
Merci de ton aide, j'ai maintenant ton conky fond d'écran qui s'affiche parfaitement grâce aux modifications que tu m'as suggérées. Encore merci ! 😃
Question subsidiaire: j'aime beaucoup ton conky de droite, celui avec l'horloge digitale en chiffres verts en haut ainsi que ton conky musique tout en bas. Aurais-tu la gentillesse de me dire où les as-tu trouvés ?
Très bonne fin de dimanche !
Tant mieux
Pour la ville comme tu utilises la dernières version de
macomposition.sh cherche :
crea_texte "ville" 400x150 "$(CC ville)" $coul2 $fonte1 "120" 1 blue
tu peux jouer sur 3 parametres la taille de fonte "120" en la diminuant et éventuellement sur la taille de l'image "400x150" mais dans ce cas tu devra modifier la position en hauteur dans le cartouche
ajout_ima_cart "principale" "North" "70" "0" "+0" "-20" "$image_ville"
le lecteur audio et l'horloge font partie du conky. (en fait je n'ai qu'un seul conky )
L'horloge créé au départ par
Wlourf dont j'ai retravaillé le look et la fonte LCD je l'avais trouvé il y'a très très longtemps sur un sîte dédié à conky
Le lecteur est en fait le serveur mocp qui tourne à qui j'ai crée quelques scripts utils dans ma signature tu as conky_moc que tu peut utiliser seul.
Attention je balance la purée voilà le conky de droite au complet:
wn_window yes
own_window_transparent yes
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
own_window_type override
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Minimum size of text area
minimum_size 220 660
maximum_width 220 200
draw_shades no
draw_outline no
# Text alignment, other possible values are commented
alignment tr
# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 10
gap_y 50
color0 white
color1 089ff7
color2 orange
color3 grey
color4 red
music_player_interval 10
font Arial Black:size=7
template1 ${color1}${goto \1}${cpubar cpu\3 12,105}${goto \1}${color red}${cpubar cpu10 12,105}${voffset -2}${offset -93}${color yellow} \4${color white}${goto \2}${cpu cpu\3}%
template2 ${voffset 2}${color1}${goto \1}${cpubar cpu\3 12,105}${goto \1}${color red}${cpubar cpu10 12,105}${voffset -2}${offset -93}${color yellow} \4${color white}${goto \2}${cpu cpu\3}%
template5 ${if_match "${moc_state}" == "PAUSE"}${goto 160}${color4}${blink Pause}${endif}
lua_load ~/.conky/Lua/horloge.lua
lua_draw_hook_post draw_text
TEXT
${pre_exec $HOME/.moc/songchange pre}${image ~/.conky/images/bouton.png -p 25,0 -s 170x60}${voffset 60 }${font Helvetica LT Std :bold:size=10}${color orange}${alignc}${time %A} ${time %e} ${time %B} ${time %G}
${font Arial Black:size=12}${color #089ff7}System ${color #007496}${hr 1}${font Arial Black:size=8}
${font Arial Black:size=10}${color white}${alignc}Linux $kernel
${font Arial Black:size=10}${color orange}${alignc}${exec cat /etc/issue.net}
${font Arial Black:size=8}${color yellow}${alignc}Fonctionne depuis:$color ${alignc}$uptime_short${font}
${voffset -3}${color #007496}${hr 1}
${voffset -12}${hr 1}
${font Arial Black:size=8}${color grey}RAM:$color${alignr}$mem / $memmax
${color grey}Swap:$color${alignr}$swap/ $swapmax
${font Arial Black:size=12}${color 089ff7}Réseau ${color #007496}${hr 1}${font Arial Black:size=8}
#${color grey}Eth${goto 40}${color red}Up : ${color}${upspeedf eth0}k/s${goto 130}${color green}Down : ${color}${downspeedf eth0}k/s${font}
${color grey}Wlan${goto 40}${color red}Up : ${color}${upspeedf wlan1}k/s${goto 130}${color green}Down : ${color}${downspeedf wlan1}k/s${font}
${voffset -3}${color #007496}${hr 1}
${voffset -12}${hr 1}
${voffset -5}${font Arial Black:size=8}${color green}NOM PID Cpu % Mem %
${voffset -8}${color #007496}${hr 1}${font}${color red}
${top name 1}${alignr 50}${top pid 1}${alignr 35}${top cpu 1}${alignr 12}${top mem 1}${color lightgrey}
${top name 2}${alignr 50}${top pid 2}${alignr 35}${top cpu 2}${alignr 12}${top mem 2}
${top name 3}${alignr 50}${top pid 3}${alignr 35}${top cpu 3}${alignr 12}${top mem 3}
${top name 4}${alignr 50}${top pid 4}${alignr 35}${top cpu 4}${alignr 12}${top mem 4}
${font Arial Black:size=12}${color #089ff7}Matériel ${color #007496}${hr 1}${font Arial Black:size=8}
${color yellow}GPU ${goto 38}${color grey}Tmp $color: ${nvidia temp}°${color grey}${goto 135}Freq $color: ${nvidia gpufreq} Mhz${color grey}
${color yellow}CPU ${goto 38}${color grey}Tmp $color: ${platform it87.552 temp 2}°${color grey}${goto 135}Freq $color: ${freq_g} Ghz
${color yellow}C.M ${goto 38}${color grey}Tmp $color: ${platform it87.552 temp 1}°
${color orange}Températures Disques ${color #007496}${hr 1}
${font Arial Black:size=8}${color grey} Sda$color : ${hddtemp /dev/sda}° ${goto 91}${color grey}Sdb$color : ${hddtemp /dev/sdb}° ${alignr}${color grey}Sdc$color : ${hddtemp /dev/sdc}°${font}
${voffset -3}${color #007496}${hr 1}
${voffset -12}${hr 1}
${font Arial Black:size=8}${color yellow}${alignc}Utilisation Partitions
${font}${color yellow}${goto 75}Util. Libre
${color grey}${font}Sys ${goto 75}${fs_used_perc /}%${goto 105}${color green}${fs_bar 7,75 /}${color grey}${alignr}${fs_free /}
${color grey}${font}Home ${goto 75}${fs_used_perc /home}%${goto 105}${color green}${fs_bar 7,75 /home}${color grey}${alignr}${fs_free /home}
${color grey}${font}Musique ${goto 75}${fs_used_perc /mnt/Musique}%${goto 105}${color green}${fs_bar 7,75 /mnt/Musique}${color grey}${alignr}${fs_free /mnt/Musique}
${color grey}${font}Multimedia ${goto 75}${fs_used_perc /mnt/Multimedia}%${goto 105}${color green}${fs_bar 7,75 /mnt/Multimedia}${color grey}${alignr}${fs_free /mnt/Multimedia}
${color grey}${font}Datas ${goto 75}${fs_used_perc /mnt/Datas}%${goto 105}${color green}${fs_bar 7,75 /mnt/Datas}${color grey}${alignr}${fs_free /mnt/Datas}
${color grey}${font}Backups ${goto 75}${fs_used_perc /mnt/Backups}%${goto 105}${color green}${fs_bar 7,75 /mnt/Backups}${color grey}${alignr}${fs_free /mnt/Backups}
${color grey}${font}Incoming ${goto 75}${fs_used_perc /mnt/Incoming}%${goto 105}${color green}${fs_bar 7,75 /mnt/Incoming}${color grey}${alignr}${fs_free /mnt/Incoming}
${color grey}${font}Photos ${goto 75}${fs_used_perc /mnt/Photos}%${goto 105}${color green}${fs_bar 7,75 /mnt/Photos}${color grey}${alignr}${fs_free /mnt/Photos}
# moc
${image $HOME/.moc/images/fond.png -p 0,589 -s 220x66}${if_running mocp}${image /tmp/pochette.moc -p 0,591 -s 61x61 -n}
${if_existing /tmp/stream.moc}${if_match "${moc_song}" == "${execp cat /tmp/song.moc}"}${else}${exec /tmp/songchange "http://"}${endif}
${voffset -15}${alignc -25}${font Ubuntu:size=8}${color2}${execp cat /tmp/artiste.moc}${font Ubuntu:size=7}
${voffset 8}${goto 75}${color1}${execp cat /tmp/album.moc}
${goto 75}${color0}${execp cat /tmp/titre.moc}
${goto 75}${moc_curtime}${template5}${else}
${voffset -15}${alignc -25}${font Ubuntu:size=8}${color2}${execp cat /tmp/artiste.moc}${font Ubuntu:size=7}
${voffset 8}${goto 75}${color1}${execp cat /tmp/album.moc}
${goto 75}${color0}${execp cat /tmp/titre.moc}
${goto 75}${moc_timeleft} ${moc_totaltime}${template5}${endif}${endif}${font}
et le script lua pour l'horloge que j'ai retouché:
--[[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()
text_settings={
{
text="" ..conky_parse("88:88"),
x=52,
y=54,
colour={{0,0xffffff,0.1},{0.2,0xffffff,0.1},{0,0xffffff,0.1}},
orientation="nn",
font_name="LED_mono",
font_size=50,
},
{
text="" ..conky_parse("${time %H}:${time %M}"),
x=52,
y=54,
colour={{0.1,0x88F624,0.6},{0.5,0x579E17,0.8}},
orientation="nn",
font_name="LED_mono",
font_size=50,
},
--{
--text="" ..conky_parse("88"),
-- x=169,
-- y=54,
-- colour={{0,0xffffff,0.1},{0.2,0xffffff,0.1},{0,0xffffff,0.1}},
-- orientation="nn",
-- font_name="LED_mono",
-- font_size=20,
-- },
--{
-- text="" ..conky_parse("${time %S}"),
-- x=169,
-- y=54,
-- colour={{0.1,0x88F624,0.6},{0.5,0x579E17,0.8}},
-- orientation="nn",
-- font_name="LED_mono",
-- font_size=20,
-- },
}
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
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
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
print ("error in color table")
t.colour[i]={1,0xFFFFFF,1}
end
end
local te=cairo_text_extents_t:create()
cairo_text_extents (cr,t.text,te)
if #t.colour==1 then
cairo_set_source_rgba(cr,rgb_to_r_g_b(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_b(t.colour[i]))
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end
local 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)
cairo_stroke(cr)
cairo_restore(cr)
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
Voilà
edit tient une video que j'avais fait pour Voyager sur l'utilisation de conky_moc
conky_moc