From 6e9edad39dc372a65602e486b997f46906d34b38 Mon Sep 17 00:00:00 2001 From: Peter Fajdiga Date: Sat, 24 Jun 2023 11:07:53 +0200 Subject: [PATCH] Column: respect min width of windows --- src/layout/Column.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/layout/Column.ts b/src/layout/Column.ts index 212a913..313f94a 100644 --- a/src/layout/Column.ts +++ b/src/layout/Column.ts @@ -6,6 +6,7 @@ class Column { private stacked: boolean; private focusTaker: Window|null; private widthBeforeExpand: number; + private static readonly minWidth = 10; constructor(grid: Grid, prevColumn: Column|null) { this.gridX = 0; @@ -74,12 +75,23 @@ class Column { return this.width; } + getMinWidth() { + let maxMinWidth = Column.minWidth; + for (const window of this.windows.iterator()) { + const minWidth = window.client.kwinClient.minSize.width; + if (minWidth > maxMinWidth) { + maxMinWidth = minWidth; + } + } + return maxMinWidth; + } + getMaxWidth() { return this.grid.tilingArea.width; } setWidth(width: number, setPreferred: boolean) { - width = Math.min(width, this.getMaxWidth()); + width = clamp(width, this.getMinWidth(), this.getMaxWidth()); const oldWidth = this.width; this.width = width; if (setPreferred) {