Recherche quelques exemples de config .conkyrc

Bureaux,conky et autres personnalisations esthétiques.
Avatar du membre
Toad_Fr
Messages : 175
Enregistré le : mar. 23 août 2016 13:44
Localisation : Eure

Recherche quelques exemples de config .conkyrc

Message par Toad_Fr »

Salut a tous :)

Alors pour la petite histoire, je viens d'installer conky sur lequel j'ai vu pas mal de sujet et qui me paraissais intéressant et pas mal utilisé par bon nombre de membre du forum si j'en crois les exemples du topic "vos bureaux".

Je souhaiterais juste afficher l'utilisation du processeur, la température, l'utilisation de la ram, utilisation reseau ethernet et wifi + graphique.

Mais j'ai potasser a l'arrache pour la configuration du .conkyrc et j'avoue que ça m'a l'air un peu chiant et je suis en panne d'inspiration pour ne rien vous cacher alors si quelques bonnes âmes pouvais me déposer quelques exemples de leur code config perso avec une image pour illustré le résultat ça serais bien sympas.

Le top serais:

Code : Tout sélectionner

votre code bla bla bla 
##avec quelques commentaires explicatif éventuellement##
=> image pour illustrer le résultat

Je m'arrangerais pour décrypté tout ça.
j'ai également vu qu'il y a conky manager si certains s'en serve des retours d’expérience sont le bienvenue pas mal de widget présent rende pas terrible ou ne ressemble pas a ce qu'ils sont censé être (graphiquement je veut dire) j'en ai un pas mal mais l'indication réseau affiche que dalle

Merci d'avance.

Merci de NE PAS polluer le sujet par des réponses inutile :mrgreen:
Image

Avatar du membre
david37
modérateur
Messages : 3884
Enregistré le : lun. 22 août 2016 05:06

Re: Recherche quelques exemples de config .conkyrc

Message par david37 »

Salut casp3r,

A ce que je vois, on a les mêmes centres d'intérêt, je comptais me lancer dans conky ce week end.
Pour ma part, je pensais suivre les exemples proposés dans ces liens pour commencer à apprivoiser la bête:

https://doc.ubuntu-fr.org/conky" onclick="window.open(this.href);return false;
https://doc.ubuntu-fr.org/conky_scripts_systeme" onclick="window.open(this.href);return false;

J'espère que ça t'aidera
A+

David
PC1: Mobo: Gigabyte B550 AORUS Elite 2 / CPU: AMD Ryzen 7 3700X / GPU: MSI Radeon RX 580 Armor / RAM: 32 GB @3600 MHz CL16 / SSD: Samsung 970 EVO 500 GB / LM 20.2 Xfce
PC2: HP Pavilion 15 / AMD Ryzen 5 5500U with Radeon Graphics / 16GB RAM / 500 GB SSD / Debian 11 Xfce
PC3: Dell-Latitude E7240 / 2.1GHz i7-4600U / Intel Haswell-ULT HD 4400 / 8GB RAM / 250 GB Hard Drive / LM 20.2 Xfce

zeb
Messages : 16473
Enregistré le : ven. 19 juin 2015 22:13
Localisation : plus ici

Re: Recherche quelques exemples de config .conkyrc

Message par zeb »

Salut ;)
Je me permet de polluer un chouia en te signalant la présence de nombreux liens dans l'onglet "personnalisation" du haut de page, c'est bien aussi de comprendre le fonctionnement pour pouvoir le personnaliser ;)

Aussi, juste pour répondre à ta question ;)
casp3r a écrit :quelques exemples de leur code config perso avec une image pour illustré le résultat ça serais bien sympas.

Voici le mien:

Code : Tout sélectionner

background yes
use_xft yes
xftfont Sans:size=10
xftalpha 1
update_interval 1.0
total_run_times 0
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 220
maximum_width 1500
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_outline_color white
alignment top_right
gap_x 10
gap_y 10
no_buffers yes
uppercase no
cpu_avg_samples 4
net_avg_samples 4
override_utf8_locale yes
#
color1 white
#
color2 orange
#
color3 6495ee
#
color4 green
#cornflowerblue
color5 red
color6 yellow
# Lua Load
#lua_load ~/.conky/draw_bg.lua
#lua_draw_hook_pre draw_bg
#lua_load ~/.conky/conky_grey.lua
#lua_draw_hook_pre main
lua_load ~/.conky/tous/tous.lua #chemin du .lua
lua_draw_hook_post main_rings #ordre de lancement si demande de plusieurs lua

