i3-companion: use window current workspace for exclusivity check

This commit is contained in:
Vincent Bernat 2021-07-14 07:38:36 +02:00
parent 81cdc7b40d
commit 65caa00117

View file

@ -317,11 +317,16 @@ async def worksplace_exclusive(i3, event):
logger.debug(f"window {w.name} can intrude") logger.debug(f"window {w.name} can intrude")
return return
# Does the current workspace contains an exclusive app? # Get the workspace. From an event, w.workspace() is None, so
# search it in the tree.
tree = await i3.get_tree() tree = await i3.get_tree()
workspace = tree.find_focused().workspace() workspace = next(
(ow.workspace() for ow in tree.leaves() if w.id == ow.id), None
)
if not workspace: if not workspace:
return return
# Does the target workspace contains an exclusive app?
ids = { ids = {
s is not None and s.lower() or None s is not None and s.lower() or None
for ow in workspace.leaves() for ow in workspace.leaves()