feat(desktop): support Ctrl/Cmd + mouse wheel zoom (#40295) - #67029
Merged
Conversation
Ground-truth reapply of PR #40414 by @liuhao1024. The original branch predates the ts-ify migration and implemented the gesture by injecting a DOM wheel listener via executeJavaScript + a new IPC channel. Current Electron surfaces the modifier+wheel gesture natively as the main-process webContents 'zoom-changed' event, so the salvage uses that instead: no renderer injection, no new preload surface, no new IPC channel. The handler routes through setAndPersistZoomLevel — the same persist+notify funnel as the keyboard shortcuts — so wheel zoom uses the same 0.1 half-step, persists to zoom-state.json across restarts, and keeps the settings Scale control in sync. Session windows get the gesture automatically via wireCommonWindowHandlers; the pet overlay stays opted out via zoomWiringForWindowKind.
Collaborator
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Salvage of #40414 (@liuhao1024) — Ctrl/Cmd + mouse wheel now zooms Hermes Desktop, the standard gesture missing next to the existing keyboard shortcuts and View menu zoom. Closes #40295.
Approach (ground-truth reapply)
The original branch predates the ts-ify migration and implemented the gesture by injecting a DOM wheel listener via
executeJavaScriptplus a new IPC channel + preload method. Current Electron surfaces modifier+wheel natively as the main-processwebContentszoom-changedevent, so the salvage uses that instead — no renderer injection, no new preload/IPC surface, 12 lines instead of ~50.Changes
apps/desktop/electron/main.ts:zoom-changedhandler ininstallZoomShortcuts, routing throughsetAndPersistZoomLevel— the same persist+notify funnel as the keyboard shortcuts. Same 0.1 half-step, persists tozoom-state.jsonacross restarts, settings Scale control stays in sync.wireCommonWindowHandlers; the pet overlay stays opted out viazoomWiringForWindowKind.Validation
Credit: @liuhao1024 (#40414), authorship preserved on the commit.
Infographic