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

37 lines
759 B
Lua
Raw Normal View History

2024-02-19 19:41:33 -08:00
local wibox = require("wibox")
2024-02-20 19:13:52 -08:00
local beautiful = require("beautiful").get()
local dpi = require("beautiful.xresources").apply_dpi
2024-02-19 19:41:33 -08:00
-- Icon
local icon = wibox.widget.textbox()
2024-02-19 19:41:33 -08:00
icon.font = beautiful.font_name .. "12.5"
icon.align = "center"
icon.markup = "<span foreground='" .. beautiful.xcolor7 .. "'></span>"
-- Uptime
local disk = wibox.widget.textbox()
2024-02-19 19:41:33 -08:00
disk.font = beautiful.font_name .. "10"
disk.align = "center"
local function get_val()
awesome.connect_signal("signal::disk", function(disk_perc)
2024-02-19 19:41:33 -08:00
disk.markup = tonumber(disk_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,
disk,
spacing = dpi(8),
layout = wibox.layout.fixed.horizontal,
},
left = 1,
2024-02-19 19:41:33 -08:00
right = 8,
layout = wibox.container.margin,
})
return full