TEXT
${color1}${font URW Chancery L:style=Medium Italic:pixelsize=25}Nous sommes le:
${color1}${font URW Chancery L:style=Medium Italic:pixelsize=25}${time %A %d %B}
${color}${color1}${font URW Chancery L:style=Medium Italic:pixelsize=25}depuis:  ${color1}${voffset -8}${font URW Chancery L:style=Medium Italic:pixelsize=34}${time %H:%M:%S}${font}${color}
${voffset 43}${font Sans:size=10}${color3}${goto 35}proc ${color3}${goto 143}temp
${color ff8000} ${goto 20}${freq_g} GHz ${Goto 145}${hwmon 1 temp 1}°C
${voffset 42}${color6}core: ${color1}1: ${cpu cpu1}%${Goto 100}${color6}core: ${color1}1: ${hwmon 1 temp 2}°C 
${goto 41}${color5}2: ${cpu cpu2}%${Goto 136}${color5}2: ${hwmon 1 temp 3}°C
${goto 41}${color3}3: ${cpu cpu3}%${Goto 136}${color3}3: ${hwmon 1 temp 4}°C
${goto 41}${color4}4: ${cpu cpu4}%${Goto 136}${color4}4: ${hwmon 1 temp 5}°C
${voffset 25}${goto 23}${color4} /Racine ${color4}${goto 143} Ram
${color4}${goto 25}${fs_used /}${color4}${Goto 140}$mem 
${color3}${goto 23} /home ${color5}${goto 143} swap
${color3}${goto 27}${fs_free /home}${color5}${goto 135}${swap}
${voffset 30}${color2}${font}Backup $alignc ${fs_free /media/sauvegarde} / ${fs_size /media/sauvegarde} $alignr ${fs_used_perc /media/sauvegarde}%
${fs_bar /media/sauvegarde}
${voffset 10}${goto 35}${font}Vitesse ventilo: ${hwmon 2 fan 1} Tr/m
${voffset 50}${goto 25}${font Sans:size=8}${color4}${downspeedf eth0}k/s ${color5}${goto 140}${upspeedf eth0}k/s
${color3}${goto 23} /Down ${color3}${goto 140} /Up
${color4}${goto 25}${totaldown eth0}${goto 140}${color5}${totalup eth0}

${voffset 30}${color1}${goto 50}PROCESSUS 
${color3}NOM ${goto 125}CPU ${goto 185}RAM 
${color1}${top name 1} ${goto 120}${top cpu 1} ${goto 180}${top mem 1}
${color1}${top name 2} ${goto 120}${top cpu 2} ${goto 180}${top mem 2}
${color1}${top name 3} ${goto 120}${top cpu 3} ${goto 180}${top mem 3}
${color1}${top name 4} ${goto 120}${top cpu 4} ${goto 180}${top mem 4}
${color1}${top name 5} ${goto 120}${top cpu 5} ${goto 180}${top mem 5}

${goto 50}INTERNET
${color3}URL NB PORTS OUVERTS: ${tcp_portmon 1 65535 count}
${color2}${tcp_portmon 1 65535 rip 0}${goto 155}${tcp_portmon 1 65535 rport 0}
${color2}${tcp_portmon 1 65535 rip 1}${goto 155}${tcp_portmon 1 65535 rport 1}
${color2}${tcp_portmon 1 65535 rip 2}${goto 155}${tcp_portmon 1 65535 rport 2}
${color2}${tcp_portmon 1 65535 rip 3}${goto 155}${tcp_portmon 1 65535 rport 3}
${color2}${tcp_portmon 1 65535 rip 4}${goto 155}${tcp_portmon 1 65535 rport 4}
Et le lua:

Code : Tout sélectionner

