From 60759c142ea143257c5402312ae3dfc4f20f10c2 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Mon, 10 Apr 2023 01:55:48 +0200 Subject: [PATCH] Increase window size on enable min size --- src/main/mainWindow.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/mainWindow.ts b/src/main/mainWindow.ts index d6d8c37..6188472 100644 --- a/src/main/mainWindow.ts +++ b/src/main/mainWindow.ts @@ -214,7 +214,18 @@ function initWindowBoundsListeners(win: BrowserWindow) { function initSettingsListeners(win: BrowserWindow) { Settings.addChangeListener("disableMinSize", disable => { - win.setMinimumSize(disable ? 1 : MIN_WIDTH, disable ? 1 : MIN_HEIGHT); + if (disable) { + // 0 no work + win.setMinimumSize(1, 1); + } else { + win.setMinimumSize(MIN_WIDTH, MIN_HEIGHT); + + const { width, height } = win.getBounds(); + win.setBounds({ + width: Math.max(width, MIN_WIDTH), + height: Math.max(height, MIN_HEIGHT) + }); + } }); }