add skipSwitcher setting

This commit is contained in:
Peter Fajdiga
2023-09-29 08:50:54 +02:00
parent 43f425c868
commit 3373e02658
7 changed files with 30 additions and 6 deletions

View File

@@ -245,8 +245,15 @@
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="kcfg_skipSwitcher">
<property name="text">
<string>Tiled windows skip switcher</string>
</property>
</widget>
</item>
<item row="14" column="1">
<spacer name="separator_layering">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -262,21 +269,21 @@
</property>
</spacer>
</item>
<item row="14" column="0">
<item row="15" column="0">
<widget class="QLabel" name="label_layering">
<property name="text">
<string>Layering mode:</string>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="15" column="1">
<widget class="QRadioButton" name="kcfg_tiledKeepBelow">
<property name="text">
<string>Keep tiled windows below</string>
</property>
</widget>
</item>
<item row="15" column="1">
<item row="16" column="1">
<widget class="QRadioButton" name="kcfg_floatingKeepAbove">
<property name="text">
<string>Keep floating windows above</string>

View File

@@ -11,6 +11,7 @@ type Config = {
stackColumnsByDefault: boolean,
resizeNeighborColumn: boolean,
reMaximize: boolean,
skipSwitcher: boolean,
tiledKeepBelow: boolean,
floatingKeepAbove: boolean,
windowRules: string,

View File

@@ -112,6 +112,11 @@ const configDef = [
"type": "Bool",
"default": false
},
{
"name": "skipSwitcher",
"type": "Bool",
"default": false
},
{
"name": "tiledKeepBelow",
"type": "Bool",

View File

@@ -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;

View File

@@ -4,6 +4,7 @@ type LayoutConfig = {
stackColumnsByDefault: boolean,
resizeNeighborColumn: boolean,
reMaximize: boolean,
skipSwitcher: boolean,
tiledKeepBelow: boolean,
maximizedKeepAbove: boolean,
};

View File

@@ -36,6 +36,7 @@ class World {
stackColumnsByDefault: config.stackColumnsByDefault,
resizeNeighborColumn: config.resizeNeighborColumn,
reMaximize: config.reMaximize,
skipSwitcher: config.skipSwitcher,
tiledKeepBelow: config.tiledKeepBelow,
maximizedKeepAbove: config.floatingKeepAbove,
},

View File

@@ -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;
}