This commit is contained in:
2026-03-01 01:39:46 +03:00
parent 36743352c5
commit 14fb600eea
137 changed files with 11521 additions and 0 deletions

33
.config/conky/nets.lua Normal file
View File

@@ -0,0 +1,33 @@
function conky_get_network_info()
-- получаем список интерфейсов с IPv4-адресами
local f = io.popen("ip -o -4 addr show | awk '{print $2,$4}'")
local output = f:read("*all")
f:close()
local result = ""
for line in output:gmatch("[^\r\n]+") do
local iface, addr = line:match("([^%s]+)%s+([^%s]+)")
if iface then
-- получаем MAC-адрес
local f_mac = io.popen("cat /sys/class/net/" .. iface .. "/address 2>/dev/null")
local mac = f_mac:read("*l") or "N/A"
f_mac:close()
local down = conky_parse("${downspeed " .. iface .. "}")
local up = conky_parse("${upspeed " .. iface .. "}")
result = result ..
string.format("${color white}%s${color} ", iface) ..
string.format("${color red}IP: %s\n", addr) ..
string.format("${color red}MAC: %s\n", mac) ..
string.format("${color red} ↓%s ↑ %s\n\n", down, up)
end
end
if result == "" then
result = "EMPTY"
end
return result
end