From 5948e9d2d4076426c35f332d243b81129cbb90f0 Mon Sep 17 00:00:00 2001 From: chonlon1 Date: Fri, 16 Dec 2022 00:02:16 +0800 Subject: [PATCH] feat: swap window0 and window1 when focus on window0 --- src/kwinscript/engine/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/kwinscript/engine/index.ts b/src/kwinscript/engine/index.ts index c6539301..70101e07 100644 --- a/src/kwinscript/engine/index.ts +++ b/src/kwinscript/engine/index.ts @@ -542,6 +542,17 @@ export class EngineImpl implements Engine { } public setMaster(window: EngineWindow): void { + // const window = this.controller.currentWindow; + // let windows; + + const windows = this.windows.allWindowsOn(this.controller.currentSurface); + if (windows && windows.length > 1) { + if (window === windows[0]) { + this.windows.putWindowToMaster(windows[1]); + this.controller.currentWindow = windows[1]; + return; + } + } this.windows.putWindowToMaster(window); }