aboutsummaryrefslogtreecommitdiff
path: root/xlib.py
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2025-05-07 11:31:20 +0200
committerSébastien Dailly <sebastien@dailly.me>2025-07-07 08:32:41 +0200
commitbae4e80500b552f7b3658a1a6a158fef02047f58 (patch)
tree1f8ea0764cce5b32b8cc2178a20211b3c993e7ff /xlib.py
parent4bf1c1ffe795a1d28a543a20cc3771a30a090b89 (diff)
Remove the existing handler (and unused) in socketserver
Diffstat (limited to 'xlib.py')
-rw-r--r--xlib.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/xlib.py b/xlib.py
index 20476aa..d28dfd4 100644
--- a/xlib.py
+++ b/xlib.py
@@ -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