X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/52deb6911957f840a0191f73c8a9626bd9ff5086..7de62e4d9fe0d3a7521fc72a66c905d6f343c27b:/widgets/imap.lua diff --git a/widgets/imap.lua b/widgets/imap.lua index ec7bd1f..350e1ad 100644 --- a/widgets/imap.lua +++ b/widgets/imap.lua @@ -43,9 +43,7 @@ local function worker(args) if not is_plain then - local f = io.popen(password) - password = f:read("*all"):gsub("\n", "") - f:close() + password = helpers.read_pipe(password):gsub("\n", "") end imap.widget = wibox.widget.textbox('') @@ -64,14 +62,13 @@ local function worker(args) head_command, server, port, mail, password, request) async.request(curl, function(f) - ws = f:read("*all") - f:close() - - _, mailcount = string.gsub(ws, "%d+", "") + _, mailcount = string.gsub(f, "%d+", "") _ = nil - widget = imap.widget - settings() + if mailcount ~= helpers.get_map(mail) then + widget = imap.widget + settings() + end if mailcount >= 1 and mailcount > helpers.get_map(mail) then