From 3881c92ab282437b5c6932a98fed75d6fa01dc38 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 20 Feb 2026 14:57:55 +0000 Subject: [PATCH] fix(xlib): handle None return from get_wm_name() on KDE Plasma When no WM_NAME property exists on a window (common on KDE Plasma with Fedora), window.get_wm_name() returns None. The isinstance(r, str) check doesn't catch None, so it falls through to r.decode("latin1") which raises AttributeError: 'NoneType' object has no attribute 'decode'. Add a None guard that returns "unknown", matching the existing error handling pattern in the function. Fixes #114 --- aw_watcher_window/xlib.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aw_watcher_window/xlib.py b/aw_watcher_window/xlib.py index 02842a5b..a8c36e6b 100644 --- a/aw_watcher_window/xlib.py +++ b/aw_watcher_window/xlib.py @@ -76,7 +76,9 @@ def get_window_name(window: Window) -> str: try: # Fallback. r = window.get_wm_name() - if isinstance(r, str): + if r is None: + return "unknown" + elif isinstance(r, str): return r else: logger.warning(