From 0ad2d2162eb328860a924fe19698ea1716b226b6 Mon Sep 17 00:00:00 2001 From: beyondkmp Date: Mon, 19 May 2025 17:14:55 +0800 Subject: [PATCH] feat: add zoom factor handling on window restore in WindowService (#6169) Co-authored-by: beyondkmp --- src/main/services/WindowService.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/services/WindowService.ts b/src/main/services/WindowService.ts index f033cc82bf..ba508d7048 100644 --- a/src/main/services/WindowService.ts +++ b/src/main/services/WindowService.ts @@ -76,6 +76,7 @@ export class WindowService { webSecurity: false, webviewTag: true, allowRunningInsecureContent: true, + zoomFactor: configManager.getZoomFactor(), backgroundThrottling: false } }) @@ -185,6 +186,12 @@ export class WindowService { mainWindow.webContents.setZoomFactor(configManager.getZoomFactor()) }) + // set the zoom factor again when the window is going to restore + // minimize and restore will cause zoom reset + mainWindow.on('restore', () => { + mainWindow.webContents.setZoomFactor(configManager.getZoomFactor()) + }) + // ARCH: as `will-resize` is only for Win & Mac, // linux has the same problem, use `resize` listener instead // but `resize` will fliker the ui