From bae4e80500b552f7b3658a1a6a158fef02047f58 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Wed, 7 May 2025 11:31:20 +0200 Subject: Remove the existing handler (and unused) in socketserver --- xlib.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'xlib.py') 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 -- cgit v1.2.3