feat(desktop): add Ctrl/Cmd + mouse wheel zoom support - #40401
Closed
liuhao1024 wants to merge 1 commit into
Closed
Conversation
Add mouse wheel zoom gesture to Hermes Desktop. When the user holds Ctrl (Windows/Linux) or Cmd (macOS) and scrolls the mouse wheel, the app zooms in/out with the same 0.1 step used by keyboard shortcuts. Implementation uses two complementary mechanisms: - Main process: input-event listener on webContents detects mouseWheel events with modifier key held and adjusts zoomLevel accordingly - Renderer: DOM wheel listener injected via did-finish-load prevents native scroll when Ctrl/Cmd is held, so only zoom happens Fixes NousResearch#40295
Contributor
Author
|
Closing as self-duplicate of #40414, which has the same fix plus IPC channel and type declarations for a more complete implementation. |
Contributor
Author
|
Self-duplicate of #40414 which includes the same main.cjs fix plus preload.cjs IPC channel and global.d.ts type declarations for a more complete implementation. |
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.
What does this PR do?
Adds Ctrl/Cmd + mouse wheel zoom support to Hermes Desktop. When the user holds Ctrl (Windows/Linux) or Cmd (macOS) and scrolls the mouse wheel, the app zooms in/out with the same 0.1 step used by keyboard shortcuts.
This is a standard desktop/browser UX pattern that users expect — most text-heavy applications support this gesture for quick zoom adjustments.
Related Issue
Fixes #40295
Type of Change
Changes Made
apps/desktop/electron/main.cjs: ExtendedinstallZoomShortcuts()with two complementary mechanisms:input-eventlistener onwebContentsdetectsmouseWheelevents with Ctrl/Cmd held and adjustszoomLevel(same 0.1 step as keyboard shortcuts)wheellistener injected viadid-finish-loadprevents native scroll when modifier is held, so only zoom happens (not both zoom + scroll)How to Test
Checklist
Code
feat(desktop):)IS_MAC ? input.meta : input.controlmatching existing keyboard zoom behaviorDocumentation & Housekeeping
cli-config.yaml.example— or N/A (no config changes)