1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-12-23 03:32:30 +00:00

fshwidget: fallback to / if /home is not a separate partition

This commit is contained in:
Son Pham 2013-08-20 23:50:33 -05:00
parent bd1bf8c195
commit c7cd13e93c
7 changed files with 44 additions and 30 deletions

View file

@ -369,16 +369,18 @@ fshwidget = wibox.widget.textbox()
too_much = false
vicious.register(fshwidget, vicious.widgets.fs,
function (widget, args)
if ( args["{/home used_p}"] >= 90 ) then
if ( args["{/home used_p}"] >= 99 and too_much == false ) then
naughty.notify({ title = "Warning", text = "/home partition ran out!\nmake some room",
-- used percent of /home if it is on a separate partition, else fallback to /
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 = "Warning", text = "hdd ran out!\nmake some room",
timeout = 7,
position = "top_right",
fg = beautiful.fg_urgent,
bg = beautiful.bg_urgent })
too_much = true
end
return gray .. " Hdd " .. coldef .. white .. args["{/home used_p}"] .. coldef .. " "
return gray .. " Hdd " .. coldef .. white .. used_percent .. coldef .. " "
else
return ""
end

View file

@ -295,16 +295,18 @@ fshwidget = wibox.widget.textbox()
too_much = false
vicious.register(fshwidget, vicious.widgets.fs,
function (widget, args)
if ( args["{/home used_p}"] >= 90 ) then
if ( args["{/home used_p}"] >= 99 and too_much == false ) then
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
-- used percent of /home if it is on a separate partition, else fallback to /
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 = "warning", text = "hdd ran out!\nmake some room",
timeout = 7,
position = "top_right",
fg = beautiful.fg_urgent,
bg = beautiful.bg_urgent })
too_much = true
end
return gray .. " Hdd " .. coldef .. white .. args["{/home used_p}"] .. coldef .. " "
return gray .. " Hdd " .. coldef .. white .. used_percent .. coldef .. " "
else
return ""
end

View file

@ -356,16 +356,18 @@ fshwidget = wibox.widget.textbox()
too_much = false
vicious.register(fshwidget, vicious.widgets.fs,
function (widget, args)
if ( args["{/home used_p}"] >= 90 ) then
if ( args["{/home used_p}"] >= 99 and too_much == false ) then
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
-- used percent of /home if it is on a separate partition, else fallback to /
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 = "warning", text = "hdd ran out!\nmake some room",
timeout = 7,
position = "top_right",
fg = beautiful.fg_urgent,
bg = beautiful.bg_urgent })
too_much = true
end
return white .. " Hdd " .. coldef .. blue .. args["{/home used_p}"] .. coldef .. " "
return white .. " Hdd " .. coldef .. blue .. used_percent .. coldef .. " "
else
return ""
end

View file

@ -303,17 +303,19 @@ fshicon:set_image(theme.confdir .. "/widgets/fs.png")
fshwidget = wibox.widget.textbox()
vicious.register(fshwidget, vicious.widgets.fs,
function (widget, args)
if args["{/home used_p}"] >= 95 and args["{/home used_p}"] < 99 then
return colwhi .. args["{/home used_p}"] .. "%" .. coldef
elseif args["{/home used_p}"] >= 99 and args["{/home used_p}"] <= 100 then
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
-- used percent of /home if it is on a separate partition, else fallback to /
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
if used_percent >= 95 and used_percent < 99 then
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,
position = "top_right",
fg = beautiful.fg_urgent,
bg = beautiful.bg_urgent })
return colwhi .. args["{/home used_p}"] .. "%" .. coldef
return colwhi .. used_percent .. "%" .. coldef
else
return azure .. args["{/home used_p}"] .. "%" .. coldef
return azure .. used_percent .. "%" .. coldef
end
end, 620)

View file

@ -353,17 +353,19 @@ fshicon:set_image(beautiful.widget_hdd)
fshwidget = wibox.widget.textbox()
vicious.register(fshwidget, vicious.widgets.fs,
function (widget, args)
if args["{/home used_p}"] >= 95 and args["{/home used_p}"] < 99 then
return '<span background="#313131" font="Terminus 13" rise="2000"> <span font="Terminus 9">' .. args["{/home used_p}"] .. '% </span></span>'
elseif args["{/home used_p}"] >= 99 and args["{/home used_p}"] <= 100 then
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
-- used percent of /home if it is on a separate partition, else fallback to /
used_percent = args["{/home used_p}"] or args["{/ used_p}"]
if used_percent >= 95 and used_percent < 99 then
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,
position = "top_right",
fg = beautiful.fg_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
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, 600)

View file

@ -331,8 +331,10 @@ fshwidget = wibox.widget.textbox()
too_much = false
vicious.register(fshwidget, vicious.widgets.fs,
function (widget, args)
if ( args["{/home used_p}"] >= 90 ) then
if ( args["{/home used_p}"] >= 99 and too_much == false ) then
-- used percent of /home if it is on a separate partition, else fallback to /
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.",
timeout = 7,
position = "top_right",
@ -340,7 +342,7 @@ function (widget, args)
bg = beautiful.bg_urgent })
too_much = true
end
return gray .. " Hdd " .. coldef .. white .. args["{/home used_p}"] .. coldef .. " "
return gray .. " Hdd " .. coldef .. white .. used_percent .. coldef .. " "
else
return ""
end

View file

@ -340,14 +340,16 @@ vicious.register(tempwidget, vicious.widgets.thermal, gray .. "Temp " .. coldef
fshwidget = wibox.widget.textbox()
vicious.register(fshwidget, vicious.widgets.fs,
function (widget, args)
if ( args["{/home used_p}"] >= 99 ) then
naughty.notify({ title = "warning", text = "/home partition ran out!\nmake some room",
-- used percent of /home if it is on a separate partition, else fallback to /
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,
position = "top_right",
fg = beautiful.fg_urgent,
bg = beautiful.bg_urgent })
end
return gray .. "Hdd " .. coldef .. white .. args["{/home used_p}"] .. coldef
return gray .. "Hdd " .. coldef .. white .. used_percent .. coldef
end, 600)
local infos = nil