--[[
Ring Meters by londonali1010 (2009)

This script draws percentage meters as rings. It is fully customisable; all options are described in the script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
lua_load ~/scripts/rings-v1.2.lua
lua_draw_hook_pre ring_stats

Changelog:
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]

require 'cairo'

function conky_main_rings()

if (os.date("%l"))=='12' then
heure=(os.date("%M")/60)
else
heure=(os.date("%l"))+(os.date("%M")/60)
end

-- START PARAMETERS HERE
local rings_settings={

{
name="cpu",
arg="cpu1",
max=100,
xc=50,
yc=160,
radius=50,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0xFFFFFF,0},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,0}},
fg_colour2={{0,0XFFFFFF,0},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,0}},
bd_colour1={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,1}},
},
{
name="cpu",
arg="cpu2",
max=100,
xc=50,
yc=160,
radius=46,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
bd_colour1={{0,0XFF0000,1},{0.5,0xFF0000,1}, {1,0xFF0000,1}},
},
{
name="cpu",
arg="cpu3",
max=100,
xc=50,
yc=160,
radius=42,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0x0090F0,0},{0.5,0x0090F0,1}, {1,0x0090F0,0}},
fg_colour2={{0,0X00FF00,0},{0.5,0x0090F0,1}, {1,0x0090F0,0}},
bd_colour1={{0,0X0090F0,1},{0.5,0x0090F0,1}, {1,0x0090F0,1}},
},
{
name="cpu",
arg="cpu4",
max=100,
xc=50,
yc=160,
radius=38,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0x00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
fg_colour2={{0,0X00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
},
{
name="hwmon 1 temp 2",
arg="hwmon 1 temp 2",
max=100,
xc=160,
yc=160,
radius=50,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0xFFFFFF,0},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,0}},
fg_colour2={{0,0XFFFFFF,0},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,0}},
bd_colour1={{0,0XFFFFFF,1},{0.5,0xFFFFFF,1}, {1,0xFFFFFF,1}},
},
{
name="hwmon 1 temp 3",
arg="hwmon 1 temp 3",
max=100,
xc=160,
yc=160,
radius=46,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
bd_colour1={{0,0XFF0000,1},{0.5,0xFF0000,1}, {1,0xFF0000,1}},
},
{
name="hwmon 1 temp 4",
arg="hwmon 1 temp 4",
max=100,
xc=160,
yc=160,
radius=42,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0x0090F0,0},{0.5,0x0090F0,1}, {1,0x0090F0,0}},
fg_colour2={{0,0X0090F0,0},{0.5,0x0090F0,1}, {1,0x0090F0,0}},
bd_colour1={{0,0X0090F0,1},{0.5,0x0090F0,1}, {1,0x0090F0,1}},
},
{
name="hwmon 1 temp 5",
arg="hwmon 1 temp 5",
max=100,
xc=160,
yc=160,
radius=38,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0x00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
fg_colour2={{0,0X00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
},
{
name="memperc",
arg="",
max=100,
xc=160,
yc=330,
radius=50,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0x00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
fg_colour2={{0,0X00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
},
{
name="swapperc",
arg="",
max=100,
xc=160,
yc=330,
radius=46,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
bd_colour1={{0,0XFF0000,1},{0.5,0xFF0000,1}, {1,0xFF0000,1}},
},
{
name="fs_used_perc ",
arg="/",
max=100,
xc=50,
yc=330,
radius=50,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0x00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
fg_colour2={{0,0X00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
},
{
name="fs_used_perc ",
arg="/home",
max=100,
xc=50,
yc=330,
radius=46,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0x0090F0,0},{0.5,0x0090F0,1}, {1,0x0090F0,0}},
fg_colour2={{0,0X0090F0,0},{0.5,0x0090F0,1}, {1,0x0090F0,0}},
bd_colour1={{0,0X0090F0,1},{0.5,0x0090F0,1}, {1,0x0090F0,1}},
},

{
name="downspeedf",
arg="eth0",
max=2500,
xc=50,
yc=520,
radius=50,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0x00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
fg_colour2={{0,0X00FF00,0},{0.5,0x00FF00,1}, {1,0x00FF00,0}},
bd_colour1={{0,0X00FF00,1},{0.5,0x00FF00,1}, {1,0x00FF00,1}},
},
{
name="upspeedf",
arg="eth0",
max=100,
xc=160,
yc=520,
radius=50,
thickness=5,
gap_sectors=2,
sectors=10,
bg_colour1={{0,0x999999,0},{0.5,0x999999,0.3}, {1,0x999999,0}},
fg_colour1={{0,0xFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
fg_colour2={{0,0XFF0000,0},{0.5,0xFF0000,1}, {1,0xFF0000,0}},
bd_colour1={{0,0XFF0000,1},{0.5,0xFF0000,1}, {1,0xFF0000,1}},
},

}

--END OF PARAMETERS HERE

--main function

--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)
local cr=cairo_create(cs)

if tonumber(conky_parse('${updates}'))>3 then
for i in pairs(rings_settings) do
draw_ring(cr,rings_settings[i])
end
end

cairo_destroy(cr)
end



function draw_ring(cr, t)

local function rgba_to_r_g_b_a(tcolour)
local colour,alpha=tcolour[2],tcolour[3]
return ((colour / 0x10000) % 0x100) / 255.,
((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end


local function calc_delta(tcol1,tcol2)
--calculate deltas P R G B A to table_colour 1

for x = 1, #tcol1 do
tcol1[x].dA = 0
tcol1[x].dP = 0
tcol1[x].dR = 0
tcol1[x].dG = 0
tcol1[x].dB = 0
if tcol2~=nil and #tcol1 == #tcol2 then
local r1,g1,b1,a1 = rgba_to_r_g_b_a(tcol1[x])
local r2,g2,b2,a2 = rgba_to_r_g_b_a(tcol2[x])
tcol1[x].dP = (tcol2[x][1]-tcol1[x][1])/t.sectors
tcol1[x].dR = (r2-r1)/t.sectors
tcol1[x].dG = (g2-g1)/t.sectors
tcol1[x].dB = (b2-b1)/t.sectors
tcol1[x].dA = (a2-a1)/t.sectors

end
end

return tcol1
end

--check values
local function setup(t)
if t.name==nil and t.arg==nil then
print ("No input values ... use parameters 'name'" +
" with 'arg' or only parameter 'arg' ")
return
end

if t.max==nil then
print ("No maximum value defined, use 'max'")
print ("for name=" .. t.name)
print ("with arg=" .. t.arg)
return
end
if t.name==nil then t.name="" end
if t.arg==nil then t.arg="" end

if t.xc==nil then t.xc=conky_window.width/2 end
if t.yc==nil then t.yc=conky_window.height/2 end
if t.thickness ==nil then t.thickness = 10 end
if t.radius ==nil then t.radius =conky_window.width/4 end
if t.start_angle==nil then t.start_angle =0 end
if t.end_angle==nil then t.end_angle=360 end
if t.bg_colour1==nil then
t.bg_colour1={{0,0x00ffff,0.1},{0.5,0x00FFFF,0.5},{1,0x00FFFF,0.1}}
end
if t.fg_colour1==nil then
t.fg_colour1={{0,0x00FF00,0.1},{0.5,0x00FF00,1},{1,0x00FF00,0.1}}
end
if t.bd_colour1==nil then
t.bd_colour1={{0,0xFFFF00,0.5},{0.5,0xFFFF00,1},{1,0xFFFF00,0.5}}
end
if t.sectors==nil then t.sectors=10 end
if t.gap_sectors==nil then t.gap_sectors=1 end
if t.fill_sector==nil then t.fill_sector=false end
if t.sectors==1 then t.fill_sector=false end
if t.border_size==nil then t.border_size=0 end
if t.cap==nil then t.cap="p" end
--some checks
if t.thickness>t.radius then t.thickness=t.radius*0.1 end
t.int_radius = t.radius-t.thickness

--check colors tables
for i=1, #t.bg_colour1 do
if #t.bg_colour1[i]~=3 then t.bg_colour1[i]={1,0xFFFFFF,0.5} end
end
for i=1, #t.fg_colour1 do
if #t.fg_colour1[i]~=3 then t.fg_colour1[i]={1,0xFF0000,1} end
end
for i=1, #t.bd_colour1 do
if #t.bd_colour1[i]~=3 then t.bd_colour1[i]={1,0xFFFF00,1} end
end

if t.bg_colour2~=nil then
for i=1, #t.bg_colour2 do
if #t.bg_colour2[i]~=3 then t.bg_colour2[i]={1,0xFFFFFF,0.5} end
end
end
if t.fg_colour2~=nil then
for i=1, #t.fg_colour2 do
if #t.fg_colour2[i]~=3 then t.fg_colour2[i]={1,0xFF0000,1} end
end
end
if t.bd_colour2~=nil then
for i=1, #t.bd_colour2 do
if #t.bd_colour2[i]~=3 then t.bd_colour2[i]={1,0xFFFF00,1} end
end
end

if t.start_angle>=t.end_angle then
local tmp_angle=t.end_angle
t.end_angle= t.start_angle
t.start_angle = tmp_angle
-- print ("inversed angles")
if t.end_angle-t.start_angle>360 and t.start_angle>0 then
t.end_angle=360+t.start_angle
print ("reduce angles")
end

if t.end_angle+t.start_angle>360 and t.start_angle<=0 then
t.end_angle=360+t.start_angle
print ("reduce angles")
end

if t.int_radius<0 then t.int_radius =0 end
if t.int_radius>t.radius then
local tmp_radius=t.radius
t.radius=t.int_radius
t.int_radius=tmp_radius
print ("inversed radius")
end
if t.int_radius==t.radius then
t.int_radius=0
print ("int radius set to 0")
end
end

t.fg_colour1 = calc_delta(t.fg_colour1,t.fg_colour2)
t.bg_colour1 = calc_delta(t.bg_colour1,t.bg_colour2)
t.bd_colour1 = calc_delta(t.bd_colour1,t.bd_colour2)
end

if t.draw_me == true then t.draw_me = nil end
if t.draw_me ~= nil and conky_parse(tostring(t.draw_me)) ~= "1" then return end
--initialize table
setup(t)

--initialize cairo context
cairo_save(cr)
cairo_translate(cr,t.xc,t.yc)
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND)
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND)

--get value
local value = 0
if t.name ~="" then
value = tonumber(conky_parse(string.format('${%s %s}', t.name, t.arg)))
else
value = tonumber(t.arg)
end
if value==nil then value =0 end

--initialize sectors
--angle of a sector :
local angleA = ((t.end_angle-t.start_angle)/t.sectors)*math.pi/180
--value of a sector :
local valueA = t.max/t.sectors
--first angle of a sector :
local lastAngle = t.start_angle*math.pi/180


local function draw_sector(type_arc,angle0,angle,valpc, idx)

--this function draws a portion of arc
--type of arc, angle0 = strating angle, angle= angle of sector,
--valpc = percentage inside the sector, idx = sctor number #
local tcolor
if type_arc=="bg" then --background
if valpc==1 then return end
tcolor=t.bg_colour1
elseif type_arc=="fg" then --foreground
if valpc==0 then return end
tcolor=t.fg_colour1
elseif type_arc=="bd" then --border
tcolor=t.bd_colour1
end

--angles equivalents to gap_sector
local ext_delta=math.atan(t.gap_sectors/(2*t.radius))
local int_delta=math.atan(t.gap_sectors/(2*t.int_radius))

--angles of arcs
local ext_angle=(angle-ext_delta*2)*valpc
local int_angle=(angle-int_delta*2)*valpc

--define colours to use for this sector
if #tcolor==1 then
--plain color
local vR,vG,vB,vA = rgba_to_r_g_b_a(tcolor[1])
cairo_set_source_rgba(cr,vR+tcolor[1].dR*idx,
vG+tcolor[1].dG*idx,
vB+tcolor[1].dB*idx,
vA+tcolor[1].dA*idx )
else
--radient color
local pat=cairo_pattern_create_radial(0,0,t.int_radius,0,0,t.radius)
for i=1, #tcolor do
local vP,vR,vG,vB,vA = tcolor[i][1], rgba_to_r_g_b_a(tcolor[i])
cairo_pattern_add_color_stop_rgba (pat,
vP+tcolor[i].dP*idx,
vR+tcolor[i].dR*idx,
vG+tcolor[i].dG*idx,
vB+tcolor[i].dB*idx,
vA+tcolor[i].dA*idx )
end
cairo_set_source (cr, pat)
cairo_pattern_destroy(pat)
end

--start drawing
cairo_save(cr)
--x axis is parrallel to start of sector
cairo_rotate(cr,angle0-math.pi/2)

local ri,re = t.int_radius ,t.radius

--point A
local angle_a

if t.cap == "p" then
angle_a = int_delta
if t.inverse_arc and type_arc ~="bg" then
angle_a = angle-int_angle-int_delta
end
if not(t.inverse_arc) and type_arc =="bg" then
angle_a = int_delta+int_angle
end
else --t.cap=="r"
angle_a = ext_delta
if t.inverse_arc and type_arc~="bg" then
angle_a = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_a = ext_delta+ext_angle
end
end
local ax,ay = ri*math.cos(angle_a),ri*math.sin(angle_a)


--point B
local angle_b = ext_delta
if t.cap == "p" then
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
else
if t.inverse_arc and type_arc ~="bg" then
angle_b = angle-ext_angle-ext_delta
end
if not(t.inverse_arc) and type_arc=="bg" then
angle_b = ext_delta+ext_angle
end
end
local bx,by = re*math.cos(angle_b),re*math.sin(angle_b)

-- EXTERNAL ARC B --> C
local b0,b1
if t.inverse_arc then
if type_arc=="bg" then
b0,b1= ext_delta, angle-ext_delta-ext_angle
else
b0,b1= angle-ext_angle-ext_delta, angle-ext_delta
end
else
if type_arc=="bg" then
b0,b1= ext_delta+ext_angle, angle-ext_delta
else
b0,b1= ext_delta, ext_angle+ext_delta
end
end

---POINT D
local angle_c, angle_d
if t.cap == "p" then
angle_d = angle-int_delta
if t.inverse_arc and type_arc=="bg" then
angle_d = angle-int_delta-int_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d=int_delta+int_angle
end
else
angle_d = angle-ext_delta
if t.inverse_arc and type_arc=="bg" then
angle_d =angle-ext_delta-ext_angle
end
if not(t.inverse_arc) and type_arc~="bg" then
angle_d = ext_angle+ext_delta
end
end
local dx,dy = ri*math.cos(angle_d),ri*math.sin(angle_d)

-- INTERNAL ARC D --> A
local d0,d1
if t.cap=="p" then
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-int_delta-int_angle,int_delta
else
d0,d1= angle-int_delta, angle- int_angle-int_delta
end
else
if type_arc=="bg" then
d0,d1= angle-int_delta, int_delta+int_angle
else
d0,d1= int_delta+int_angle, int_delta
end
end
else
if t.inverse_arc then
if type_arc=="bg" then
d0,d1= angle-ext_delta-ext_angle,ext_delta
else
d0,d1= angle-ext_delta, angle- ext_angle-ext_delta
end
else
if type_arc=="bg" then
d0,d1= angle-ext_delta,ext_delta+ext_angle
else
d0,d1= ext_angle+ext_delta, ext_delta
end
end
end

--draw sector
cairo_move_to(cr,ax,ay)
cairo_line_to(cr,bx,by)
cairo_arc(cr,0,0,re,b0,b1)
cairo_line_to(cr,dx,dy)
cairo_arc_negative(cr,0,0,ri,d0,d1)
cairo_close_path (cr);

--stroke or fill sector
if type_arc=="bd" then
cairo_set_line_width(cr,t.border_size)
cairo_stroke(cr)
else
cairo_fill(cr)
end

cairo_restore(cr)

end
--draw sectors
local n0,n1,n2 = 1,t.sectors,1
if t.inverse_arc then n0,n1,n2 = t.sectors,1,-1 end
local index = 0
for i = n0,n1,n2 do
index = index +1
local valueZ=1
local cstA, cstB = (i-1),i
if t.inverse_arc then cstA,cstB = (t.sectors-i), (t.sectors-i+1) end

if value>valueA *cstA and value<valueA*cstB then
if not t.fill_sector then
valueZ = (value-valueA*cstA)/valueA
end
else
if value<valueA*cstB then valueZ=0 end
end

local start_angle= lastAngle+(i-1)*angleA
if t.foreground ~= false then
draw_sector("fg",start_angle,angleA,valueZ, index)
end
if t.background ~= false then
draw_sector("bg",start_angle,angleA,valueZ, i)
end
if t.border_size>0 then draw_sector("bd",start_angle,angleA,1, i) end
end

cairo_restore(cr)
end

--[[END OF RING-SECTORS WIDGET]]
Avec le résultat:
Image
Voili :D ;)

Avatar du membre
david37
modérateur
Messages : 3884
Enregistré le : lun. 22 août 2016 05:06

Re: Recherche quelques exemples de config .conkyrc

Message par david37 »

ça claque zeb :D
ça donne envie de faire pareil juste pour le kiff :D
PC1: Mobo: Gigabyte B550 AORUS Elite 2 / CPU: AMD Ryzen 7 3700X / GPU: MSI Radeon RX 580 Armor / RAM: 32 GB @3600 MHz CL16 / SSD: Samsung 970 EVO 500 GB / LM 20.2 Xfce
PC2: HP Pavilion 15 / AMD Ryzen 5 5500U with Radeon Graphics / 16GB RAM / 500 GB SSD / Debian 11 Xfce
PC3: Dell-Latitude E7240 / 2.1GHz i7-4600U / Intel Haswell-ULT HD 4400 / 8GB RAM / 250 GB Hard Drive / LM 20.2 Xfce

Avatar du membre
daniel_1970
Messages : 152
Enregistré le : mar. 14 juil. 2015 19:06
Localisation : Belgique
Contact :

Re: Recherche quelques exemples de config .conkyrc

Message par daniel_1970 »

Bonjour.

Je crois que tu trouveras ton bonheur dans ce sujet.

Bon amusement !

Daniel
Manjaro Net Xfce (en multi-boot avec Mint 17.3 et Voyager X)
Intel Core2 Duo E8400 @ 3Ghz
Ram 4 Go - Nvidia Geforce GT 630

zeb
Messages : 16473
Enregistré le : ven. 19 juin 2015 22:13
Localisation : plus ici

Re: Recherche quelques exemples de config .conkyrc

Message par zeb »

;)
Merci david ;) :D

Oui, daniel a raison, il y a aussi pas mal d'info ici sur le forum dans la rubrique perso... fais une tite recherche (en haut à droite ;) )

Avatar du membre
AngeDesOmbres
Messages : 666
Enregistré le : ven. 12 août 2016 21:30
Localisation : Entre l'ombre et la lumière

Re: Recherche quelques exemples de config .conkyrc

Message par AngeDesOmbres »

se qui claque bien Zeb c'est le hot road que tu as en fond :D
Image
Pingouin dans les champs, hiver très méchant !!!
Qui pisse loin ménage ses chaussures !!! :D

zeb
Messages : 16473
Enregistré le : ven. 19 juin 2015 22:13
Localisation : plus ici

Re: Recherche quelques exemples de config .conkyrc

Message par zeb »

Juste pour toi ange 8-)
Image

