...
This commit is contained in:
parent
db94df07a3
commit
807eb937fd
@ -11,7 +11,7 @@ class Module(object):
|
||||
def registered(self, status_handler):
|
||||
"""Called when this module is registered with a status handler"""
|
||||
|
||||
def run(self):
|
||||
def tick(self):
|
||||
"""Only called if self.async == False. Called once per tick"""
|
||||
|
||||
class I3statusHandler(object):
|
||||
|
@ -11,6 +11,7 @@ import dbus, gobject
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
import json
|
||||
import threading
|
||||
import time
|
||||
|
||||
class ThunderbirdMailChecker(object):
|
||||
"""
|
||||
@ -18,7 +19,7 @@ class ThunderbirdMailChecker(object):
|
||||
the dbus-sender extension for thunderbird.
|
||||
"""
|
||||
|
||||
async = False
|
||||
async = True
|
||||
output = None
|
||||
|
||||
unread = set()
|
||||
@ -36,8 +37,14 @@ class ThunderbirdMailChecker(object):
|
||||
dbus.mainloop.glib.threads_init()
|
||||
self.context = loop.get_context()
|
||||
|
||||
def tick(self):
|
||||
self.context.iteration(False)
|
||||
self.thread = threading.Thread(target=self.mainloop)
|
||||
self.thread.daemon = True
|
||||
self.thread.start()
|
||||
|
||||
def mainloop(self):
|
||||
while True:
|
||||
self.context.iteration(False)
|
||||
time.sleep(1)
|
||||
|
||||
def new_msg(self, id, author, subject):
|
||||
if id not in self.unread:
|
||||
|
Loading…
Reference in New Issue
Block a user