From df3c1f45129ff87ec3aa25d1d3e93e45c3b241c2 Mon Sep 17 00:00:00 2001 From: Peter Fajdiga Date: Fri, 7 Mar 2025 16:43:50 +0100 Subject: [PATCH] allow tiling windows that start in full-screen (fixes #79) --- src/lib/world/Clients.ts | 4 ++-- src/lib/world/clientState/Tiled.ts | 10 +++++++++- src/tests/units/world/Clients.ts | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib/world/Clients.ts b/src/lib/world/Clients.ts index 206ae1e..12fc796 100644 --- a/src/lib/world/Clients.ts +++ b/src/lib/world/Clients.ts @@ -5,8 +5,8 @@ namespace Clients { ]; export function canTileEver(kwinClient: KwinClient) { - return kwinClient.moveable && - kwinClient.resizeable && + const shapeable = (kwinClient.moveable && kwinClient.resizeable) || kwinClient.fullScreen; // full-screen windows may become shapeable after exiting full-screen mode + return shapeable && !kwinClient.popupWindow && !prohibitedClasses.includes(kwinClient.resourceClass); } diff --git a/src/lib/world/clientState/Tiled.ts b/src/lib/world/clientState/Tiled.ts index 9ea7dc4..6a1b2e4 100644 --- a/src/lib/world/clientState/Tiled.ts +++ b/src/lib/world/clientState/Tiled.ts @@ -160,7 +160,15 @@ namespace ClientState { }); manager.connect(kwinClient.fullScreenChanged, () => { - world.do(() => window.onFullScreenChanged(kwinClient.fullScreen)); + world.do((clientManager, desktopManager) => { + // some clients only turn out to be untileable after exiting full-screen mode + if (!Clients.canTileEver(kwinClient)) { + clientManager.floatClient(client); + return; + } + + window.onFullScreenChanged(kwinClient.fullScreen); + }); }); manager.connect(kwinClient.tileChanged, () => { diff --git a/src/tests/units/world/Clients.ts b/src/tests/units/world/Clients.ts index e9f5938..3b2edfb 100644 --- a/src/tests/units/world/Clients.ts +++ b/src/tests/units/world/Clients.ts @@ -4,6 +4,7 @@ tests.register("Clients.canTileEver", 1, () => { { clientProperties: { resourceClass: "app", caption: "Title", moveable: false }, tileable: false }, { clientProperties: { resourceClass: "app", caption: "Caption", resizeable: false }, tileable: false }, { clientProperties: { resourceClass: "app", caption: "Caption", normalWindow: false, popupWindow: true }, tileable: false }, + { clientProperties: { resourceClass: "app", caption: "Caption", moveable: false, resizeable: false, fullScreen: true }, tileable: true }, { clientProperties: { resourceClass: "ksmserver-logout-greeter", caption: "Caption" }, tileable: false }, { clientProperties: { resourceClass: "xwaylandvideobridge", caption: "" }, tileable: false }, ]; @@ -24,6 +25,7 @@ tests.register("Clients.canTileEver", 1, () => { pid: 100, moveable: true, resizeable: true, + fullScreen: false, popupWindow: false, minimized: false, desktops: [1],