notmuch^2

This commit is contained in:
enkore 2013-02-15 21:09:54 +01:00
parent c93503704b
commit c4e80b3e40

View File

@ -15,23 +15,25 @@ class NotmuchMailChecker(IntervalModule):
and "unread" and "unread"
""" """
db_path = '' db_path = ""
def __init__(self, db_path): def __init__(self, db_path):
self.db_path = db_path self.db_path = db_path
def run(self): def run(self):
db = notmuch.Database(self.db_path) db = notmuch.Database(self.db_path)
unread = notmuch.Query(db, 'tag:unread and tag:inbox').count_messages() unread = notmuch.Query(db, "tag:unread and tag:inbox").count_messages()
if (unread == 0): if (unread == 0):
color = '#00FF00' color = "#00FF00"
urgent = 'false' urgent = "false"
else: else:
color = '#ff0000' color = "#ff0000"
urgent = 'true' urgent = "true"
return {'full_text' : '%d new email%s' % (unread, ('s' if unread > 1 else '')), self.output = {
'name' : 'newmail', "full_text" : "%d new email%s" % (unread, ("s" if unread > 1 else "")),
'urgent' : urgent, "name" : "newmail",
'color' : color } "urgent" : urgent,
"color" : color
}