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