summaryrefslogtreecommitdiffstats
path: root/awesome
diff options
context:
space:
mode:
authorGravatar Tom Willemse2014-08-21 20:08:20 +0200
committerGravatar Tom Willemse2014-08-21 20:08:20 +0200
commita3ecc8fd9795da91c0007bb33c272d4e4b7d9dd9 (patch)
tree17a22c4a2d4baa0b495158a4418b56d430ad07f3 /awesome
parent3446c32bdb65a9306ff75376b2f68648f25b7770 (diff)
downloaddotfiles-a3ecc8fd9795da91c0007bb33c272d4e4b7d9dd9.tar.gz
dotfiles-a3ecc8fd9795da91c0007bb33c272d4e4b7d9dd9.zip
Skip checking mailboxes if they don't exist
Diffstat (limited to 'awesome')
-rw-r--r--awesome/.config/awesome/rc.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/awesome/.config/awesome/rc.lua b/awesome/.config/awesome/rc.lua
index a89cc16..16e1492 100644
--- a/awesome/.config/awesome/rc.lua
+++ b/awesome/.config/awesome/rc.lua
@@ -22,17 +22,23 @@ local maildir_base = os.getenv("HOME") .. "/documents/mail/"
function new_mail(maildir)
local count = 0
-
- for file in lfs.dir(maildir_base .. maildir .. "/new") do
- if file ~= "." and file ~= ".." then
- count = count + 1
+ local newmaildir = maildir_base .. maildir .. "/new"
+ local curmaildir = maildir_base .. maildir .. "/cur"
+
+ if posix.access(newmaildir) then
+ for file in lfs.dir(newmaildir) do
+ if file ~= "." and file ~= ".." then
+ count = count + 1
+ end
end
end
- for file in lfs.dir(maildir_base .. maildir .. "/cur") do
- if string.sub(file, -1) ~= "S" and file ~= "."
+ if posix.access(curmaildir) then
+ for file in lfs.dir(curmaildir) do
+ if string.sub(file, -1) ~= "S" and file ~= "."
and file ~= ".." then
- count = count + 1
+ count = count + 1
+ end
end
end