madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

widget.imap: ensure to get unseen messages; #400
authorLuca CPZ <luca.cpz@gmail.com>
Thu, 30 Aug 2018 14:02:41 +0000 (16:02 +0200)
committerLuca CPZ <luca.cpz@gmail.com>
Thu, 30 Aug 2018 15:40:17 +0000 (17:40 +0200)
widget/imap.lua

index 7c13223e9ed5eb54dbd3eb174458abbcd191ad96..93aced95495997b0272825ddedc2e62f4fb80471 100644 (file)
@@ -9,8 +9,7 @@ local helpers  = require("lain.helpers")
 local naughty  = require("naughty")
 local wibox    = require("wibox")
 local awful    = require("awful")
-local string   = { format = string.format,
-                   gsub   = string.gsub }
+local string   = string
 local type     = type
 local tonumber = tonumber
 
@@ -59,7 +58,7 @@ local function factory(args)
                head_command, server, port, mail, password, request)
 
         helpers.async(curl, function(f)
-            _, mailcount = string.gsub(f, "%d+", "")
+            mailcount = tonumber(f:match("UNSEEN (%d+)"))
             widget = imap.widget
             settings()