Skip to content

Commit 9e8fba1

Browse files
fix(xlib): handle None return from get_wm_name() on KDE Plasma (#115)
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
1 parent c80aa5a commit 9e8fba1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

aw_watcher_window/xlib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ def get_window_name(window: Window) -> str:
7676
try:
7777
# Fallback.
7878
r = window.get_wm_name()
79-
if isinstance(r, str):
79+
if r is None:
80+
return "unknown"
81+
elif isinstance(r, str):
8082
return r
8183
else:
8284
logger.warning(

0 commit comments

Comments
 (0)