Skip to content

fix(desktop): stabilize Windows titlebar zoom#25813

Merged
Hona merged 2 commits intoanomalyco:devfrom
Hona:fix/windows-titlebar-zoom-overlay
May 5, 2026
Merged

fix(desktop): stabilize Windows titlebar zoom#25813
Hona merged 2 commits intoanomalyco:devfrom
Hona:fix/windows-titlebar-zoom-overlay

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented May 5, 2026

Summary

  • Keep Windows titlebar layout and native controls stable while zooming the Electron webview.
  • Resize the Windows titlebar overlay with zoom-in while clamping native chrome at small zoom levels.
  • Defer renderer zoom state updates until Electron applies the webContents zoom to avoid titlebar snap/flicker.

Testing

  • bun typecheck in packages/app
  • bun typecheck in packages/desktop-electron

@Hona Hona requested a review from adamdotdevin as a code owner May 5, 2026 04:08
Copilot AI review requested due to automatic review settings May 5, 2026 04:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves zoom behavior in the desktop Electron app to keep the Windows titlebar overlay and caption controls visually stable during zoom changes, and to reduce snap/flicker by aligning renderer zoom state updates with Electron zoom application.

Changes:

  • Deferred renderer-side webviewZoom signal updates until after setZoomFactor completes, while tracking the last requested zoom.
  • Added Windows titlebar overlay resizing logic based on the current zoom factor, and refreshed overlay on zoom changes.
  • Updated the app titlebar layout on Windows to account for zoom (including counter-zooming and native controls spacing).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/desktop-electron/src/renderer/webview-zoom.ts Tracks requested zoom and delays reactive zoom state updates until IPC completes.
packages/desktop-electron/src/main/windows.ts Persists titlebar theme per window and recalculates overlay height based on zoom factor.
packages/desktop-electron/src/main/ipc.ts Updates the Windows titlebar overlay when zoom is set via IPC.
packages/app/src/components/titlebar.tsx Adjusts Windows titlebar layout/spacing for zoom and introduces counter-zooming for small zoom levels.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +27
void window.api.setZoomFactor(next).then(() => {
if (requestedZoom !== next) return
setWebviewZoom(next)
})
const minHeight = () => (mac() ? `${40 / zoom()}px` : undefined)
const titlebarZoom = () => (windows() ? Math.max(zoom(), minTitlebarZoom) : zoom())
const counterZoom = () => (windows() && titlebarZoom() < 1 ? 1 / titlebarZoom() : 1)
const minHeight = () => (mac() || windows() ? `${titlebarHeight / Math.min(titlebarZoom(), 1)}px` : undefined)
@Hona Hona enabled auto-merge (squash) May 5, 2026 04:19
@Hona Hona merged commit 07f1c8c into anomalyco:dev May 5, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants