X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/293091d2674bb5b37d461b7989a39b7048800794..edc6e0013eaeef22127f53a89b36d559ce7e7820:/widgets/maildir.lua diff --git a/widgets/maildir.lua b/widgets/maildir.lua index 315ae34..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("*all") -- 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)