Avatar du membre
david37
modérateur
Messages : 3884
Enregistré le : lun. 22 août 2016 05:06

Re: Recherche quelques exemples de config .conkyrc

Message par david37 »

Salut Casp3r,

Ayé, j'ai fait mon premier conky :D
Je suis parti de ce tutoriel https://www.youtube.com/watch?v=ifhHNyzt8_I" onclick="window.open(this.href);return false;
que je n'ai pas changé. Plutôt pas mal :D

Voilà ce que ça donne chez moi

Image

EDIT:

Voilà le code que j'ai utilisé (enfin que j'ai bêtement copié collé):

Code : Tout sélectionner

# Conky settings #
background no
update_interval 1

cpu_avg_samples 2
net_avg_samples 2

override_utf8_locale yes

double_buffer yes
no_buffers yes

text_buffer_size 2048
#imlib_cache_size 0

temperature_unit fahrenheit

# Window specifications #

own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

minimum_size 200 250
maximum_width 200

alignment tr
gap_x 35
gap_y 55

# Graphics settings #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no

# Text settings #
use_xft yes
xftfont caviar dreams:size=8
xftalpha 0.5

uppercase no

temperature_unit celsius


default_color FFFFFF

# Lua Load  #
lua_load ~/.conky/clock_rings.lua
lua_draw_hook_pre clock_rings

