X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/b371de56f8bf19f982a4f6887f2110444b590f74..7fd4fdbc0fe237a967c542b24fe91cdfd326e3c5:/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)