From 6bce834dee66ef0742f3043693cbd6c2a5d1ee9f Mon Sep 17 00:00:00 2001 From: hitgubian Date: Sun, 17 Nov 2024 08:59:12 -0600 Subject: [PATCH] [Fix] Zoom now always retained after minimize, restore, etc. (#4020) Applied Prettier (again) --- src/backend/main.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/backend/main.ts b/src/backend/main.ts index 32141b8fbb..c79e2ebd04 100644 --- a/src/backend/main.ts +++ b/src/backend/main.ts @@ -268,6 +268,21 @@ async function initializeWindow(): Promise { mainWindow.webContents.setVisualZoomLevelLimits(1, 1) }) + function applyZoom() { + const zoomFactor = processZoomForScreen( + configStore.get('zoomPercent', 100) / 100 + ) + mainWindow.webContents.setZoomLevel(zoomFactor) + mainWindow.webContents.setVisualZoomLevelLimits(1, 1) + } + + mainWindow.on('maximize', applyZoom) + mainWindow.on('unmaximize', applyZoom) + mainWindow.on('restore', applyZoom) + mainWindow.on('enter-full-screen', applyZoom) + mainWindow.on('leave-full-screen', applyZoom) + mainWindow.webContents.on('did-navigate', applyZoom) + return mainWindow }