Aqui está o meu conkyrc
:
conky.config = {
use_xft = true, -- use xft?
font = 'DejaVuSans:size=9', -- font name
xftalpha = 1,
uppercase = false, -- all text in uppercase?
pad_percents = 0,
text_buffer_size = 2048,
override_utf8_locale = true, -- Force UTF8? note that UTF8 support required XFT
use_spacer = 'none', -- Add spaces to keep things from moving about? This only affects certain objects.
update_interval = 1, -- Update interval in seconds
double_buffer = true, -- Use double buffering (reduces flicker, may not work for everyone)
total_run_times = 0, -- This is the number of times Conky will update before quitting. Set to zero to run forever.
-- Create own window instead of using desktop (required in nautilus)
own_window = true,
own_window_class = 'Conky',
own_window_transparent = true,
own_window_argb_visual = true,
own_window_argb_value = 255,
own_window_type = 'desktop', -- transparency seems to work without this line
own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager',
-- Minimum size of text area
minimum_height = 50,
minimum_width = 210,
draw_shades = false, -- draw shades?
draw_outline = false, -- draw outlines?
draw_borders = false, -- draw borders around text?
draw_graph_borders = false, -- draw borders around graphs
stippled_borders = 0, -- stripled borders?
imlib_cache_size = 0, -- Imlib2 image cache size, in bytes. Increase this value if you use $image lots. Set to 0 to disable the image cache.
-- Gap between borders of screen and text. Same thing as passing -x at command line
gap_x = 90,
gap_y = 5,
alignment = 'middle_right', -- alignment on {y_axis}_{x_axis}
cpu_avg_samples = 2, -- number of cpu samples to average. set to 1 to disable averaging
net_avg_samples = 2, -- number of net samples to average. set to 1 to disable averaging
no_buffers = true, -- Subtract file system buffers from used memory?
default_color = 'e0e0e0',
default_shade_color = '000000',
default_outline_color = '000000',
temperature_unit = 'celsius',
color1 = 'ff55ff', -- heading's color
color2 = 'ffffff', -- normal text's color
lua_load = '.conky/netdevs.lua',
};
conky.text = [[
...
${color1}NET: ${hr 2}${color2}${lua_parse conky_show_netdevs}
...
]]
Aqui está .config/netdevs.lua
:
-- conky_show_netdevs : template for network
-- usage : ${lua_parse conky_show_netdevs}
prev_result = ""
function conky_show_netdevs()
updates = tonumber(conky_parse("${updates}"))
interval = 10
timer = (updates % interval)
if timer == 0 or prev_result == "" then
local netdevs_handle = io.popen("ip -j link show up | jq -r '.[] | select(.operstate == \"UP\" and .ifname != \"lo\") | .ifname'")
local result = ""
for netdev in netdevs_handle:lines() do
result = result .. "\nIP (${color1}" .. netdev .. "${color2}): ${alignr}${addr " .. netdev .. "}\n" ..
"${color2}Up: ${color2}${upspeed " .. netdev .. "}/s${color1}${alignr}${upspeedgraph " .. netdev .. " 10,170}\n" ..
"${color2}Down: ${color2}${downspeed " .. netdev .. "}/s${color1}${alignr}${downspeedgraph " .. netdev .. " 10,170}\n" ..
"${color2}Total Down: ${color2}${totaldown " .. netdev .. "}${alignr}Total Up: ${totalup " .. netdev .. "}\n"
end
netdevs_handle:close()
if result ~= "" then
prev_result = result
else
prev_result = "\n"
end
end
return prev_result
end
Tudo funciona, exceto s upspeedgraph
e downspeedgraph
s, retornados na conky_show_netdevs()
saída da função.
Aqui está uma imagem dos gráficos que posso ver (as pequenas linhas na última seção da imagem; nas linhas onde estão presentes os textos "UP" e "DOWN"):
Pelo que pude imaginar, pensei que esse problema fosse causado porque o conteúdo da função lua era analisado toda vez que o conky era recarregado, o que poderia fazer com que o gráfico fosse recarregado. Então, tentei aumentar o intervalo de atualização do conky para 10 segundos. Mas ainda assim, sem sorte :( 👎.
Diga-me por que isso está acontecendo e como resolver esse problema?
Obrigado 😊!