Résolu le 15-11-18 Conky pour noob

Bureaux,conky et autres personnalisations esthétiques.
Avatar du membre
heros21
Messages : 172
Enregistré le : sam. 16 juil. 2016 00:04

Conky pour noob

Message par heros21 »

Bonjour,
je souhaiterais créer un conky avec comme information présente : utilisation du cpu( des cores ), température, utilisation du gpu, température, utilisation de la ram, débits montant et descendant du réseau.La forme souhaité serait des compteurs pour l'utilisation cpu,gpu et ram et graphiques pour réseau.
Sa va pas être facile j'ai essayer de le faire en modifiant celui de zebulon mais pas moyen pourtant j'ai télécharger conkyall.
Merci de votre aide mais ne me mâché pas le boulot je veux juste savoir se que je fais pour pouvoir le modifié un jour. ;)
Modifié en dernier par heros21 le lun. 25 sept. 2017 23:08, modifié 1 fois.
Pc fixe ( desktop ), Intel© Pentium© CPU G4400 , GeForce GT 710, 8 GO RAM, Linux Mint 20.3 Cinnamon

Avatar du membre
débitant
modérateur
Messages : 11536
Enregistré le : mar. 14 juil. 2015 18:22
Localisation : Lorraine France

Re: Conky pour noob

Message par débitant »

as tu regardé dans les sujets déjà traités sur le forum
autrement, le mieux est de chercher sur le net, et puis y prendre les scripts qui peuvent t'interesser
je ne sais pas si ceci pourra t'aider, au niveau es scripts LUA pratiquement en fin de page ;)

ÉDIT
et as-tu été voir ici
Image

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

Re: Conky pour noob

Message par zeb »

heros21 a écrit :j'ai essayer de le faire en modifiant celui de zebulon mais pas moyen
8-) c'est à cause du copyright :lol: non j'déconne ;)

Je me suis inspiré de ca et aussi de ca, le code que j'ai mis en ligne je ne sais plus quand ni dans quelle rubrique :oops: ne comporté pas de partie "lua", c’était un conky ultra basique.
Là ou ça été compliqué (du moins pour moi), ça a été de trouver les bons fichiers pour renseigner conky (pour la température, et la vitesse du ventilo).

Voili ;)

Avatar du membre
heros21
Messages : 172
Enregistré le : sam. 16 juil. 2016 00:04

Re: Conky pour noob

Message par heros21 »

Je déterre mon propre sujet car j'ai avancé sur mon conky (volé a zeb) mais j'ai une erreur quand je le lance.

Code : Tout sélectionner

neo@neo ~ $ conky
Conky: forked to background, pid is 12845
neo@neo ~ $ 
Conky: desktop window (1a00022) is subwindow of root window (2ca)
Conky: window type - override
Conky: drawing to created window (0x6600001)
Conky: drawing to double buffer
Conky: llua_do_call: function conky_main_rings execution failed: /home/neo/.conky/.lua:198: attempt to index global 'conky_window' (a nil value)
J'ai déjà réglé d'autre soucis mais je ne comprend pas trop se qu'il veut que je change.
conky

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/.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}
${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

${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 10}${goto 35}${font}Vitesse ventilo Radeon: ${hwmon 0 temp 1} Tr/m
${voffset 50}${goto 25}${font Sans:size=8}${color4}${downspeedf wlan1}k/s ${color5}${goto 140}${upspeedf wlan1}k/s
${color3}${goto 23} /Down ${color3}${goto 140} /Up
${color4}${goto 25}${totaldown wlan1}${goto 140}${color5}${totalup wlan1}

${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}


${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}
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="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="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="wlan1",
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="wlan1",
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]]
Pc fixe ( desktop ), Intel© Pentium© CPU G4400 , GeForce GT 710, 8 GO RAM, Linux Mint 20.3 Cinnamon

Avatar du membre
heros21
Messages : 172
Enregistré le : sam. 16 juil. 2016 00:04

Re: Conky pour noob

Message par heros21 »

Un petit up pour que je puisse avancer sur ce conky!!! ;)
Pc fixe ( desktop ), Intel© Pentium© CPU G4400 , GeForce GT 710, 8 GO RAM, Linux Mint 20.3 Cinnamon

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

Re: Conky pour noob

Message par zeb »

Salut heros21 ;)
Je suis désolé, même si j'ai le même, je ne pourrai t'aider :?
Mais je pense que ton souci vient de la partie avant "TEXT" sauvegarde et bidouille un peu toutes les lignes (si bien sur tu ne l'as pas déjà fait) ;)

Courage, un docteur en conky va sûrement te répondre ;)

Avatar du membre
loutch
Messages : 517
Enregistré le : lun. 13 juil. 2015 17:32
Localisation : Sarreguemines

Re: Conky pour noob

Message par loutch »

Hello


PS pour la vitesse du ventilo c'est (si tu as une sonde qui gere cette vitesse)

Code : Tout sélectionner

${acpifan}
@+
Modifié en dernier par loutch le mar. 26 sept. 2017 07:54, modifié 1 fois.
HP Pavilion g 7 1357 sf avec ssd Tessa cinnamon Mageia 7rc mate
Asus ROG avec xubuntu 18.04 et xubuntu 19.04

Image

Avatar du membre
heros21
Messages : 172
Enregistré le : sam. 16 juil. 2016 00:04

Re: Conky pour noob

Message par heros21 »

Bon j'ai trouvé l'erreur merci zeb en faite c'était la ligne own_window_type override qui n'était pas bonne, j'ai donc remplacé override par desktop et la miracle ça c'est affiché comme par magie.Maintenant j'ai plus qu'à faire quelques petit changement mais sa fonctionne. :D
Image
Modifié en dernier par heros21 le lun. 25 sept. 2017 23:07, modifié 1 fois.
Pc fixe ( desktop ), Intel© Pentium© CPU G4400 , GeForce GT 710, 8 GO RAM, Linux Mint 20.3 Cinnamon

Avatar du membre
débitant
modérateur
Messages : 11536
Enregistré le : mar. 14 juil. 2015 18:22
Localisation : Lorraine France

Re: Conky pour noob

Message par débitant »

super ;)

Si le sujet est résolu, merci d'éditer le premier message du sujet et mettre un petit Image, comme suit: Image
et un [résolu] (entre crochets et à gauche) dans le titre de ce premier message voir tuto ici

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

Re: [RESOLU]Conky pour noob

Message par zeb »

heros21 a écrit :Maintenant j'ai plus qu'à faire quelques petit changement mais sa fonctionne.
Tu vas connaître les joies du "voffset" et du "goto" :l
Si tu le fait a ma manière (un peu débutant) respire et prends patience :lol: ;) des fois ca fait un peu :evil:

Mais le résultat en vaut la peine ;)

Répondre