X-Git-Url: https://git.madduck.net/etc/awesome.git/blobdiff_plain/bcd37ae4ae4f0e5d11ab6d8f6a9580e840447327..0279482eeb5867f49b4efc83d591393f9c3d0adb:/widgets/imap.lua diff --git a/widgets/imap.lua b/widgets/imap.lua index 06b4245..3caf31a 100644 --- a/widgets/imap.lua +++ b/widgets/imap.lua @@ -7,7 +7,6 @@ --]] local helpers = require("lain.helpers") -local async = require("lain.asyncshell") local naughty = require("naughty") local wibox = require("wibox") @@ -59,24 +58,19 @@ local function worker(args) curl = string.format("%s --url imaps://%s:%s/INBOX -u %s:%q %s -k", head_command, server, port, mail, password, request) - async.request(curl, function(f) + helpers.async(curl, function(f) _, mailcount = string.gsub(f, "%d+", "") - _ = nil widget = imap.widget settings() - if mailcount >= 1 and mailcount > helpers.get_map(mail) - then + if mailcount >= 1 and mailcount > helpers.get_map(mail) then if mailcount == 1 then nt = mail .. " has one new message" else nt = mail .. " has " .. mailcount .. " new messages" end - naughty.notify({ - preset = mail_notification_preset, - text = nt - }) + naughty.notify({ preset = mail_notification_preset, text = nt }) end helpers.set_map(mail, mailcount)