diff options
Diffstat (limited to 'xlib.py')
-rw-r--r-- | xlib.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1,24 +1,26 @@ +from threading import Thread
+
import Xlib
import Xlib.display
from zope import interface
-from interfaces import desktopEvent
-from threading import Thread
-from interfaces.message import IMessage, Debug
from zope import component
+from interfaces.message import Debug
+from interfaces import desktopEvent
from consumer import Mapping
@interface.implementer(desktopEvent.IDesktop)
class Listener(Thread):
def __init__(self, mapping):
- Thread.__init__(self)
+ super().__init__()
self.mapping = mapping
self.active_window = None
self.last_code = None
self.running = False
+ self.daemon = True
def getForegroundWindowTitle(self):
""" Return the name of the selected window
@@ -80,7 +82,7 @@ class Listener(Thread): found = True
if code != self.last_code:
- component.handle(Debug("Switching to '%s' for '%s'" % (pattern, window_name)))
+ component.handle(Debug(f"Switching to '{pattern}' for '{window_name}'"))
component.handle(Mapping((code, None)))
self.last_code = code
# We found a matching configuration. Even if the match is the
@@ -96,5 +98,5 @@ class Listener(Thread): self.last_code = "default"
- def stop(self):
+ def stop(self) -> None:
self.running = False
|