Skip to content

feat(app): zoom the desktop app with Ctrl/⌘ + = and − - #647

Merged
linroid merged 3 commits into
mainfrom
feat/zoom-shortcuts
Oct 29, 2026
Merged

linroid merged 3 commits into
mainfrom
feat/zoom-shortcuts

Conversation

@linroid

@linroid linroid commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Follows #643 (Settings → General → Zoom) for #600. Browsers and Electron apps zoom with Ctrl/⌘ + = and −; Ketch had no such shortcut, so Windows users, who have no menu bar, could only zoom from Settings.

What changes

  • Zoom in (⌘=, Ctrl+=) and Zoom out (⌘−, Ctrl+-) step through the levels Settings offers (90, 100, 110, 125, 150, 175, 200 %). They also step from a zoom between levels (115 → 125 or 110) and stop at the smallest and largest. A hand-written 50 % or 300 % steps back inside and never further out.
  • Like browsers, Zoom in also takes ⌘+ with Shift, the + key of layouts that have one (German, Nordic) and the keypad's + (Zoom out: the keypad's −). These are a new KetchCommand.alternates: the matcher binds them (boundChords), but menus, tooltips and the shortcut sheet show only the main chord.
  • Actual size goes back to 100 %. It has no chord, since ⌘0 already shows Devices.
  • The main and Settings windows run the chords in their window-level onPreviewKeyEvent, so zoom works in both windows and while a text field has focus.
  • macOS: the main window's View menu (and the default menu bar) and a new View menu in the Settings window list Actual size, Zoom in and Zoom out. Each item is disabled where it would change nothing. The menus own ⌘= and ⌘−. AWT hands a key equivalent to both the window and the menu, so the windows skip the keys their menus own (menuKeys), and each press zooms once.
  • The palette and the shortcut sheet list the commands. ShellCommands.binds checks zoomSupported, so phones and the web app don't offer them. In the palette the three commands also match the Zoom setting's name, so "zoom" finds Actual size, and in languages that call the commands something else (Vergrößern, Масштаб…) the setting's name finds them too.
  • ZoomLevels moved from GeneralSettings to state/ZoomLevels.kt. AppSettingsController gains zoomIn, zoomOut, resetZoom, canZoomIn and canZoomOut.
  • Strings in all ten languages, using the usual menu names (Vergrößern, Zoom avant, 拡大, 放大…).

Snapshots

Before After
shortcut sheet before shortcut sheet after
palette before palette after
palette before, dark palette after, dark

The macOS menu bar is native and isn't covered by the snapshot harness.

Tests

  • AppSettingsControllerTest: stepping through every level in both directions, stopping at the ends, from between two levels, from 50 % and 300 %, and reset.
  • KetchCommandsTest (uniqueness, never hiding global chords, printable labels, no Ctrl with primary) now covers bound chords, so the alternates are checked too. New label and alternates tests.
  • ShortcutMatcherTest, ShortcutSheetTest, PaletteProvidersTest, DesktopTrayModelTest (View menu items, enabled states, menuKeys), DesktopCommandsTest and HostShortcutsTest.
  • ./gradlew :app:shared:jvmTest :app:desktop:test pass, and :app:shared:compileKotlinWasmJs :app:shared:compileAndroidMain compile.

Not checked by hand: pressing the keys in a running desktop app on macOS or Windows. The key paths are covered only by the matcher and menu tests above.

Zoom in (⌘=, Ctrl+= on Windows and Linux) and Zoom out (⌘−, Ctrl+-) step
through the zoom levels Settings offers, from a zoom between them too, and
stop at the smallest and largest. Like browsers, Zoom in also takes ⌘+ with
Shift, the + key of layouts that have one and the keypad's + and −; those
alternates run the command without showing in menus, tooltips or the
shortcut sheet. Actual size goes back to 100 % and has no chord, as ⌘0
shows Devices.

The main and Settings windows run the chords before their content, so
zoom works in both and while a field has focus. On macOS both windows'
View menus list the three items, disabled where they would change
nothing, and own ⌘= and ⌘−; the windows leave those keys to the menus so
each press zooms once. The palette and the shortcut sheet list the
commands; phones and the web app do not offer them.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T07:21:31.991803Z 5225b06 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

# Conflicts:
#	app/desktop/src/main/kotlin/com/linroid/ketch/app/desktop/DesktopMenuBar.kt
#	app/desktop/src/main/kotlin/com/linroid/ketch/app/desktop/main.kt
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 2 233 files  ± 0   2 261 suites  ±0   58m 24s ⏱️ + 2m 55s
15 634 tests +23  15 362 ✅ +22  272 💤 +1  0 ❌ ±0 
19 013 runs  +23  18 741 ✅ +22  272 💤 +1  0 ❌ ±0 

Results for commit bbf3c22. ± Comparison against base commit 3d1cf0f.

♻️ This comment has been updated with latest results.

@linroid
linroid merged commit 571394a into main Oct 29, 2026
24 of 27 checks passed
@linroid
linroid deleted the feat/zoom-shortcuts branch October 29, 2026 09:56
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