Les conkys de Loutch
loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
Reprise du message précédent
BonjourMERCI.
cronographe j'y ai pas mis les aiguilles des heures
conkyrc
Code :
--[[ pkill -xf "conky -c ~/Conky/The_Clock.conky" &
Chronograph LUA - mrpeachy (originally 4 clocks - tweaked by Sector11)
LUA-Syntax 1.10, 04-2023 @unklar
https://thepeachyblog.blogspot.com/p/index-or-home-page.html
]]
conky.config = {
own_window = true,
--own_window_colour ff0000
own_window_class = 'Conky',
own_window_transparent = true,
own_window_argb_visual = true,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',--
minimum_width = 280, minimum_height = 280,
maximum_width = 280,
alignment = 'top_right',-- tl, tm, tr, bl, bm, br, ml, mr
gap_x = 40,
gap_y = 790,
background = false,
draw_borders = false,
stippled_borders = 1,
border_width = 1,
draw_graph_borders = false,
draw_shades = false,
draw_outline = false,
use_spacer = 'right',
default_color = 'ffffff',
default_shade_color = '000000',
default_outline_color = 'ffffff',
color0 = 'FFFF00',
color1 = 'white',
color2 = 'yellow',
color3 = 'red',
use_xft = true,
font = 'Ubuntu:size=9',
xftalpha = 1,
uppercase = false,
override_utf8_locale = true,
update_interval = 1,
total_run_times = 0,
double_buffer = true,
no_buffers = true,
cpu_avg_samples = 2,
net_avg_samples = 2,
imlib_cache_size = 0,
short_units = true,
pad_percents = 2,
text_buffer_size = 2048,
imlib_cache_size = 00,
lua_load = '~/.conky/cronographe/loader.lua',
lua_draw_hook_pre = 'loader_lua',
};
conky.text = [[
${lua fDrawImage $HOME/.conky/cronographe/suite-bgv.png 15 15 270 270}
${lua fDrawImage $HOME/.conky/cronographe/c2.png -6 -5 314 314}
]];
loader
Code :
require 'cairo'
function conky_loader_lua()
usrhome = os.getenv("HOME")
dofile (usrhome .."/.conky/cronographe/scripts/crono.lua")
dofile (usrhome .."/.conky/lua/image.lua")
conky_main()
end
crono.lua
Code :
--chronograph mrpeachy 12/13/12 - i blame sector11 for starting the whole chronograph thing!
require 'cairo'
extents=cairo_text_extents_t:create()
tolua.takeownership(extents)
function conky_main()
if conky_window == nil then return end
local updates=tonumber(conky_parse("${updates}"))
if 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)
--#########################################################################################################
--defaults
default_font_name="White Rabbit"
default_font_size=16
default_font_face="n"
default_hex_color=0xffffff
default_alpha=1
default_red=1
default_green=1
default_blue=1
default_horizontal_justify="l" --"l"=left, "r"=right, "c"=center
default_vertical_justify="n" --"n"=normal, "nb"=normal-ybearing, "m"=middle, "mb"=middle-ybearing, "t"=top
default_rotation="0"
--font({f="name",fs=size,ff="face"}) face="n" or "b" or "i" or "bi"
--hexcolor({c=hexcolor,a=alpha})
--rgbcolor({r=,g=,b=,a=})
--text({x=x,y=y,t="text",hj=horizontal_justify,vj=vertical_justify,r=rotation})
--set center coordinates
centx,centy=150,150
--########################################################################################
--background circle
hexcolor({c=0x000000,a=0.3})
cairo_arc(cr,centx,centy,120,0,2*math.pi)
cairo_fill(cr)
--background circle
hexcolor({c=0x000000,a=0.0})
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_fill(cr)
--setup font and color
font({})
hexcolor({c=0xffffff})
--draw numbers and dots around main circle
for i=1,12 do
if i==12 or i==4 or i==8 then
x,y=pt(centx,centy,84,((360/12)*i))
text({y=y,x=x,t=i,hj="c",vj="m"})
end
if i==2 or i==6 or i==10 then
hexcolor({c=0xffffff})
x,y=pt(centx,centy,98,((360/12)*i))
cairo_arc(cr,x,y,6,0,2*math.pi)
cairo_fill(cr)
else
hexcolor({c=0xffffff})
x,y=pt(centx,centy,98,((360/12)*i))
cairo_arc(cr,x,y,4,0,2*math.pi)
cairo_fill(cr)
end
end--for
--draw inbetween marks
cairo_set_line_width(cr,1)
for i=1,60 do
if string.find(i/5,"%.")~=nil then
x,y=pt(centx,centy,108,((360/60)*i))
cairo_move_to(cr,x,y)
x,y=pt(centx,centy,98,((360/60)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end
end--for
--outer circle
cairo_arc(cr,centx,centy,108,0,2*math.pi)
cairo_stroke(cr)
--########################################################################################
--hours of day at 2 position
dcx,dcy=pt(centx,centy,98,60)
font({fs=8})
--numbers
for i=0,24,3 do
x,y=pt(dcx,dcy,68,180+((120/24)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--marks
for i=0,24 do
if string.find(i/3,"%.")~=nil and i~=0 then
x,y=pt(dcx,dcy,60,180+((120/24)*i))
cairo_move_to(cr,x,y)
x,y=pt(dcx,dcy,56,180+((120/24)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
else
x,y=pt(dcx,dcy,58,180+((120/24)*i))
cairo_arc(cr,x,y,1.5,0,2*math.pi)
cairo_fill(cr)
end
end
--day name
font({fs=14})
dtx,dty=pt(dcx,dcy,30,180+60)
text({x=dtx,y=dty,t=string.upper(os.date("%a")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
hour=tonumber(os.date("%H"))
dpx,dpy=pt(dcx,dcy,54,180+(120*(hour/24)))
cairo_move_to(cr,dcx,dcy)
cairo_line_to(cr,dpx,dpy)
cairo_stroke(cr)
--########################################################################################
--days of month at 6 position
font({fs=8})
hexcolor({c=0xffffff})
cairo_set_line_width(cr,1)
mcx,mcy=pt(centx,centy,98,180)
--date calcs
local year=os.date("%G")
local today=tonumber(os.date("%d"))
local t1 = os.time({year=year,month=03,day=01,hour=00,min=0,sec=0});
local t2 = os.time({year=year,month=02,day=01,hour=00,min=0,sec=0});
local feb=(os.difftime(t1,t2))/(24*60*60)
local monthdays={31,feb,31,30,31,30,31,31,30,31,30,31}
local month=os.date("%m")
local mdays=monthdays[tonumber(month)]
--marks
for i=1,mdays do
if string.find((i-1)/3,"%.")~=nil then
x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
cairo_move_to(cr,x,y)
x,y=pt(mcx,mcy,56,300+((120/mdays)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
else
x,y=pt(mcx,mcy,60,300+((120/mdays)*i))
cairo_move_to(cr,x,y)
x,y=pt(mcx,mcy,54,300+((120/mdays)*i))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end
end--for
--numbers
for i=1,mdays,3 do
x,y=pt(mcx,mcy,68,300+((120/mdays)*i))
text({y=y,x=x,t=string.format("%02d",i),hj="c",vj="m"})
end--for
--month name
font({fs=16})
text({x=mcx,y=mcy-30,t=string.upper(os.date("%b")),hj="c",vj="m"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
day=tonumber(os.date("%e"))
mpx,mpy=pt(mcx,mcy,52,300+(120*(day/mdays)))
cairo_move_to(cr,mcx,mcy)
cairo_line_to(cr,mpx,mpy)
cairo_stroke(cr)
--########################################################################################
--months of year at 10 position
font({fs=8})
hexcolor({c=0xffffff})
cairo_set_line_width(cr,1)
ycx,ycy=pt(centx,centy,98,5*60)
--date calculations
td=0
for i=1,12 do
td=td+monthdays[i]
end
angle={}
ang=0
for i=1,12 do
ang=((monthdays[i]/td)*120)+ang
angle[i]=ang
end
months={"J","F","M","A","M","J","J","A","S","O","N","D"}
--arc line
cairo_arc(cr,ycx,ycy,60,adeg(60),adeg(60+ang))
cairo_stroke(cr)
--arc marks
for i=0,12 do
x,y=pt(ycx,ycy,60,60+((angle[i] or 0)))
cairo_move_to(cr,x,y)
x,y=pt(ycx,ycy,56,60+((angle[i] or 0)))
cairo_line_to(cr,x,y)
cairo_stroke(cr)
end
--month letters
for i=1,12 do
x,y=pt(ycx,ycy,68,60+((120/12)*i)-(120/24))
text({y=y,x=x,t=months[i],hj="c",vj="m"})
end--for
--year text
font({fs=16})
ytx,yty=pt(ycx,ycy,30,60+60)
text({x=ytx,y=yty,t=string.upper(os.date("%y")),hj="c",vj="m"})
font({fs=12})
text({x=ytx-4,y=yty-10,t="20",hj="c",vj="n"})
--indicator
cairo_set_line_width(cr,2)
hexcolor({c=0xffffff})
today=tonumber(os.date("%j"))-1
ypx,ypy=pt(ycx,ycy,55,60+(120*(today/td)))
cairo_move_to(cr,ycx,ycy)
cairo_line_to(cr,ypx,ypy)
cairo_stroke(cr)
--center circle
hexcolor({c=0xffffff,a=0}) -- couleur cercle centre aiguille
cairo_arc(cr,centx,centy,5,0,2*math.pi)
cairo_stroke(cr)
--hand calculations #######################################################
hours=tonumber(os.date("%I"))
-- convert hours to seconds
h_to_s=hours*60*60
minutes=tonumber(os.date("%M"))
-- convert minutes to seconds
m_to_s=minutes*60
-- get current seconds
seconds=tonumber(os.date("%S"))
-- DRAW HOUR HAND
-- get hours minutes seconds as just seconds
hsecs=h_to_s+m_to_s+seconds
-- calculate degrees for each second
hsec_degs=hsecs*(360/(60*60*12))
--call hand drawing function
--hexcolor({c=0xccaa7a,a=0.8})
hexcolor({c=0xff0000,a=0}) -- aiguilles
cairo_set_line_width(cr,2)
hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs,--string or value for hand degrees
70,--string or value for hand length (radius)
3,--set hand center width in pixels
3,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
centx,--string or coodinate for clock center x
centy,--string or coodinate for clock center y
hsec_degs+180,--string or value for hand degrees
30,--string or value for hand length (radius)
6,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--MINUTES HAND
--hexcolor({c=0xdac09b,a=0.8})
hands(
150,--string or coodinate for clock center x
150,--string or coodinate for clock center y
360*((m_to_s+seconds)/(60*60)),--string or value for hand degrees
99,--string or value for hand length (radius)
3,--set hand center width in pixels
3,--set hand mid width in degrees
2,--set hand end width in pixels, 0=a point
0.9--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)
--[[hands(
200,--string or coodinate for clock center x
200,--string or coodinate for clock center y
180+(360*((m_to_s+seconds)/(60*60))),--string or value for hand degrees
30,--string or value for hand length (radius)
4,--set hand center width in pixels
18,--set hand mid width in degrees
0,--set hand end width in pixels, 0=a point
0.8--number from 0 to 1 as a propotion of total hand length, ie 0.5 is exact middle distance
)--]]
--#########################################################################################################
cairo_destroy(cr)
cairo_surface_destroy(cs)
cr=nil
return ""
end--end main function
--this function draws hands
function hands(clock_centerx,clock_centery,degrees,length,hand_center_width,hand_mid_width,hand_end_width,distance_to_mid)
--draw_middle
--calc start point
xs,ys=pt(clock_centerx,clock_centery,hand_center_width,degrees-90)
cairo_move_to(cr,xs,ys)
x1,y1=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees-(hand_mid_width/2))
cairo_line_to (cr,x1,y1)
x2,y2=pt(clock_centerx,clock_centery,length,degrees)
cairo_arc(cr,x2,y2,hand_end_width,(degrees+180)*(math.pi/180),(degrees)*(math.pi/180))
--cairo_line_to (cr,x2,y2)
x3,y3=pt(clock_centerx,clock_centery,length*distance_to_mid,degrees+(hand_mid_width/2))
cairo_line_to (cr,x3,y3)
--calc end point
xe,ye=pt(clock_centerx,clock_centery,hand_center_width,degrees+90)
cairo_line_to (cr,xe,ye)
cairo_arc(cr,clock_centerx,clock_centery,hand_center_width,(degrees)*(math.pi/180),(degrees+180)*(math.pi/180))
cairo_fill(cr)
end
function adeg(deg)
return(math.pi/180)*(deg-90)
end
function pt(px,py,prad,pdeg)
local ppo=(math.pi/180)*pdeg
local px1=px+prad*(math.sin(ppo))
local py1=py-prad*(math.cos(ppo))
return px1,py1
end
function font(fontt)
local name=fontt.f or default_font_name or "mono"
local size=fontt.fs or default_font_size or 12
local face=fontt.ff or default_font_face or "n"
if face=="n" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="b" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_NORMAL,CAIRO_FONT_WEIGHT_BOLD)
elseif face=="i" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_NORMAL)
elseif face=="bi" then
cairo_select_font_face(cr,name,CAIRO_FONT_SLANT_ITALIC,CAIRO_FONT_WEIGHT_BOLD)
end
cairo_set_font_size(cr,size)
end
function hexcolor(hexcolort)
local col=hexcolort.c or default_hex_color or 0xffffff
local a=hexcolort.a or default_alpha or 1
local r,g,b=((col/0x10000) % 0x100)/255,((col/0x100) % 0x100)/255,(col % 0x100)/255
cairo_set_source_rgba(cr,r,g,b,a)
end
function rgbcolor(rgbcolort)
local r=rgbcolort.r or default_red or 1
local g=rgbcolort.g or default_green or 1
local b=rgbcolort.b or default_blue or 1
local a=rgbcolort.a or default_alpha or 1
cairo_set_source_rgba(cr,r,g,b,a)
end
function text(textt)
local x=textt.x or 100
local y=textt.y or 100
local t=textt.t or "set txt"
local hj=textt.hj or default_horizontal_justify or "l"
local vj=textt.vj or default_vertical_justify or "n"
local r=textt.r or default_rotation or 0
cairo_text_extents(cr,t,extents)
local wx=extents.x_advance
local wd=extents.width
local hy=extents.height
local bx=extents.x_bearing
local by=extents.y_bearing+hy
--hl-- l=left, c=center, r=right
if hj=="l" then
xa=x-bx
rad=0
elseif hj=="c" then
xa=x-((wx-bx)/2)-bx
rad=(wx-bx)/2
elseif hj=="r" then
xa=x-wx
rad=wx-bx
else
print ('hj not set correctly for text: '..t..' - "l", "c" or "r"')
xa=0
rad=0
end
--vj-- n=normal, nb=normal-ybearing, m=middle, mb=middle-ybearing, t=top
if vj=="n" then
ya=y
rad2=0
ry=by
elseif vj=="nb" then
ya=y-by
rad2=-by
ry=by
elseif vj=="m" then
ya=y+((hy-by)/2)
rad2=((hy-by)/2)
ry=((hy-by)/2)-by
elseif vj=="mb" then
ya=y+(hy/2)-by
rad2=(hy/2)-by
ry=((hy-by)/2)-by
elseif vj=="t" then
ya=y+hy-by
rad2=hy-by
ry=0+by
else
print ('vj not set correctly for text: '..t..' - "n", "nb", "m", "mb" or "t"')
ya=0
rad2=0
ry=0
end
--rotation
if r~=0 then
local x2,y2=pt(x,y,rad2,r-180)
local x1,y1=pt(x2,y2,rad,r-90)
cairo_save (cr)
cairo_translate (cr,x1,y1)
cairo_rotate(cr,(math.pi/180)*r)
cairo_show_text (cr,t)
cairo_stroke (cr)
cairo_restore (cr)
else
cairo_move_to (cr,xa,ya)
cairo_show_text (cr,t)
cairo_stroke (cr)
end--if ro
--set non local variables to nil
xa=nil;ya=nil;rad=nil;rad2=nil;ry=nil
end--function text ###################################################################

@+
Édité par loutch Le 08/05/2023 à 10h06
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
conkyrc
Code :
conky.config = {
background = true,
use_xft = true,
font = 'Liberation Sans:size=7',
xftalpha = 1,
update_interval = 1.0,
total_run_times = 0,
own_window = true,
own_window_transparent = false,
-- own_window_color = 000000,
own_window_argb_visual = true,
own_window_argb_value = 00,
own_window_type = 'normal',
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager',
double_buffer = true,
minimum_width = 270, minimum_height = 550,
maximum_width = 270,
text_buffer_size = 2048,
draw_shades = false,
draw_outline = false,
draw_borders = false,
draw_graph_borders = false,
default_color = 'white',
default_outline_color = 'white',
alignment = 'top_right',
gap_x = 36,
gap_y = 330,
no_buffers = true,
uppercase = false,
cpu_avg_samples = 2,
override_utf8_locale = true,
imlib_cache_flush_interval = 60,
imlib_cache_size = 10000,
-- Taille des pointillés
stippled_borders = 5,
-- Couleurs
default_color = '#ffffff',
default_shade_color = '#333333',
default_outline_color = 'black',
lua_load = '~/.conky/olgmen/scripts/loader.lua',
lua_draw_hook_pre = 'loader_lua',
color1 = 'F5B800',
color2 = '00f5ff',
color3 = '828200',
color4 = '323200',
color5 = 'fdb72e',
color7 = '6495ee',
color9 = 'red',
};
conky.text = [[
${lua conky_draw_bg 20 0 6 270 452 0x000000 0.2}
${lua fDrawImage $HOME/conky-openmeteo/Suisse/fond/suite-bgv.png 0 0 273 460}
]];
loader
Code :
require 'cairo'
function conky_loader_lua()
usrhome = os.getenv("HOME")
dofile (usrhome .."/.conky/olgmen/scripts/datah.lua")
dofile (usrhome .."/.conky/olgmen/scripts/draw_bg.lua")
dofile (usrhome .."/.conky/lua/image.lua")
conky_widgets()
end
datah
Code :
--[[data_comp.lua par olgmen le 25/12/2011
Francisation par loutch
fonction affiche des données sur le fonctionnement du processeur, de la mémoire, de l'Internet
pour exécuter cette fonction, il est nécessaire dans conkyrc, au-dessus du mot TEXT ajouter les lignes suivantes
# - Lua Load - #
lua_load ~ / scripts / data_comp.lua
lua_draw_hook_pre conky_widgets
Toutes les données sont calculées pour une utilisation dans la fenêtre conky avec la taille de 1260x675 (dans tout mon écran)
]]
require "cairo"
-- définir la section d'accueil, pour la capacité de travailler à partir de n'importe quel ordinateur
usrhome = os.getenv("HOME")
-- les scripts nécessaires sont dans le dossier des scripts
--dofile (usrhome .."/scripts/backgraund.lua") -- arrière-plan de sortie de script, cadres
dofile (usrhome .."/.conky/olgmen/scripts/text.lua") -- script sorties textes
dofile (usrhome .."/.conky/olgmen/scripts/scale.lua") -- sorties de script échelles
text_color = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}}
-- fonction qui démarre tout affiché dans la fenêtre conky. Toutes les données sont calculées pour une utilisation dans la fenêtre conky avec la taille de 1260x675 (dans tout mon écran)
function conky_widgets()
text_settings = {
{
text ="CPU 0" .. " " .. "°C",
x = 20,
y = 15,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Freq",
x = 130,
y = 15,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Ram" .." ".."Swap" ,
x = 25,
y = 115,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="/" .." ".."/Home" ,
x = 190,
y = 115,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Nvidia" .." ".."Intel" ,
x = 25,
y = 245,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text ="Vitesse",
x = 120,
y = 245,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = "Entrant" .. " " .. "Sortant",
x = 104,
y = 355,
font_size = 9,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${top name 1}"),
x = 60,
y = 35,
font_size = 10,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${top cpu 1}%"),
x = 190,
y = 35,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xff0000, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top mem 1)}%"),
x = 135,
y = 135,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xff0000, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top name 2}"),
x = 60,
y = 45,
font_size = 10,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color , --{{0, 0x550000, 1},{0.5, 0xcf5500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top mem 2)}%"),
x = 135,
y = 145,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xcf5500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top cpu 2}%"),
x = 190,
y = 45,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color , --{{0, 0x550000, 1},{0.5, 0xcf5500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top name 3}"),
x = 60,
y = 55,
font_size = 10,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color , --{{0, 0x550000, 1},{0.5, 0xcfa500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top mem 3)}%"),
x = 135,
y = 155,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xcfa500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top cpu 3}%"),
x = 190,
y = 55,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x550000, 1},{0.5, 0xcfa500, 1},{1, 0x550000, 1}},
orientation="nn",
},
{
text = conky_parse("${top name 4}"),
x = 60,
y = 65,
font_size = 10,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = conky_parse("${top mem 4)}%"),
x = 135,
y = 165,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = conky_parse("${top cpu 4}%"),
x = 190,
y = 65,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = conky_parse("${top name 5}"),
x = 60,
y = 75,
font_size = 10,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = conky_parse("${top mem 5)}%"),
x = 135,
y = 175,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = conky_parse("${top cpu 5}%"),
x = 190,
y = 75,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color ,--{{0, 0x555500, 1},{0.5, 0xcfcf00, 1},{1, 0x555500, 1}},
orientation="nn",
},
{
text = "Total",
x = 25,
y = 380,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${totaldown wlo1}"),
x = 15,
y = 400,
font_size = 10,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${downspeedf wlo1}"),
x = 25,
y = 420,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = "Total",
x = 225,
y = 380,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${totalup wlo1}"),
x = 215,
y = 400,
font_size = 10,
bold = false,
h_align = "l",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${upspeedf wlo1}"),
x = 225,
y = 420,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${wireless_essid wlo1}"),
x = 110,
y = 450,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color,
orientation="nn",
},
{
text = conky_parse("${wireless_link_qual_perc wlo1}%"),
x = 170,
y = 450,
font_size = 10,
bold = false,
h_align = "c",
v_align = "m",
colour = text_color,
orientation="nn",
},
}
-- dériver des échelles
scale_settings = {
{
name = "cpu",
arg = "cpu0",
x = 10,
y = 20,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 11,
},
{
name = "freq",
arg = "cpu",
x = 120,
y = 20,
width = 38,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
side = "left",
},
{
name = "exec",
arg = "expr `cat /sys/class/hwmon/hwmon4/temp1_input` / 1000",
x = 220,
y = 20,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
font_size = 11,
},
{
name = "memperc",
arg = "",
x = 10,
y = 120,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 11,
},
{
name = "swapperc",
arg = "",
x = 60,
y = 120,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 11,
},
{
name = "fs_used_perc",
arg = "/",
x = 170,
y = 120,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 11,
},
{
name = "fs_used_perc",
arg = "/home",
x = 220,
y = 120,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 11,
},
{
name = "exec",
arg = "nvidia-settings -t -q [gpu:0]/GPUCoreTemp", -- nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader
x = 10,
y = 250,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
font_size = 11,
},
{
name = "exec",
arg = "sensors | grep -i fan |awk '{print $2}'",
x = 120,
y = 250,
width = 38,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "hwmon",
arg = "1 temp 1",
x = 220,
y = 250,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xff0000, 1},{0.5, 0xffffff, 1},{1, 0x0000ff, 1}},
font_size = 11,
},
{
name = "",
arg = math.ceil(conky_parse("${downspeedf wlo1}")),
x = 100,
y = 360,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
{
name = "",
arg = math.ceil(conky_parse("${upspeedf wlo1}")),
x = 150,
y = 360,
width = 42,
height = 80,
scale = 20,
colour_scale = {{0, 0xffffff, 1},{0.5, 0xffffff, 1},{1, 0xffffff, 1}},
font_size = 9,
},
}
-- --------------------------------------------------------------------
--[[ Ici, l'entrée de toutes les données se termine ]]
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)
--[[ ÉCHELLES ]]
for i,v in pairs(scale_settings) do
cr = cairo_create (cs)
dialgraph(v)
cairo_destroy(cr)
end
-- sortie de texte
for i,v in pairs(text_settings) do
cr = cairo_create (cs)
display_text(v)
cairo_destroy(cr)
end
end -- fonction de fermeture

@+
Édité par loutch Le 08/05/2023 à 10h05
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
@ droite de l'écran

@+
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
Citation du site anglais traduite avec trans -brief (bon des fois c'est pas ça mais dans l'ensemble c'est bon )
Script
Code BASH :
#!/bin/bash curl -s "https://www.calendarlabs.com/today/" | grep '<p>' | sed '3q;d' | sed 's/<p>//' | sed 's/<\/p>//' | sed 's/^[ \t]*//' > $HOME/.conky/Tahoe/citation/citation_en sed -n '1p' $HOME/.conky/Tahoe/citation/citation_en | trans -brief :fr > $HOME/.conky/Tahoe/citation/citation_fr exit
Le conky doit être assez large surtout si c'est du Lao Tzu.
la partie après TEXT
Code TEXT :
${alignc}Citation du jour${execi 3600 ~/.conky/Tahoe/citation/traduction.sh}
${alignc}${texeci 600 sed -n '1p' $HOME/.conky/Tahoe/citation/citation_fr | fmt -w 140 | sed -n '1p'}
${alignc}${texeci 600 sed -n '1p' $HOME/.conky/Tahoe/citation/citation_fr | fmt -w 140 | sed -n '2p'}
${alignc}${texeci 600 sed -n '1p' $HOME/.conky/Tahoe/citation/citation_fr | fmt -w 140 | sed -n '3p'}
${alignc}${texeci 3600 curl -s "https://www.calendarlabs.com/today/" | grep '<strong>' | sed '2q;d' | sed 's/^[ \t]*//' | awk -F'</strong>' '{print $1}' | sed 's/<div class="quote-auth"><strong>//'}
Donne ceci

Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
loutch Membre non connecté
-
- Voir le profil du membre loutch
- Inscrit le : 07/07/2010
- Groupes :
Conky-spotify
Conkyrc
Code :
conky.config = {
-- — Conky settings — #
background = true,
update_interval = 1,
total_run_times = 0,
net_avg_samples = 2,
cpu_avg_samples = 1,
no_buffers = true,
imlib_cache_size = 0,
top_cpu_separate = false,
-- draw_shades = true,
draw_graph_borders = true,
--draw_borders = true,
draw_outline = false,
-- — Window specifications — #
own_window = true,
own_window_type = normal,
own_window_transparent = false,
own_window_hints = 'undecorated,skip_taskbar,skip_pager,below',
own_window_argb_visual = true,
own_window_argb_value = 00, -- 60
own_window_colour = '000000',
double_buffer = true,
minimum_width = 260,
maximum_width = 260, minimum_height = 240,
alignment = 'top_right',
border_inner_margin = 10,
gap_x = 35,
gap_y = 835,
-- — Text settings — #
use_xft = true,
font = 'Ubuntu:size=8',
override_utf8_locale = true,
default_color = '#FFFFFF',
color0 = '#ff0000',
color1 = '#AEEEEE',
color2 = '#6495ee',
color3 = '#0ab1ff', -- Light Blue
color4 = '#4682B4', -- Steel Blue
color5 = '#9FB6CD', -- Slate Grey
color6 = '#000000', -- Black
color7 = '#888888', -- Grey
default_bar_width=100,
default_bar_height=2,
lua_load = '~/.conky/lua/image.lua',
};
conky.text = [[${exec ~/.conky/conky-spotify/scripts/cover.sh}${voffset -20}
${alignc}${color3}SPOTIFY $color
${alignc}${exec ~/.conky/conky-spotify/scripts/artist.sh}${execi 10 ~/.conky/conky-spotify/scripts/title.sh > ~/.conky/conky-spotify/titre}
${alignc}${if_match "${exec sed -n '1p' ~/.conky/conky-spotify/titre}" == "Advertisement"}Publicité ${else}${exec ~/.conky/conky-spotify/scripts/title.sh}${endif}
${alignc}${exec ~/.conky/conky-spotify/scripts/position.sh} ${execbar 2,160 ~/.conky/conky-spotify/scripts/marens_bare.sh} $color3}${exec ~/.conky/conky-spotify/scripts/duree.sh}
${if_match "${execi 2 sed -n '1p' $HOME/.conky/conky-spotify/current/current.txt}" == ""}${lua fDrawImage ~/.conky/conky-spotify/pub.png 50 65 180 180}${else}${lua fDrawImage ~/.conky/conky-spotify/current/current.png 50 65 180 180}${endif}
${voffset 170}$color
${hr 1}
${voffset -200}
]];
cover.sh
Code :
#!/bin/bash
id_current=$(cat ~/.conky/conky-spotify/current/current.txt)
id_new=`~/.conky/conky-spotify/scripts/id.sh`
cover=
imgurl=
dbus=`busctl --user list | grep "spotify"`
if [ "$dbus" == "" ]; then
`cp ~/.conky/conky-spotify/empty.png ~/.conky/conky-spotify/current/current.jpg`
echo "" > ~/.conky/conky-spotify/current/current.txt
else
if [ "$id_new" != "$id_current" ]; then
echo $id_new > ~/.conky/conky-spotify/current/current.txt
imgname=`cat ~/.conky/conky-spotify/current/current.txt | cut -d '/' -f5`
cover=`ls ~/.conky/conky-spotify/covers | grep "$id_new"`
if grep -q "${imgname}" <<< "$cover"
then
`cp ~/.conky/conky-spotify/covers/$imgname.jpg ~/.conky/conky-spotify/current/current.jpg`
else
imgurl=`~/.conky/conky-spotify/scripts/imgurl.sh`
`wget -q -O ~/.conky/conky-spotify/covers/$imgname.jpg $imgurl &> /dev/null`
`touch ~/.conky/conky-spotify/covers/$imgname.jpg`
`cp ~/.conky/conky-spotify/covers/$imgname.jpg ~/.conky/conky-spotify/current/current.jpg`
`convert ~/.conky/conky-spotify/current/current.jpg ~/.conky/conky-spotify/current/current.png`
# clean up covers folder, keeping only the latest X amount, in below example it is 10
rm -f `ls -t ~/.conky/conky-spotify/covers/* | awk 'NR>10'`
rm -f wget-log #wget-logs are accumulated otherwise
fi
fi
fi
artist.sh
Code :
#!/bin/bash
artist=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|grep -E -A 2 "artist"|grep -E -v "artist"|grep -E -v "array"|cut -b 27-|cut -d '"' -f 1|grep -E -v ^$`
echo $artist
title.sh
Code :
#!/bin/bash
title=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|grep -E -A 1 "title"|grep -E -v "title"|cut -b 44-|cut -d '"' -f 1|grep -E -v ^$`
echo $title
album.sh
Code :
#!/bin/bash
album=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|grep -E -A 1 "album"|grep -E "^\s*variant"|cut -b 44-|grep -E -v ^$|sed 's/"$//'`
echo $album
id.sh
Code :
#!/bin/bash
id=`dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | grep spotify/track | cut -d '"' -f2`
echo $id
imgurl.sh
Code :
#!/bin/bash
imgurl=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | grep -E -A 0 "image" | cut -d '"' -f2`
echo $imgurl
duree.sh
Code :
#!/bin/bash
convertsec()
{
x=`expr $1 / 1000000`
s=`expr $x % 60`
x=`expr $x / 60`
m=`expr $x % 60`
printf "%02d:%02d\n" $m $s
}
POS=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)
TOTAL=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}')
if [ -z $TOTAL ]
then
positionTime="00:00"
lengthTime="00:00"
length="stopped"
position=1
else
positionTime=$(convertsec $POS)
lengthTime=$(convertsec $TOTAL)
length=$(($TOTAL/1000000))
position=$(($POS/1000000))
fi
vol=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Volume)
# echo $length
# echo $position
# echo $positionTime
echo $lengthTime
position.sh
Code :
#!/bin/bash
convertsec()
{
x=`expr $1 / 1000000`
s=`expr $x % 60`
x=`expr $x / 60`
m=`expr $x % 60`
printf "%02d:%02d\n" $m $s
}
POS=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)
TOTAL=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}')
if [ -z $TOTAL ]
then
positionTime="00:00"
lengthTime="00:00"
length="stopped"
position=1
else
positionTime=$(convertsec $POS)
lengthTime=$(convertsec $TOTAL)
length=$(($TOTAL/1000000))
position=$(($POS/1000000))
fi
vol=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Volume)
# echo $length
# echo $position
echo $positionTime
marens_bare.sh
Code :
#!/bin/bash
total=$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}')
if [[ "$total" != "0" ]]; then
percentage=$(echo "scale=1;$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Position)*100/$(qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata | grep "^mpris:length" | awk '{print $2}') + 0.5" | bc | awk '{print int($1)}')
echo $percentage
else
echo '0.05'
fi
Tout ce beau monde donne ceci .

en grand.

@+
Édité par loutch Le 07/11/2025 à 17h02
Linuxmint 24.02 Xia - Mageia 9 xfce et plasma sur ssd sur HP Pavilion g7
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Xubuntu 18.04 LTS et 24.04 en xfce sur ASUS Rog STRIX
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie