Skip to content

feat(desktop): custom zoom shortcuts at half default step - #37894

Merged
ethernet8023 merged 1 commit into
mainfrom
feat/desktop-ctrl-zoom
Jun 3, 2026
Merged

feat(desktop): custom zoom shortcuts at half default step#37894
ethernet8023 merged 1 commit into
mainfrom
feat/desktop-ctrl-zoom

Conversation

@ethernet8023

@ethernet8023 ethernet8023 commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds custom Ctrl/Cmd + +/-/0 zoom handling to the desktop Electron app that uses half the default zoom step (0.1 instead of Chromium's built-in 0.2 per keypress). This makes zooming feel more granular and less jumpy.

The default Electron zoomIn/zoomOut/resetZoom menu roles and Chromium's built-in keyboard handler both use a 0.2 zoom-level step. This PR replaces them with explicit setZoomLevel() calls that step by 0.1, giving users finer control.

Type of Change

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

Changes Made

  • apps/desktop/electron/main.cjs — Replaced { role: 'resetZoom' }, { role: 'zoomIn' }, { role: 'zoomOut' } View menu items with custom click handlers that use webContents.setZoomLevel() with a 0.1 step (clamped to ±9)
  • apps/desktop/electron/main.cjs — Added installZoomShortcuts(window) that intercepts Ctrl/Cmd + =/+/-/0 via before-input-event and applies the same 0.1 step. Required on Linux/Windows where the application menu is null and Chromium would otherwise handle the shortcut with its default 0.2 step.
  • apps/desktop/electron/main.cjs — Wired installZoomShortcuts(mainWindow) into the window setup alongside the other install* calls.

How to Test

  1. Launch the desktop app (hermes --desktop or from the built electron package)
  2. Press Ctrl+Plus (or Cmd+Plus on macOS) — observe the UI zooms in by a small increment
  3. Press Ctrl+Minus — observe the UI zooms out by the same small increment
  4. Press Ctrl+0 — observe the zoom resets to default (level 0)
  5. On macOS, the View menu items (Actual Size / Zoom In / Zoom Out) should also use the same half-step increment
  6. Verify that holding Ctrl+Plus several times gradually zooms in more smoothly than before (0.1 steps vs 0.2)

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • 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 run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Linux (NixOS)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Replace Electron's built-in zoomIn/zoomOut/resetZoom menu roles with
custom implementations that use a 0.1 zoom-level step instead of
Chromium's default 0.2. This makes Ctrl/Cmd + +/-0 zoom feel more
granular and less jumpy.

Also adds installZoomShortcuts() which intercepts the keyboard shortcuts
via before-input-event. This is necessary on Linux/Windows where the
application menu is set to null, so Chromium's default handler would
otherwise apply the full 0.2 step.
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: feat/desktop-ctrl-zoom vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9707 on HEAD, 9707 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5029 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@ethernet8023
ethernet8023 requested a review from OutThisLife June 3, 2026 05:06
@ethernet8023
ethernet8023 enabled auto-merge (rebase) June 3, 2026 05:06
@ethernet8023
ethernet8023 merged commit e618cbe into main Jun 3, 2026
20 checks passed
@ethernet8023
ethernet8023 deleted the feat/desktop-ctrl-zoom branch June 3, 2026 05:07
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.

1 participant