2024-02-19 19:41:33 -08:00
|
|
|
local wibox = require("wibox")
|
2024-02-24 14:01:36 -08:00
|
|
|
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
|
|
|
|
2024-02-18 20:26:15 -08:00
|
|
|
-- Icon
|
2024-02-24 14:01:36 -08:00
|
|
|
local icon = helpers.create_icon(config.icons.disk, theme.xcolor7)
|
2024-02-18 14:31:14 -08:00
|
|
|
|
2024-02-18 20:26:15 -08:00
|
|
|
-- Uptime
|
2024-02-18 14:31:14 -08:00
|
|
|
local disk = wibox.widget.textbox()
|
2024-02-24 14:01:36 -08:00
|
|
|
disk.font = helpers.set_font("10")
|
2024-02-19 19:41:33 -08:00
|
|
|
disk.align = "center"
|
2024-02-18 14:31:14 -08:00
|
|
|
|
|
|
|
local function get_val()
|
|
|
|
awesome.connect_signal("signal::disk", function(disk_perc)
|
2024-02-24 14:01:36 -08:00
|
|
|
if disk_perc then
|
|
|
|
disk.markup = tonumber(disk_perc) .. "%"
|
|
|
|
end
|
2024-02-19 19:41:33 -08:00
|
|
|
end)
|
|
|
|
end
|
2024-02-18 14:31:14 -08:00
|
|
|
|
|
|
|
get_val()
|
|
|
|
|
2024-02-19 19:41:33 -08:00
|
|
|
local full = wibox.widget({
|
2024-02-18 14:31:14 -08:00
|
|
|
{
|
2024-02-19 19:41:33 -08:00
|
|
|
icon,
|
|
|
|
disk,
|
|
|
|
spacing = dpi(8),
|
|
|
|
layout = wibox.layout.fixed.horizontal,
|
2024-02-18 14:31:14 -08:00
|
|
|
},
|
2024-02-24 14:01:36 -08:00
|
|
|
left = dpi(1),
|
|
|
|
right = dpi(8),
|
2024-02-19 19:41:33 -08:00
|
|
|
layout = wibox.container.margin,
|
|
|
|
})
|
2024-02-18 14:31:14 -08:00
|
|
|
|
|
|
|
return full
|