Skip to content

feat(core): add window zoom status bar item and fix secondary window zoom#17164

Merged
ndoschek merged 3 commits intomasterfrom
nd/window-zoom-status-bar-item
Mar 18, 2026
Merged

feat(core): add window zoom status bar item and fix secondary window zoom#17164
ndoschek merged 3 commits intomasterfrom
nd/window-zoom-status-bar-item

Conversation

@ndoschek
Copy link
Copy Markdown
Member

What it does

Resolves GH-17163
Resolves GH-11843

Zoom status bar item:

  • Adds a prominent status bar item with a zoom-in/zoom-out icon when the window zoom level is not at default
  • Provides an interactive tooltip with zoom controls (+/-, reset, open preferences)
  • Extracts window zoom preference keys as reusable constants
  • Updates the zoom level preference description with accurate localization and step size (~10% per 0.5 step)
  • Extracts Chromium's zoom base factor (1.2) as a named constant (ZoomLevel.ZOOM_BASE)

Secondary window zoom fix:

  • Routes setZoomLevel IPC via windowName to target specific secondary windows
  • Applies the current zoom level to newly created secondary windows

How to test

  1. Start the Electron example app
  2. Use View > Zoom In / View > Zoom Out (or keybindings) to change the zoom level
  3. Verify a status bar item appears on the right showing a zoom-in or zoom-out icon
  4. Hover over the status bar item and verify the tooltip shows zoom controls (+/-, reset, settings gear) with keybindings
  5. Use the tooltip buttons to zoom in, zoom out, reset, or open preferences
  6. Verify the status bar item disappears when zoom is reset to default (0)
  7. Open a secondary window (e.g., extract a widget) and verify it inherits the current zoom level
  8. Change the zoom level and verify secondary windows update accordingly

Follow-ups

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

Resolves GH-17163

- Show a prominent status bar item with zoom-in/zoom-out icon when zoom level is not default
- Provide interactive tooltip with zoom controls (+/-, reset, open preferences)
- Extract window zoom preference keys as reusable constants
- Update zoom level preference description with correct localization and step size
- Extract Chromium's zoom base factor as a named constant (ZoomLevel.ZOOM_BASE)
Resolves GH-11843

- Route setZoomLevel IPC via windowName to target specific secondary windows
- Apply current zoom level to newly created secondary windows
@github-project-automation github-project-automation Bot moved this to Waiting on reviewers in PR Backlog Mar 16, 2026
@ndoschek ndoschek requested a review from sgraband March 16, 2026 12:02
Copy link
Copy Markdown
Contributor

@sgraband sgraband left a comment

Choose a reason for hiding this comment

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

Thanks for the improvement @ndoschek. Works great! I have a few inline comments and a general remark:

  • imho the dialog should stay open if the + and - buttons are pressed, this way i could increase the zoom multiple times, coudl you check this?
  • Also is there a reason, why the background of this item is different from the other statusbar items (light theme)? (EDIT: i believe this is fixed with #17161, right?)

Comment thread packages/core/src/electron-browser/window/window-zoom-status-bar-item.ts Outdated
if (e.preferenceName === PREF_WINDOW_ZOOM_LEVEL) {
const zoomLevel = this.electronWindowPreferences.get(PREF_WINDOW_ZOOM_LEVEL, 0);
this.updateWindowZoomLevel(zoomLevel);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we dispose this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ElectronSecondaryWindowService is bound as a singleton that lives for the entire application lifecycle, so the preference listener doesn't need explicit disposal - it should remain active as long as the application is running.

Comment thread packages/core/src/electron-browser/window/window-zoom-action-bar.tsx Outdated
@ndoschek
Copy link
Copy Markdown
Member Author

Thanks for the review @sgraband!

Ad 1: I don't think keeping the tooltip open on +/- would actually improve the UX here. Since each zoom step changes the page's zoom level, the status bar item itself shifts position, which means the tooltip would also need to reposition. The user would have to move their mouse to the new location anyway, at which point the tooltip reappears with the updated zoom level. So the current behavior of closing and re-showing on hover feels natural for this case IMO.

Ad 2: The different background is intentional - the item uses the prominent status bar colors, (statusBarItem.prominentBackground / statusBarItem.prominentForeground) to visually highlight that the zoom level is not at its default value. (see also #16877 for details, the workspace trust uses a prominent background as well).

@ndoschek ndoschek marked this pull request as ready for review March 17, 2026 14:43
@ndoschek ndoschek requested a review from sgraband March 17, 2026 14:44
- Use lazy tooltip function to avoid leaking React roots on every zoom change
- Add missing `name` property for accessibility and status bar context menu
- Remove unnecessary empty constructor in WindowZoomActionBar
@ndoschek ndoschek force-pushed the nd/window-zoom-status-bar-item branch from 0ea411b to e662892 Compare March 17, 2026 15:26
Copy link
Copy Markdown
Contributor

@sgraband sgraband left a comment

Choose a reason for hiding this comment

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

Thanks for the explanation! LGTM 👍

@github-project-automation github-project-automation Bot moved this from Waiting on reviewers to Needs merge in PR Backlog Mar 18, 2026
@ndoschek ndoschek merged commit 69d79f2 into master Mar 18, 2026
10 checks passed
@ndoschek ndoschek deleted the nd/window-zoom-status-bar-item branch March 18, 2026 09:08
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Mar 18, 2026
@github-actions github-actions Bot added this to the 1.70.0 milestone Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add window zoom level status bar item Secondary Windows have separate Zoom Level

2 participants