63 lines
1.9 KiB
Lua
63 lines
1.9 KiB
Lua
local wibox = require("wibox")
|
|
|
|
local lain = require("lain")
|
|
local markup = lain.util.markup
|
|
|
|
local theme = require("theme")
|
|
|
|
local gfs = require("gears.filesystem")
|
|
local iconsdir = gfs.get_configuration_dir() .. "icons/"
|
|
|
|
local network_interfaces = {"enp0s25", "wlp3s0"}
|
|
|
|
local widgets = {}
|
|
|
|
widgets.netdown_icon = wibox.widget.imagebox(iconsdir .. "down.png")
|
|
widgets.netdown = lain.widget.net({
|
|
units = 1024^2,
|
|
iface = network_interfaces,
|
|
settings = function()
|
|
widget:set_markup(markup.fontfg(theme.font, theme.colors.green, net_now.received .. "MiB/s "))
|
|
end
|
|
})
|
|
|
|
widgets.netup_icon = wibox.widget.imagebox(iconsdir .. "up.png")
|
|
widgets.netup = lain.widget.net({
|
|
units = 1024^2,
|
|
iface = network_interfaces,
|
|
settings = function()
|
|
widget:set_markup(markup.fontfg(theme.font, theme.colors.red, net_now.sent .. "MiB/s "))
|
|
end
|
|
})
|
|
|
|
widgets.mem_icon = wibox.widget.imagebox(iconsdir .. "mem.png")
|
|
widgets.mem = lain.widget.mem({
|
|
settings = function()
|
|
widget:set_markup(markup.fontfg(theme.font, theme.colors.yellow, mem_now.perc .. "% "))
|
|
end
|
|
})
|
|
|
|
widgets.cpu_icon = wibox.widget.imagebox(iconsdir .. "cpu.png")
|
|
widgets.cpu = lain.widget.cpu({
|
|
settings = function()
|
|
widget:set_markup(markup.fontfg(theme.font, theme.colors.cyan, string.format("%02d", cpu_now.usage) .. "% "))
|
|
end
|
|
})
|
|
|
|
widgets.temp_icon = wibox.widget.imagebox(iconsdir .. "temp.png")
|
|
widgets.temp = lain.widget.temp({
|
|
settings = function()
|
|
widget:set_markup(markup.fontfg(theme.font, theme.colors.magenta, math.floor(coretemp_now) .. "°C "))
|
|
end
|
|
})
|
|
|
|
widgets.bat_icon = wibox.widget.imagebox(iconsdir .. "bat.png")
|
|
widgets.bat = lain.widget.bat({
|
|
settings = function()
|
|
state = bat_now.ac_status == 0 and "D" or "C"
|
|
widget:set_markup(markup.fontfg(theme.font, theme.fg_normal, state .. bat_now.perc))
|
|
end
|
|
})
|
|
|
|
return widgets
|