refactor(utils): simplify unknown handling in format_window
- Removed redundant checks for "unknown" in title and wmclass - Streamlined cleanup to treat "unknown" as empty strings - Always call format_app_name with update=True to sync service state - Improves readability and reduces edge‑case bugs
This commit is contained in:
1 file changed
+3
-7
@@ -79,15 +79,11 @@ app_name_resolver = AppName()
|
|||||||
|
|
||||||
|
|
||||||
def format_window(title, wmclass):
|
def format_window(title, wmclass):
|
||||||
# Handle the case when HyprlandActiveWindow passes "unknown" instead of empty strings
|
# Clean up "unknown" values to ensure they are treated as empty
|
||||||
if (not title or title == "unknown") and (not wmclass or wmclass == "unknown"):
|
|
||||||
return "Finder"
|
|
||||||
|
|
||||||
# Clean up "unknown" values
|
|
||||||
if title == "unknown":
|
if title == "unknown":
|
||||||
title = ""
|
title = ""
|
||||||
if wmclass == "unknown":
|
if wmclass == "unknown":
|
||||||
wmclass = ""
|
wmclass = ""
|
||||||
|
|
||||||
name = app_name_resolver.format_app_name(title, wmclass, True)
|
# Always call format_app_name with update=True to keep service state in sync
|
||||||
return name
|
return app_name_resolver.format_app_name(title, wmclass, True)
|
||||||
Reference in new issue
Block a user