feat: umbral de alerta (rojo) en los gráficos de Sistema
Cada serie admite un umbral 'warn'. Cuando el valor actual lo supera, la línea y el área se pintan en rojo; además se dibuja una línea de referencia tenue al nivel del umbral. Umbrales: CPU/RAM 85%, GPU 90%, VRAM 92%, temperaturas 80°C.
This commit is contained in:
+22
-13
@@ -2,7 +2,7 @@
|
||||
conky_widget — render Cairo + pestañas clickeables.
|
||||
|
||||
Estructura:
|
||||
- Estado: current_tab (1=Red, 2=Sistema, 3=Docker).
|
||||
- Estado: current_tab (1=Sistema, 2=Red, 3=Docker; Sistema por defecto).
|
||||
- conky_draw (lua_draw_hook_post): mantiene los historicos y dibuja la barra
|
||||
de pestañas y el panel activo.
|
||||
- conky_mouse (lua_mouse_hook): cambia de pestaña y lanza apps al clicar botones.
|
||||
@@ -10,10 +10,10 @@ Estructura:
|
||||
Los datos del sistema se obtienen llamando a conky_parse("${...}") desde Lua,
|
||||
de modo que se pueden colocar con libertad mediante Cairo.
|
||||
|
||||
La pestaña Sistema reproduce el panel del widget previo: nueve graficas de
|
||||
linea (CPU, RAM, CPU temp, GPU, GPU temp, VRAM, red, disk I/O) mas las barras
|
||||
de uso de los cuatro discos. Los valores de temperatura/GPU se obtienen de
|
||||
metric.sh (nvidia-smi + coretemp hwmon).
|
||||
La pestaña Sistema reproduce el panel del widget previo: graficas de area
|
||||
(CPU, RAM, CPU temp, GPU, GPU temp, VRAM, disk I/O) que se vuelven rojas al
|
||||
superar su umbral, mas las barras de uso de los cuatro discos. Los valores de
|
||||
temperatura/GPU se obtienen de metric.sh (nvidia-smi + coretemp hwmon).
|
||||
|
||||
Geometria fija (la ventana mide W x H segun conky.conf).
|
||||
]]
|
||||
@@ -236,14 +236,23 @@ local function graph(cr, x, y, w, h, series)
|
||||
local n = #s.data
|
||||
local function px(i) return x + (i - 1) / (n - 1) * w end
|
||||
local function py(i) return y + h - (s.data[i] / maxv) * (h - 4) - 2 end
|
||||
-- Color de alerta cuando el valor actual supera el umbral
|
||||
local col = s.c
|
||||
if s.warn and s.data[n] >= s.warn then col = COL.red end
|
||||
if s.fill then
|
||||
cairo_move_to(cr, px(1), y + h)
|
||||
for i = 1, n do cairo_line_to(cr, px(i), py(i)) end
|
||||
cairo_line_to(cr, px(n), y + h)
|
||||
cairo_close_path(cr)
|
||||
setcol(cr, s.c, 0.25); cairo_fill(cr)
|
||||
setcol(cr, col, 0.25); cairo_fill(cr)
|
||||
end
|
||||
cairo_set_line_width(cr, 1.3); setcol(cr, s.c)
|
||||
-- Linea de referencia del umbral (tenue)
|
||||
if s.warn and s.warn <= maxv then
|
||||
local wy = y + h - (s.warn / maxv) * (h - 4) - 2
|
||||
cairo_set_line_width(cr, 0.7); setcol(cr, COL.red, 0.35)
|
||||
cairo_move_to(cr, x, wy); cairo_line_to(cr, x + w, wy); cairo_stroke(cr)
|
||||
end
|
||||
cairo_set_line_width(cr, 1.3); setcol(cr, col)
|
||||
for i = 1, n do
|
||||
if i == 1 then cairo_move_to(cr, px(i), py(i)) else cairo_line_to(cr, px(i), py(i)) end
|
||||
end
|
||||
@@ -349,30 +358,30 @@ local function draw_sys(cr)
|
||||
-- CPU
|
||||
local gh = row("CPU " .. math.floor(num("${cpu cpu0}")) .. "%",
|
||||
str("${freq_g}") .. "GHz " .. cputemp .. "°C", COL.teal, 26)
|
||||
graph(cr, x, y, gw, gh, { { data = hist.cpu, c = COL.green, max = 100, fill = true } }); y = y + gh + 4
|
||||
graph(cr, x, y, gw, gh, { { data = hist.cpu, c = COL.green, max = 100, fill = true, warn = 85 } }); y = y + gh + 4
|
||||
|
||||
-- RAM
|
||||
gh = row("RAM " .. math.floor(num("${memperc}")) .. "%",
|
||||
str("${mem}") .. " / " .. str("${memmax}"), COL.green, 26)
|
||||
graph(cr, x, y, gw, gh, { { data = hist.ram, c = COL.green, max = 100, fill = true } }); y = y + gh + 4
|
||||
graph(cr, x, y, gw, gh, { { data = hist.ram, c = COL.green, max = 100, fill = true, warn = 85 } }); y = y + gh + 4
|
||||
|
||||
-- CPU TEMP
|
||||
gh = row("CPU TEMP " .. cputemp .. "°C", "", COL.yellow, 20)
|
||||
graph(cr, x, y, gw, gh, { { data = hist.cputemp, c = COL.yellow, max = 100, fill = true } }); y = y + gh + 4
|
||||
graph(cr, x, y, gw, gh, { { data = hist.cputemp, c = COL.yellow, max = 100, fill = true, warn = 80 } }); y = y + gh + 4
|
||||
|
||||
-- GPU
|
||||
gh = row("GPU " .. str("${execi 2 " .. MET .. " gpu_util}") .. "%",
|
||||
gputemp .. "°C", COL.cyan, 26)
|
||||
graph(cr, x, y, gw, gh, { { data = hist.gputil, c = COL.cyan, max = 100, fill = true } }); y = y + gh + 4
|
||||
graph(cr, x, y, gw, gh, { { data = hist.gputil, c = COL.cyan, max = 100, fill = true, warn = 90 } }); y = y + gh + 4
|
||||
|
||||
-- GPU TEMP
|
||||
gh = row("GPU TEMP " .. gputemp .. "°C", "", COL.yellow, 20)
|
||||
graph(cr, x, y, gw, gh, { { data = hist.gputemp, c = COL.yellow, max = 100, fill = true } }); y = y + gh + 4
|
||||
graph(cr, x, y, gw, gh, { { data = hist.gputemp, c = COL.yellow, max = 100, fill = true, warn = 80 } }); y = y + gh + 4
|
||||
|
||||
-- VRAM
|
||||
gh = row("VRAM " .. str("${execi 2 " .. MET .. " gpu_memp}") .. "%",
|
||||
str("${execi 2 " .. MET .. " gpu_memi}"), COL.purple, 26)
|
||||
graph(cr, x, y, gw, gh, { { data = hist.vram, c = COL.purple, max = 100, fill = true } }); y = y + gh + 4
|
||||
graph(cr, x, y, gw, gh, { { data = hist.vram, c = COL.purple, max = 100, fill = true, warn = 92 } }); y = y + gh + 4
|
||||
|
||||
-- DISK I/O
|
||||
gh = row("DISK I/O", str("${diskio}"), COL.orange, 26)
|
||||
|
||||
Reference in New Issue
Block a user