X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/b371de56f8bf19f982a4f6887f2110444b590f74..63066fba60b919f51c0e66ac27a31201a166ef31:/widgets/maildir.lua diff --git a/widgets/maildir.lua b/widgets/maildir.lua index 246341f..eed6138 100644 --- a/widgets/maildir.lua +++ b/widgets/maildir.lua @@ -8,6 +8,7 @@ --]] local newtimer = require("lain.helpers").newtimer +local read_pipe = require("lain.helpers").read_pipe local wibox = require("wibox") @@ -50,10 +51,9 @@ local function worker(args) -- match files that begin with a dot. -- Afterwards the length of this string is the number of -- new mails in that box. - local np = io.popen("find " .. line .. + local mailstring = read_pipe("find " .. line .. "/new -mindepth 1 -type f " .. "-not -name '.*' -printf a") - local mailstring = np:read("*a") -- Strip off leading mailpath. local box = string.match(line, mailpath .. "/*([^/]+)") @@ -65,10 +65,11 @@ local function worker(args) end until line == nil + p:close() table.sort(boxes) newmail = "no mail" - --Count the total number of mails irrespective of where it was found + -- Count the total number of mails irrespective of where it was found total = 0 for box, number in pairs(boxes)