X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/945f220e022e69c1aeda0ee86558be26f19bdd40..6603c641c6ce675b010ca1977423747ca55d8795:/widgets/maildir.lua?ds=inline diff --git a/widgets/maildir.lua b/widgets/maildir.lua index 315ae34..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 = { popen = io.popen } 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)