mirror of
https://github.com/lcpz/awesome-copycats.git
synced 2024-12-23 11:32:32 +00:00
fshwidget: fallback to / if /home is not a separate partition
This commit is contained in:
parent
bd1bf8c195
commit
c7cd13e93c
|
@ -369,16 +369,18 @@ fshwidget = wibox.widget.textbox()
|
||||||
too_much = false
|
too_much = false
|
||||||
vicious.register(fshwidget, vicious.widgets.fs,
|
vicious.register(fshwidget, vicious.widgets.fs,
|
||||||
function (widget, args)
|
function (widget, args)
|
||||||
if ( args["{/home used_p}"] >= 90 ) then
|
-- used percent of /home if it is on a separate partition, else fallback to /
|
||||||
if ( args["{/home used_p}"] >= 99 and too_much == false ) then
|
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
|
||||||
naughty.notify({ title = "Warning", text = "/home partition ran out!\nmake some room",
|
if ( used_percent >= 90 ) then
|
||||||
|
if ( used_percent >= 99 and too_much == false ) then
|
||||||
|
naughty.notify({ title = "Warning", text = "hdd ran out!\nmake some room",
|
||||||
timeout = 7,
|
timeout = 7,
|
||||||
position = "top_right",
|
position = "top_right",
|
||||||
fg = beautiful.fg_urgent,
|
fg = beautiful.fg_urgent,
|
||||||
bg = beautiful.bg_urgent })
|
bg = beautiful.bg_urgent })
|
||||||
too_much = true
|
too_much = true
|
||||||
end
|
end
|
||||||
return gray .. " Hdd " .. coldef .. white .. args["{/home used_p}"] .. coldef .. " "
|
return gray .. " Hdd " .. coldef .. white .. used_percent .. coldef .. " "
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -295,16 +295,18 @@ fshwidget = wibox.widget.textbox()
|
||||||
too_much = false
|
too_much = false
|
||||||
vicious.register(fshwidget, vicious.widgets.fs,
|
vicious.register(fshwidget, vicious.widgets.fs,
|
||||||
function (widget, args)
|
function (widget, args)
|
||||||
if ( args["{/home used_p}"] >= 90 ) then
|
-- used percent of /home if it is on a separate partition, else fallback to /
|
||||||
if ( args["{/home used_p}"] >= 99 and too_much == false ) then
|
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
|
||||||
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
|
if ( used_percent >= 90 ) then
|
||||||
|
if ( used_percent >= 99 and too_much == false ) then
|
||||||
|
naughty.notify({ title = "warning", text = "hdd ran out!\nmake some room",
|
||||||
timeout = 7,
|
timeout = 7,
|
||||||
position = "top_right",
|
position = "top_right",
|
||||||
fg = beautiful.fg_urgent,
|
fg = beautiful.fg_urgent,
|
||||||
bg = beautiful.bg_urgent })
|
bg = beautiful.bg_urgent })
|
||||||
too_much = true
|
too_much = true
|
||||||
end
|
end
|
||||||
return gray .. " Hdd " .. coldef .. white .. args["{/home used_p}"] .. coldef .. " "
|
return gray .. " Hdd " .. coldef .. white .. used_percent .. coldef .. " "
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
10
rc.lua.holo
10
rc.lua.holo
|
@ -356,16 +356,18 @@ fshwidget = wibox.widget.textbox()
|
||||||
too_much = false
|
too_much = false
|
||||||
vicious.register(fshwidget, vicious.widgets.fs,
|
vicious.register(fshwidget, vicious.widgets.fs,
|
||||||
function (widget, args)
|
function (widget, args)
|
||||||
if ( args["{/home used_p}"] >= 90 ) then
|
-- used percent of /home if it is on a separate partition, else fallback to /
|
||||||
if ( args["{/home used_p}"] >= 99 and too_much == false ) then
|
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
|
||||||
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
|
if ( used_percent >= 90 ) then
|
||||||
|
if ( used_percent >= 99 and too_much == false ) then
|
||||||
|
naughty.notify({ title = "warning", text = "hdd ran out!\nmake some room",
|
||||||
timeout = 7,
|
timeout = 7,
|
||||||
position = "top_right",
|
position = "top_right",
|
||||||
fg = beautiful.fg_urgent,
|
fg = beautiful.fg_urgent,
|
||||||
bg = beautiful.bg_urgent })
|
bg = beautiful.bg_urgent })
|
||||||
too_much = true
|
too_much = true
|
||||||
end
|
end
|
||||||
return white .. " Hdd " .. coldef .. blue .. args["{/home used_p}"] .. coldef .. " "
|
return white .. " Hdd " .. coldef .. blue .. used_percent .. coldef .. " "
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -303,17 +303,19 @@ fshicon:set_image(theme.confdir .. "/widgets/fs.png")
|
||||||
fshwidget = wibox.widget.textbox()
|
fshwidget = wibox.widget.textbox()
|
||||||
vicious.register(fshwidget, vicious.widgets.fs,
|
vicious.register(fshwidget, vicious.widgets.fs,
|
||||||
function (widget, args)
|
function (widget, args)
|
||||||
if args["{/home used_p}"] >= 95 and args["{/home used_p}"] < 99 then
|
-- used percent of /home if it is on a separate partition, else fallback to /
|
||||||
return colwhi .. args["{/home used_p}"] .. "%" .. coldef
|
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
|
||||||
elseif args["{/home used_p}"] >= 99 and args["{/home used_p}"] <= 100 then
|
if used_percent >= 95 and used_percent < 99 then
|
||||||
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
|
return colwhi .. used_percent .. "%" .. coldef
|
||||||
|
elseif used_percent >= 99 and used_percent <= 100 then
|
||||||
|
naughty.notify({ title = "warning", text = "hdd ran out!\nmake some room",
|
||||||
timeout = 10,
|
timeout = 10,
|
||||||
position = "top_right",
|
position = "top_right",
|
||||||
fg = beautiful.fg_urgent,
|
fg = beautiful.fg_urgent,
|
||||||
bg = beautiful.bg_urgent })
|
bg = beautiful.bg_urgent })
|
||||||
return colwhi .. args["{/home used_p}"] .. "%" .. coldef
|
return colwhi .. used_percent .. "%" .. coldef
|
||||||
else
|
else
|
||||||
return azure .. args["{/home used_p}"] .. "%" .. coldef
|
return azure .. used_percent .. "%" .. coldef
|
||||||
end
|
end
|
||||||
end, 620)
|
end, 620)
|
||||||
|
|
||||||
|
|
|
@ -353,17 +353,19 @@ fshicon:set_image(beautiful.widget_hdd)
|
||||||
fshwidget = wibox.widget.textbox()
|
fshwidget = wibox.widget.textbox()
|
||||||
vicious.register(fshwidget, vicious.widgets.fs,
|
vicious.register(fshwidget, vicious.widgets.fs,
|
||||||
function (widget, args)
|
function (widget, args)
|
||||||
if args["{/home used_p}"] >= 95 and args["{/home used_p}"] < 99 then
|
-- used percent of /home if it is on a separate partition, else fallback to /
|
||||||
return '<span background="#313131" font="Terminus 13" rise="2000"> <span font="Terminus 9">' .. args["{/home used_p}"] .. '% </span></span>'
|
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
|
||||||
elseif args["{/home used_p}"] >= 99 and args["{/home used_p}"] <= 100 then
|
if used_percent >= 95 and used_percent < 99 then
|
||||||
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
|
return '<span background="#313131" font="Terminus 13" rise="2000"> <span font="Terminus 9">' .. used_percent .. '% </span></span>'
|
||||||
|
elseif used_percent >= 99 and used_percent <= 100 then
|
||||||
|
naughty.notify({ title = "warning", text = "hdd ran out!\nmake some room",
|
||||||
timeout = 10,
|
timeout = 10,
|
||||||
position = "top_right",
|
position = "top_right",
|
||||||
fg = beautiful.fg_urgent,
|
fg = beautiful.fg_urgent,
|
||||||
bg = beautiful.bg_urgent })
|
bg = beautiful.bg_urgent })
|
||||||
return '<span background="#313131" font="Terminus 13" rise="2000"> <span font="Terminus 9">' .. args["{/home used_p}"] .. '% </span></span>'
|
return '<span background="#313131" font="Terminus 13" rise="2000"> <span font="Terminus 9">' .. used_percent .. '% </span></span>'
|
||||||
else
|
else
|
||||||
return '<span background="#313131" font="Terminus 13" rise="2000"> <span font="Terminus 9">' .. args["{/home used_p}"] .. '% </span></span>'
|
return '<span background="#313131" font="Terminus 13" rise="2000"> <span font="Terminus 9">' .. used_percent .. '% </span></span>'
|
||||||
end
|
end
|
||||||
end, 600)
|
end, 600)
|
||||||
|
|
||||||
|
|
|
@ -331,8 +331,10 @@ fshwidget = wibox.widget.textbox()
|
||||||
too_much = false
|
too_much = false
|
||||||
vicious.register(fshwidget, vicious.widgets.fs,
|
vicious.register(fshwidget, vicious.widgets.fs,
|
||||||
function (widget, args)
|
function (widget, args)
|
||||||
if ( args["{/home used_p}"] >= 90 ) then
|
-- used percent of /home if it is on a separate partition, else fallback to /
|
||||||
if ( args["{/home used_p}"] >= 99 and too_much == false ) then
|
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
|
||||||
|
if ( used_percent >= 90 ) then
|
||||||
|
if ( used_percent >= 99 and too_much == false ) then
|
||||||
naughty.notify({ title = "Attenzione", text = "Partizione /home esaurita!\nFa' un po' di spazio.",
|
naughty.notify({ title = "Attenzione", text = "Partizione /home esaurita!\nFa' un po' di spazio.",
|
||||||
timeout = 7,
|
timeout = 7,
|
||||||
position = "top_right",
|
position = "top_right",
|
||||||
|
@ -340,7 +342,7 @@ function (widget, args)
|
||||||
bg = beautiful.bg_urgent })
|
bg = beautiful.bg_urgent })
|
||||||
too_much = true
|
too_much = true
|
||||||
end
|
end
|
||||||
return gray .. " Hdd " .. coldef .. white .. args["{/home used_p}"] .. coldef .. " "
|
return gray .. " Hdd " .. coldef .. white .. used_percent .. coldef .. " "
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
|
@ -340,14 +340,16 @@ vicious.register(tempwidget, vicious.widgets.thermal, gray .. "Temp " .. coldef
|
||||||
fshwidget = wibox.widget.textbox()
|
fshwidget = wibox.widget.textbox()
|
||||||
vicious.register(fshwidget, vicious.widgets.fs,
|
vicious.register(fshwidget, vicious.widgets.fs,
|
||||||
function (widget, args)
|
function (widget, args)
|
||||||
if ( args["{/home used_p}"] >= 99 ) then
|
-- used percent of /home if it is on a separate partition, else fallback to /
|
||||||
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
|
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
|
||||||
|
if ( used_percent >= 99 ) then
|
||||||
|
naughty.notify({ title = "warning", text = "hdd ran out!\nmake some room",
|
||||||
timeout = 10,
|
timeout = 10,
|
||||||
position = "top_right",
|
position = "top_right",
|
||||||
fg = beautiful.fg_urgent,
|
fg = beautiful.fg_urgent,
|
||||||
bg = beautiful.bg_urgent })
|
bg = beautiful.bg_urgent })
|
||||||
end
|
end
|
||||||
return gray .. "Hdd " .. coldef .. white .. args["{/home used_p}"] .. coldef
|
return gray .. "Hdd " .. coldef .. white .. used_percent .. coldef
|
||||||
end, 600)
|
end, 600)
|
||||||
|
|
||||||
local infos = nil
|
local infos = nil
|
||||||
|
|
Loading…
Reference in a new issue