From 3373e0265892c8508d715ae8a88ff53a63d0d8d0 Mon Sep 17 00:00:00 2001 From: Peter Fajdiga Date: Fri, 29 Sep 2023 08:50:54 +0200 Subject: [PATCH] add skipSwitcher setting --- package/contents/ui/config.ui | 15 +++++++++++---- src/config/config.ts | 1 + src/config/definition.ts | 5 +++++ src/extern/kwin.d.ts | 1 + src/layout/LayoutConfig.ts | 1 + src/world/World.ts | 1 + src/world/clientState/Tiled.ts | 12 ++++++++++-- 7 files changed, 30 insertions(+), 6 deletions(-) diff --git a/package/contents/ui/config.ui b/package/contents/ui/config.ui index fce349e..c8c842c 100644 --- a/package/contents/ui/config.ui +++ b/package/contents/ui/config.ui @@ -245,8 +245,15 @@ - + + + Tiled windows skip switcher + + + + + Qt::Vertical @@ -262,21 +269,21 @@ - + Layering mode: - + Keep tiled windows below - + Keep floating windows above diff --git a/src/config/config.ts b/src/config/config.ts index f9473f7..bf94b38 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -11,6 +11,7 @@ type Config = { stackColumnsByDefault: boolean, resizeNeighborColumn: boolean, reMaximize: boolean, + skipSwitcher: boolean, tiledKeepBelow: boolean, floatingKeepAbove: boolean, windowRules: string, diff --git a/src/config/definition.ts b/src/config/definition.ts index 944bf90..a0255aa 100644 --- a/src/config/definition.ts +++ b/src/config/definition.ts @@ -112,6 +112,11 @@ const configDef = [ "type": "Bool", "default": false }, + { + "name": "skipSwitcher", + "type": "Bool", + "default": false + }, { "name": "tiledKeepBelow", "type": "Bool", diff --git a/src/extern/kwin.d.ts b/src/extern/kwin.d.ts index 76df038..cc65f54 100644 --- a/src/extern/kwin.d.ts +++ b/src/extern/kwin.d.ts @@ -51,6 +51,7 @@ interface KwinClient { // Read-write Properties fullScreen: boolean; activities: string[]; // empty array means all activities + skipSwitcher: boolean; keepAbove: boolean; keepBelow: boolean; shade: boolean; diff --git a/src/layout/LayoutConfig.ts b/src/layout/LayoutConfig.ts index 6f513d8..8acdc47 100644 --- a/src/layout/LayoutConfig.ts +++ b/src/layout/LayoutConfig.ts @@ -4,6 +4,7 @@ type LayoutConfig = { stackColumnsByDefault: boolean, resizeNeighborColumn: boolean, reMaximize: boolean, + skipSwitcher: boolean, tiledKeepBelow: boolean, maximizedKeepAbove: boolean, }; diff --git a/src/world/World.ts b/src/world/World.ts index 0c73921..5916c41 100644 --- a/src/world/World.ts +++ b/src/world/World.ts @@ -36,6 +36,7 @@ class World { stackColumnsByDefault: config.stackColumnsByDefault, resizeNeighborColumn: config.resizeNeighborColumn, reMaximize: config.reMaximize, + skipSwitcher: config.skipSwitcher, tiledKeepBelow: config.tiledKeepBelow, maximizedKeepAbove: config.floatingKeepAbove, }, diff --git a/src/world/clientState/Tiled.ts b/src/world/clientState/Tiled.ts index 43fc5b8..ff0f7fa 100644 --- a/src/world/clientState/Tiled.ts +++ b/src/world/clientState/Tiled.ts @@ -1,9 +1,11 @@ namespace ClientState { export class Tiled implements State { public readonly window: Window; + private readonly defaultState: { skipSwitcher: boolean }; private readonly signalManager: SignalManager; constructor(world: World, client: ClientWrapper, grid: Grid) { + this.defaultState = { skipSwitcher: client.kwinClient.skipSwitcher }; Tiled.prepareClientForTiling(client, grid.config); const column = new Column(grid, grid.getLastFocusedColumn() ?? grid.getLastColumn()); @@ -21,7 +23,7 @@ namespace ClientState { const client = window.client; window.destroy(passFocus); - Tiled.restoreClientAfterTiling(client, grid.config, grid.desktop.clientArea); + Tiled.restoreClientAfterTiling(client, grid.config, this.defaultState, grid.desktop.clientArea); } private static initSignalManager(world: World, window: Window) { @@ -143,6 +145,9 @@ namespace ClientState { } private static prepareClientForTiling(client: ClientWrapper, config: LayoutConfig) { + if (config.skipSwitcher) { + client.kwinClient.skipSwitcher = true; + } if (config.tiledKeepBelow) { client.kwinClient.keepBelow = true; } @@ -153,7 +158,10 @@ namespace ClientState { client.setMaximize(false, false); } - private static restoreClientAfterTiling(client: ClientWrapper, config: LayoutConfig, screenSize: QRect) { + private static restoreClientAfterTiling(client: ClientWrapper, config: LayoutConfig, defaultState: { skipSwitcher: boolean }, screenSize: QRect) { + if (config.skipSwitcher) { + client.kwinClient.skipSwitcher = defaultState.skipSwitcher; + } if (config.tiledKeepBelow) { client.kwinClient.keepBelow = false; }