mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-10 18:24:22 +02:00
widget: add filesystem widgets
This commit is contained in:
parent
76e330d981
commit
89af7feb58
2 changed files with 29 additions and 0 deletions
|
@ -48,6 +48,33 @@ volwidget:buttons(awful.util.table.join(
|
||||||
awful.button({ }, 5, function () awful.util.spawn("amixer -q -c 0 set Master 2dB-", false) end)
|
awful.button({ }, 5, function () awful.util.spawn("amixer -q -c 0 set Master 2dB-", false) end)
|
||||||
))
|
))
|
||||||
|
|
||||||
|
-- File systems
|
||||||
|
local fs = { ["/"] = "root",
|
||||||
|
["/home"] = "home",
|
||||||
|
["/var"] = "var",
|
||||||
|
["/usr"] = "usr",
|
||||||
|
["/tmp"] = "tmp",
|
||||||
|
["/var/cache/build"] = "pbuilder" }
|
||||||
|
local fswidget = widget({ type = "textbox" })
|
||||||
|
vicious.register(fswidget, vicious.widgets.fs,
|
||||||
|
function (widget, args)
|
||||||
|
local result = ""
|
||||||
|
for path, name in pairs(fs) do
|
||||||
|
local used = args["{" .. path .. " used_p}"]
|
||||||
|
local color = beautiful.fg_widget_value
|
||||||
|
if used then
|
||||||
|
if used > 90 then
|
||||||
|
color = beautiful.fg_widget_value_important
|
||||||
|
end
|
||||||
|
result = string.format(
|
||||||
|
'%s%s<span font="Terminus 8" color="' .. beautiful.fg_widget_label .. '">%s: </span>' ..
|
||||||
|
'<span font="Terminus 8" color="' .. color .. '">%2d%%</span>',
|
||||||
|
result, #result > 0 and separator.text or "", name, used)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end, 10)
|
||||||
|
|
||||||
local systray = widget({ type = "systray" })
|
local systray = widget({ type = "systray" })
|
||||||
|
|
||||||
-- Wibox initialisation
|
-- Wibox initialisation
|
||||||
|
@ -129,6 +156,7 @@ for s = 1, screen.count() do
|
||||||
datewidget, separator,
|
datewidget, separator,
|
||||||
onsecond(volwidget), onsecond(separator),
|
onsecond(volwidget), onsecond(separator),
|
||||||
onsecond(batwidget), onsecond(batwidget and separator or nil),
|
onsecond(batwidget), onsecond(batwidget and separator or nil),
|
||||||
|
onsecond(fswidget), onsecond(separator),
|
||||||
onfirst(memwidget), onfirst(separator),
|
onfirst(memwidget), onfirst(separator),
|
||||||
onfirst(cpuwidget), onfirst(separator),
|
onfirst(cpuwidget), onfirst(separator),
|
||||||
tasklist[s], separator,
|
tasklist[s], separator,
|
||||||
|
|
|
@ -12,6 +12,7 @@ if theme then
|
||||||
theme.bg_widget = "#00000099"
|
theme.bg_widget = "#00000099"
|
||||||
theme.fg_widget_label = "#708090"
|
theme.fg_widget_label = "#708090"
|
||||||
theme.fg_widget_value = "#FFFFFF"
|
theme.fg_widget_value = "#FFFFFF"
|
||||||
|
theme.fg_widget_value_important = "#FF2222"
|
||||||
theme.fg_widget_sep = "#FFFFFF"
|
theme.fg_widget_sep = "#FFFFFF"
|
||||||
theme.fg_widget_border = "#FFFFFF"
|
theme.fg_widget_border = "#FFFFFF"
|
||||||
theme.fg_widget_clock = "#FF7F00"
|
theme.fg_widget_clock = "#FF7F00"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue