dotfiles/.config/awesome/ui/top-panel/widgets/mem.lua

42 lines
814 B
Lua
Raw Normal View History

2024-02-19 19:41:33 -08:00
local wibox = require("wibox")
local beautiful = require("beautiful")
local helpers = require("helpers.ui")
local config = require("config")
local theme = beautiful.get()
local dpi = beautiful.xresources.apply_dpi
2024-02-19 19:41:33 -08:00
-- Icon
local icon = helpers.create_icon(config.icons.mem, theme.color.green)
-- Uptime
local mem = wibox.widget.textbox()
mem.font = helpers.set_font("10")
2024-02-19 19:41:33 -08:00
mem.align = "center"
local function get_val()
awesome.connect_signal("signal::mem", function(mem_perc)
2024-02-19 19:41:33 -08:00
mem.markup = tonumber(mem_perc) .. "%"
end)
end
get_val()
2024-02-19 19:41:33 -08:00
local full = wibox.widget({
{
{
2024-02-19 19:41:33 -08:00
icon,
mem,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = dpi(1),
2024-02-19 19:41:33 -08:00
right = 0,
layout = wibox.container.margin,
},
forced_width = dpi(73),
layout = wibox.layout.fixed.horizontal,
2024-02-19 19:41:33 -08:00
})
return full