diff --git a/src/lib/layout/Window.ts b/src/lib/layout/Window.ts index 5c975aa..e4bb855 100644 --- a/src/lib/layout/Window.ts +++ b/src/lib/layout/Window.ts @@ -21,7 +21,7 @@ class Window { if (targetColumn === this.column) { return; } - this.column.onWindowRemoved(this, false); + this.column.onWindowRemoved(this, this.isFocused() && targetColumn.grid !== this.column.grid); this.column = targetColumn; targetColumn.onWindowAdded(this, bottom); } diff --git a/src/tests/flows/passFocus.ts b/src/tests/flows/passFocus.ts index dc4dfc9..8bcf96f 100644 --- a/src/tests/flows/passFocus.ts +++ b/src/tests/flows/passFocus.ts @@ -1,4 +1,4 @@ -tests.register("Pass focus", 1, () => { +tests.register("Pass focus", 10, () => { const config = getDefaultConfig(); const { qtMock, workspaceMock, world } = init(config); @@ -10,4 +10,7 @@ tests.register("Pass focus", 1, () => { qtMock.fireShortcut("karousel-column-move-to-desktop-2"); Assert.equal(workspaceMock.activeWindow, client1); + + client1.desktops = [workspaceMock.desktops[1]]; + Assert.equal(workspaceMock.activeWindow, client0); }); diff --git a/src/tests/utils/mocks/MockKwinClient.ts b/src/tests/utils/mocks/MockKwinClient.ts index 213619d..b5ee49c 100644 --- a/src/tests/utils/mocks/MockKwinClient.ts +++ b/src/tests/utils/mocks/MockKwinClient.ts @@ -182,14 +182,10 @@ class MockKwinClient { public set desktops(desktops: KwinDesktop[]) { this._desktops = desktops; - runReorder( - () => this.desktopsChanged.fire(), - () => { - if (Workspace.activeWindow === this && !desktops.includes(Workspace.currentDesktop)) { - Workspace.activeWindow = null; - } - }, - ); + this.desktopsChanged.fire(); + if (Workspace.activeWindow === this && !desktops.includes(Workspace.currentDesktop)) { + Workspace.activeWindow = null; + }; } public get tile() {