X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/34e47e46ff708d3b79c824dacc614b47a286eefe..9223ddfb10e77e932d3e462f6c734528e665290a:/widgets/maildir.lua?ds=sidebyside diff --git a/widgets/maildir.lua b/widgets/maildir.lua index 8fe097e..cb96a30 100644 --- a/widgets/maildir.lua +++ b/widgets/maildir.lua @@ -8,12 +8,12 @@ --]] local newtimer = require("lain.helpers").newtimer +local read_pipe = require("lain.helpers").read_pipe local wibox = require("wibox") local util = require("lain.util") -local io = io local os = { getenv = os.getenv } local pairs = pairs local string = { len = string.len, @@ -50,10 +50,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 +64,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)