dotfiles/.config/awesome/ui/top-panel/widgets/disk.lua
2024-02-22 20:33:20 -08:00

36 lines
759 B
Lua

local wibox = require("wibox")
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
-- Icon
local icon = wibox.widget.textbox()
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.xcolor7 .. "'></span>"
-- Uptime
local disk = wibox.widget.textbox()
disk.font = beautiful.font_name .. "10"
disk.align = "center"
local function get_val()
awesome.connect_signal("signal::disk", function(disk_perc)
disk.markup = tonumber(disk_perc) .. "%"
end)
end
get_val()
local full = wibox.widget({
{
icon,
disk,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = 1,
right = 8,
layout = wibox.container.margin,
})
return full