TEXT
${voffset 8}${color 339900}${font caviar dreams:size=16}${time %A}${font}${voffset -8}${alignr 50}${color FFFFFF}${font caviar dreams:size=38}${time %e}${font}
${color FFFFFF}${voffset -30}${color FFFFFF}${font caviar dreams:size=18}${time %b}${font}${voffset -3} ${color FFFFFF}${font caviar dreams:size=20}${time %Y}${font}${color 339900}${hr}

${voffset 140}${font caviar dreams:size=10}${alignr}HOME${font}
${font caviar dreams:size=12}${color FFFFFF}${alignr}${weather http://weather.noaa.gov/pub/data/observations/metar/stations/ LQBK temperature temperature 30} °C${font}
${image ~/.conky/linux-mint1-300x300a.png -p 4,53 -s 192x192}
${color FFFFFF}${goto 25}${voffset 35}${cpu cpu0}%
${color 339900}${goto 25}CPU
${color FFFFFF}${goto 50}${voffset 23}${memperc}%
${color 339900}${goto 50}RAM
${color FFFFFF}${goto 75}${voffset 23}${swapperc}%
${color 339900}${goto 75}Swap
${color FFFFFF}${goto 100}${voffset 23}${fs_used_perc /}%
${color 339900}${goto 100}Disk
${color FFFFFF}${goto 125}${voffset 25}${downspeed eth0}
${color FFFFFF}${goto 125}${upspeed eth0}
${color 339900}${goto 125}Net



${color FFFFFF}${font caviar dreams:size=8}Uptime: ${uptime_short}
${color FFFFFF}${font caviar dreams:size=8}Processes: ${processes}
${color FFFFFF}${font caviar dreams:size=8}Running: ${running_processes}


${color 339900}${font caviar dreams:size=8}${alignr}${nodename}
${color 339900}${font caviar dreams:size=8}${alignr}${pre_exec cat /etc/issue.net}  $machine
${color 339900}${font caviar dreams:size=8}${alignr}Kernel: ${kernel}
Et voici le lua:

Code : Tout sélectionner

--[[
Clock Rings by Linux Mint (2011) reEdited by despot77

This script draws percentage meters as rings, and also draws clock hands if you want! It is fully customisable; all options are described in the script. This script is based off a combination of my clock.lua script and my rings.lua script.

IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this doesn't happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num>5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num>3; conversely if you update Conky every 0.5s, you should use update_num>10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.

To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
    lua_load ~/scripts/clock_rings.lua
    lua_draw_hook_pre clock_rings
    
Changelog:
+ v1.0 -- Original release (30.09.2009)
   v1.1p -- Jpope edit londonali1010 (05.10.2009)
*v Mint-lua -- reEdit despot77 (18.02.2011)
]]

settings_table = {
    {
        -- Edit this table to customise your rings.
        -- You can create more rings simply by adding more elements to settings_table.
        -- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
        name='time',
        -- "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 ''.
        arg='%I.%M',
        -- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
        max=12,
        -- "bg_colour" is the colour of the base ring.
        bg_colour=0xffffff,
        -- "bg_alpha" is the alpha value of the base ring.
        bg_alpha=0.1,
        -- "fg_colour" is the colour of the indicator part of the ring.
        fg_colour=0x339900,
        -- "fg_alpha" is the alpha value of the indicator part of the ring.
        fg_alpha=0.2,
        -- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
        x=100, y=150,
        -- "radius" is the radius of the ring.
        radius=50,
        -- "thickness" is the thickness of the ring, centred around the radius.
        thickness=5,
        -- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
        start_angle=0,
        -- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger than start_angle.
        end_angle=360
    },
    {
        name='time',
        arg='%M.%S',
        max=60,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0x339900,
        fg_alpha=0.4,
        x=100, y=150,
        radius=56,
        thickness=5,
        start_angle=0,
        end_angle=360
    },
    {
        name='time',
        arg='%S',
        max=60,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0x339900,
        fg_alpha=0.6,
        x=100, y=150,
        radius=62,
        thickness=5,
        start_angle=0,
        end_angle=360
    },
    {
        name='time',
        arg='%d',
        max=31,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0x339900,
        fg_alpha=0.8,
        x=100, y=150,
        radius=70,
        thickness=5,
        start_angle=-90,
        end_angle=90
    },
    {
        name='time',
        arg='%m',
        max=12,
        bg_colour=0xffffff,
        bg_alpha=0.1,
        fg_colour=0x339900,
        fg_alpha=1,
        x=100, y=150,
        radius=76,
        thickness=5,
        start_angle=-90,
        end_angle=90
    },
    {
        name='cpu',
        arg='cpu0',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x339900,
        fg_alpha=0.8,
        x=50, y=300,
        radius=25,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='memperc',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x339900,
        fg_alpha=0.8,
        x=75, y=350,
        radius=25,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='swapperc',
        arg='',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x339900,
        fg_alpha=0.8,
        x=100, y=400,
        radius=25,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
    {
        name='fs_used_perc',
        arg='/',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x339900,
        fg_alpha=0.8,
        x=125, y=450,
        radius=25,
        thickness=5,
        start_angle=-90,
        end_angle=180
    },
        {
        name='downspeedf',
        arg='eth0',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0x339900,
        fg_alpha=0.8,
        x=150, y=500,
        radius=25,
        thickness=4,
        start_angle=-90,
        end_angle=180
    },
        {
        name='upspeedf',
        arg='eth0',
        max=100,
        bg_colour=0xffffff,
        bg_alpha=0.2,
        fg_colour=0xff3300,
        fg_alpha=0.8,
        x=150, y=500,
        radius=20,
        thickness=4,
        start_angle=-90,
        end_angle=180
    },
}

-- Use these settings to define the origin and extent of your clock.

clock_r=65

-- "clock_x" and "clock_y" are the coordinates of the centre of the clock, in pixels, from the top left of the Conky window.

clock_x=100
clock_y=150

show_seconds=true

require 'cairo'

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

function draw_ring(cr,t,pt)
    local w,h=conky_window.width,conky_window.height
    
    local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
    local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']

    local angle_0=sa*(2*math.pi/360)-math.pi/2
    local angle_f=ea*(2*math.pi/360)-math.pi/2
    local t_arc=t*(angle_f-angle_0)

    -- Draw background ring

    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
    cairo_set_line_width(cr,ring_w)
    cairo_stroke(cr)
    
    -- Draw indicator ring

    cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
    cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
    cairo_stroke(cr)        
end

function draw_clock_hands(cr,xc,yc)
    local secs,mins,hours,secs_arc,mins_arc,hours_arc
    local xh,yh,xm,ym,xs,ys
    
    secs=os.date("%S")    
    mins=os.date("%M")
    hours=os.date("%I")
        
    secs_arc=(2*math.pi/60)*secs
    mins_arc=(2*math.pi/60)*mins+secs_arc/60
    hours_arc=(2*math.pi/12)*hours+mins_arc/12
        
    -- Draw hour hand
    
    xh=xc+0.7*clock_r*math.sin(hours_arc)
    yh=yc-0.7*clock_r*math.cos(hours_arc)
    cairo_move_to(cr,xc,yc)
    cairo_line_to(cr,xh,yh)
    
    cairo_set_line_cap(cr,CAIRO_LINE_CAP_ROUND)
    cairo_set_line_width(cr,5)
    cairo_set_source_rgba(cr,1.0,1.0,1.0,1.0)
    cairo_stroke(cr)
    
    -- Draw minute hand
    
    xm=xc+clock_r*math.sin(mins_arc)
    ym=yc-clock_r*math.cos(mins_arc)
    cairo_move_to(cr,xc,yc)
    cairo_line_to(cr,xm,ym)
    
    cairo_set_line_width(cr,3)
    cairo_stroke(cr)
    
    -- Draw seconds hand
    
    if show_seconds then
        xs=xc+clock_r*math.sin(secs_arc)
        ys=yc-clock_r*math.cos(secs_arc)
        cairo_move_to(cr,xc,yc)
        cairo_line_to(cr,xs,ys)
    
        cairo_set_line_width(cr,1)
        cairo_stroke(cr)
    end
end

function conky_clock_rings()
    local function setup_rings(cr,pt)
        local str=''
        local value=0
        
        str=string.format('${%s %s}',pt['name'],pt['arg'])
        str=conky_parse(str)
        
        value=tonumber(str)
        pct=value/pt['max']
        
        draw_ring(cr,pct,pt)
    end
    
    -- Check that Conky has been running for at least 5s

    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)
    
    local cr=cairo_create(cs)    
    
    local updates=conky_parse('${updates}')
    update_num=tonumber(updates)
    
    if update_num>5 then
        for i in pairs(settings_table) do
            setup_rings(cr,settings_table[i])
        end
    end
    
    draw_clock_hands(cr,clock_x,clock_y)
end
Et enfin la vignette:
Image

Pour installer, le tout, il faut que tu copies le premier texte dans un document que tu nommes ".conkyrc". Tu l'enregistres dans ton home.

Dans le home, tu crée un dossier que tu appelles .conky, dedans tu y mets :
- Le lua, tu l'enregistres sous le nom "clock_rings.lua" et tu le mets dans un dossier .conky

- l'image, tu l'enregistres sous le nom linux-mint1-300x300a.png (j'espère que hostingpics aura gardé les dimensions) et tu la mets dans ton dossier .conky

Normalement quand tu taperas dans le terminal "conky", ça devrait marcher tout seul :D
Enfin moi ça l'a fait :D
Modifié en dernier par david37 le jeu. 17 nov. 2016 22:25, modifié 1 fois.
PC1: Mobo: Gigabyte B550 AORUS Elite 2 / CPU: AMD Ryzen 7 3700X / GPU: MSI Radeon RX 580 Armor / RAM: 32 GB @3600 MHz CL16 / SSD: Samsung 970 EVO 500 GB / LM 20.2 Xfce
PC2: HP Pavilion 15 / AMD Ryzen 5 5500U with Radeon Graphics / 16GB RAM / 500 GB SSD / Debian 11 Xfce
PC3: Dell-Latitude E7240 / 2.1GHz i7-4600U / Intel Haswell-ULT HD 4400 / 8GB RAM / 250 GB Hard Drive / LM 20.2 Xfce

Avatar du membre
AngeDesOmbres
Messages : 666
Enregistré le : ven. 12 août 2016 21:30
Localisation : Entre l'ombre et la lumière

Re: Recherche quelques exemples de config .conkyrc

Message par AngeDesOmbres »

plutot pas mal david :)
Zéb tu l'as en vrai se petit joujou ? :lol:
Modifié en dernier par AngeDesOmbres le jeu. 17 nov. 2016 17:28, modifié 1 fois.
Image
Pingouin dans les champs, hiver très méchant !!!
Qui pisse loin ménage ses chaussures !!! :D

Répondre