i3-companion: correctly handle apps without window class

I am looking at you Spotify...
This commit is contained in:
Vincent Bernat 2021-08-12 10:44:26 +02:00
parent 60baedbadd
commit ebed328443

View file

@ -420,7 +420,10 @@ async def workspace_exclusive(i3, event):
w = event.container w = event.container
# Can the current window intrude the workspace? # Can the current window intrude the workspace?
if w.floating in {"auto_on", "user_on"} or w.window_class.lower() in intrusive_apps: if (
w.floating in {"auto_on", "user_on"}
or (w.window_class or "").lower() in intrusive_apps
):
logger.debug("window %s can intrude", w.window_class) logger.debug("window %s can intrude", w.window_class)
return return
@ -444,7 +447,7 @@ async def workspace_exclusive(i3, event):
for ow in tree.leaves() for ow in tree.leaves()
if w.id != ow.id if w.id != ow.id
and (w.window_class or object()) != ow.window_class and (w.window_class or object()) != ow.window_class
and ow.window_class.lower() in exclusive_apps and (ow.window_class or "").lower() in exclusive_apps
and not ow.sticky and not ow.sticky
} }
@ -460,7 +463,7 @@ async def workspace_exclusive(i3, event):
if w.id != ow.id and (w.window_class or object()) == ow.window_class if w.id != ow.id and (w.window_class or object()) == ow.window_class
} }
candidate_workspaces -= exclusive_workspaces candidate_workspaces -= exclusive_workspaces
candidate_workspaces -= {-1} # scratchpad candidate_workspaces -= {-1} # scratchpad
if candidate_workspaces: if candidate_workspaces:
# Use one of the candidates # Use one of the candidates