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"
"""
db_path = ''
db_path = ""
def __init__(self, db_path):
self.db_path = db_path
def run(self):
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):
color = '#00FF00'
urgent = 'false'
color = "#00FF00"
urgent = "false"
else:
color = '#ff0000'
urgent = 'true'
color = "#ff0000"
urgent = "true"
return {'full_text' : '%d new email%s' % (unread, ('s' if unread > 1 else '')),
'name' : 'newmail',
'urgent' : urgent,
'color' : color }
self.output = {
"full_text" : "%d new email%s" % (unread, ("s" if unread > 1 else "")),
"name" : "newmail",
"urgent" : urgent,
"color" : color
}