forked from Kuroneer/awm_config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfs_widget.lua
More file actions
19 lines (18 loc) · 787 Bytes
/
Copy pathfs_widget.lua
File metadata and controls
19 lines (18 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local beautiful = require("beautiful")
-- Lain widgets (https://github.com/lcpz/lain)
local lain = safe_require("lain")
local bars = {"▁","▂","▃","▄","▅","▆","▇","█"}
if require("lgi").Gio.unix_mounts_get and lain then
return lain.widget.fs{
followtag = true,
settings = function()
local percentage = tonumber(fs_now["/"].percentage or 0)
local span_begin = '<span size="larger" weight="bold" color="'..((percentage > 90) and beautiful.bg_urgent or beautiful.fg_normal)..'">'
local span_end = '</span>'
widget:set_markup_silently(string.format("%s ⛁ %s %s", span_begin, bars[math.floor(percentage*#bars/100)], span_end))
end,
notification_preset = {font = beautiful.font},
}
else
return false
end