X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/669112020d022b3b9cb023c82230e21d36aa88cf..86b932b7c120c30e3ad2ce3838018f9e2942f729:/widgets/fs.lua?ds=inline diff --git a/widgets/fs.lua b/widgets/fs.lua index 17037c4..7406e05 100644 --- a/widgets/fs.lua +++ b/widgets/fs.lua @@ -64,7 +64,8 @@ local function worker(args) helpers.set_map("fs", false) function update() - fs_info = {} + fs_info = {} + fs_now = {} local f = io.popen("LC_ALL=C df -kP") @@ -85,17 +86,17 @@ local function worker(args) -- chosen partition easy stuff -- you can however check whatever partition else - used = tonumber(fs_info[partition .. " used_p"]) - available = tonumber(fs_info[partition .. " avail_p"]) - size_mb = tonumber(fs_info[partition .. " size_mb"]) - size_gb = tonumber(fs_info[partition .. " size_gb"]) + fs_now.used = tonumber(fs_info[partition .. " used_p"]) or 0 + fs_now.available = tonumber(fs_info[partition .. " avail_p"]) or 0 + fs_now.size_mb = tonumber(fs_info[partition .. " size_mb"]) or 0 + fs_now.size_gb = tonumber(fs_info[partition .. " size_gb"]) or 0 widget = fs.widget settings() - if used >= 99 and not helpers.get_map("fs") + if fs_now.used >= 99 and not helpers.get_map("fs") then - naughty.notify({ + naughty.notify({ title = "warning", text = partition .. " ran out!\nmake some room", timeout = 8,