From d215c151a9f8c6c9a5de7d13ffecbd952d2ef0ca Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Wed, 7 Jul 2021 18:52:19 +0200 Subject: [PATCH] i3-companion: fix some edge cases for exclusive workspaces --- bin/i3-companion | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/i3-companion b/bin/i3-companion index 0ede59e..2375e9a 100755 --- a/bin/i3-companion +++ b/bin/i3-companion @@ -42,6 +42,7 @@ application_icons = { "google-chrome": "", "inkscape": "", "libreoffice": "", + "mpv": "", "pavucontrol": "", "signal": "", "snes9x-gtk": "", @@ -132,6 +133,7 @@ intrusive_apps = { "vbeterm" } + @on(Event.WINDOW_NEW) async def worksplace_exclusive(i3, event): """Move new windows on a new workspace instead of sharing a workspace @@ -142,11 +144,11 @@ async def worksplace_exclusive(i3, event): """Can this new window intrude any workspace?""" if w.floating in {"auto_on", "user_on"}: return True - if w.ipc_data['window_type'] not in {"normal", "splash"}: + if w.ipc_data['window_type'] not in {"normal", "splash", "unknown"}: return True if w.sticky: return True - ids = {s.lower() + ids = {s is not None and s.lower() or None for s in {w.name, w.window_class, w.window_instance}} if ids.intersection(intrusive_apps): return True @@ -161,7 +163,7 @@ async def worksplace_exclusive(i3, event): workspace = tree.find_focused().workspace() if not workspace: return - ids = {s.lower() + ids = {s is not None and s.lower() or None for w in workspace.leaves() for s in {w.name, w.window_class, w.window_instance}} exclusives = ids.intersection(exclusive_apps)