Skip to content

feat(desktop): add Ctrl/Cmd + mouse wheel zoom support - #40401

Closed
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:feat/desktop-mouse-wheel-zoom
Closed

feat(desktop): add Ctrl/Cmd + mouse wheel zoom support#40401
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:feat/desktop-mouse-wheel-zoom

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

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

  • ✨ New feature (non-breaking change that adds functionality)

Changes Made

  • apps/desktop/electron/main.cjs: Extended installZoomShortcuts() with two complementary mechanisms:
    • Main process: input-event listener on webContents detects mouseWheel events with Ctrl/Cmd held and adjusts zoomLevel (same 0.1 step as keyboard shortcuts)
    • Renderer: DOM wheel listener injected via did-finish-load prevents native scroll when modifier is held, so only zoom happens (not both zoom + scroll)

How to Test

  1. Open Hermes Desktop
  2. Hold Ctrl (Windows/Linux) or Cmd (macOS) and scroll the mouse wheel up → should zoom in
  3. Hold Ctrl/Cmd and scroll the mouse wheel down → should zoom out
  4. Release the modifier and scroll → should scroll normally (no zoom)
  5. Verify keyboard shortcuts (Ctrl/Cmd + +/-/0) still work as before
  6. Test on all three platforms (macOS, Windows, Linux) if possible

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (feat(desktop):)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've considered cross-platform impact (Windows, macOS, Linux) — the modifier detection uses IS_MAC ? input.meta : input.control matching existing keyboard zoom behavior

Documentation & Housekeeping

  • I've updated relevant documentation — or N/A (zoom gesture is self-discoverable, no docs needed)
  • I've updated cli-config.yaml.example — or N/A (no config changes)
  • I've considered cross-platform impact — modifier key detection is platform-aware

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
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have labels Jun 6, 2026
@liuhao1024

Copy link
Copy Markdown
Contributor Author

Closing as self-duplicate of #40414, which has the same fix plus IPC channel and type declarations for a more complete implementation.

@liuhao1024 liuhao1024 closed this Jun 7, 2026
@liuhao1024

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Desktop UX]: Support Ctrl/Cmd + mouse wheel zoom

2 participants