Repository navigation
feat(desktop): add a zoom setting that persists - #59277
Conversation
There was a problem hiding this comment.
The change looks sound. I couldn't run the desktop app here because Electron doesn't start in this sandbox, so I checked it by reading the code and running the tests and type checks. The desktop tests pass, the two changed packages/app test files pass, tsc -b is clean in packages/app and packages/desktop, and electron-vite build succeeds. Stepping between levels allows for the small error in factors read back from Chromium. Saved levels are applied to every window and to the startup window. Pinch zoom stays unsaved and returns to the saved level when turned off.
Public API: unchanged. The new WindowGetZoomLevel/WindowSetZoomLevel calls, the level field on WindowZoomChanged and the zoomLevel key in the desktop settings store are all internal to the desktop app and only add to it.
No blocking concerns. The macOS View menu accelerators are still unverified, as the description says; a quick check on a Mac before merging would cover that.
There was a problem hiding this comment.
The new commit is a behaviour-preserving cleanup, and I have nothing new to raise. The macOS/Windows frame options are now shared in platformFrame() and produce the same options as before, including the Windows titlebar overlay sized by zoom. The saved background colour is read through savedBackgroundColor(), and the rest are lint fixes. On the new head, tsc -b is clean in packages/desktop and packages/app, the desktop tests and the two changed app test files pass, and electron-vite build succeeds. I still couldn't drive the app itself because Electron doesn't start in this sandbox.
Public API: unchanged.
Issue for this PR
Closes #50168
Also covers the zoom part of #55152 (fixed steps that persist); the resizable input box there is separate.
Type of change
What does this PR do?
Adds a Zoom select to Settings → Appearance, above Reduce motion. It's desktop only and offers Slack's zoom levels from 100% up: 100, 110, 125, 150, 175 and 200%. It does not add a font-size setting. The select changes the window zoom, so text, controls and layout scale together.
zoomLevel). Every new window and the early startup window open at that level, so it survives reloads and restarts. Before this,wireZoomreset every window to 100%.+,-and0, plus View → Zoom In / Zoom Out / Actual Size, move to the next level up or down and save it. They used to add or subtract 20% and didn't save anything.zoomIn/zoomOut/resetZoomroles. Those step Chromium's zoom on their own and bypass our handler. They now run the same actions as Windows, withCmd+=,Cmd+-andCmd+0as accelerators.WindowGetZoomLevelandWindowSetZoomLevelonly accept the six levels; the schema rejects anything else.WindowZoomChangednow also carries the savedlevel, so the select follows shortcut changes made in any window.This overlaps with community PRs #56802 and #50169, which save whatever zoom factor was last used, including pinch zoom.
How did you verify your code works?
bun run typecheckinpackages/appandpackages/desktop.bun testinpackages/desktop(221 pass).desktop-menu.test.ts(new table for level stepping, including Chromium factors that come back slightly off a level) andsearch-results.test.ts(the setting only shows up in desktop settings search).electron-vite build) and drove it on Linux under Xvfb with an isolated profile over CDP:devicePixelRatio1.25,zoomLevel: 1.25saved, select shows 125%.Screenshots / recordings
GitHub image upload isn't available to the bot; a screenshot of the Zoom row and its options (Linux build) was shared in the requesting Slack thread.
Visual
Checklist
Requested by: @vimtor (victor via Slack)
Added by the opencode bot (AI-generated).
Related: #55152, #49375, #46958