From c9aa8498c7a66b792768768c116098eef77e1bab Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Tue, 1 Jul 2025 14:03:08 -0400 Subject: [PATCH] fix(desktop): save zoom level to state when it is adjusted (#15406) --- apps/desktop/src/main/window.main.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/desktop/src/main/window.main.ts b/apps/desktop/src/main/window.main.ts index 4d9438b588d..5b81cf8140b 100644 --- a/apps/desktop/src/main/window.main.ts +++ b/apps/desktop/src/main/window.main.ts @@ -295,6 +295,15 @@ export class WindowMain { this.win.webContents.zoomFactor = this.windowStates[mainWindowSizeKey].zoomFactor ?? 1.0; }); + // Persist zoom changes immediately when user zooms in/out or resets zoom + // We can't depend on higher level web events (like close) to do this + // because locking the vault resets window state. + this.win.webContents.on("zoom-changed", async () => { + const newZoom = this.win.webContents.zoomFactor; + this.windowStates[mainWindowSizeKey].zoomFactor = newZoom; + await this.desktopSettingsService.setWindow(this.windowStates[mainWindowSizeKey]); + }); + if (this.windowStates[mainWindowSizeKey].isMaximized) { this.win.maximize(); }