Skip to content

feat(desktop): add Mac-native zoom shortcuts (Cmd+=/-/0)#6

Merged
Genuifx merged 4 commits into
mainfrom
copilot/add-mac-native-shortcut-support
May 19, 2026
Merged

feat(desktop): add Mac-native zoom shortcuts (Cmd+=/-/0)#6
Genuifx merged 4 commits into
mainfrom
copilot/add-mac-native-shortcut-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

The desktop app had no way to scale the UI; users expect the standard macOS zoom keys to work like in native apps and browsers.

Changes

  • useZoom hook (apps/desktop/src/hooks/useZoom.ts)

    • Binds Cmd/Ctrl + = / + (zoom in), Cmd/Ctrl + - (zoom out), Cmd/Ctrl + 0 (reset).
    • Drives zoom through Tauri's built-in getCurrentWebview().setZoom() so the whole webview scales like browser Cmd+/-, rather than via CSS hacks.
    • Clamps to 0.52.0 in 0.1 steps (rounded to avoid float drift), persists to localStorage under ccem-zoom-level, restores on mount.
    • keydown listener registered in capture phase so the shortcuts win against inputs, textareas, terminals, and contenteditable surfaces. Combos including Alt are ignored to avoid clashing with other namespaces.
  • Capability: added core:webview:allow-set-webview-zoom to apps/desktop/src-tauri/capabilities/default.json — required for the JS setZoom IPC call.

  • Wiring: App.tsx calls useZoom() alongside the existing useKeyboardShortcuts. No change to the existing global shortcut map.

// apps/desktop/src/App.tsx
useKeyboardShortcuts(globalShortcuts);
useZoom(); // Cmd+= / Cmd+- / Cmd+0

Notes

  • Persistence is intentionally per-webview (localStorage), not part of ~/.ccem/config.json — this is a UI preference, not cross-CLI config.
  • An earlier iteration used CSS zoom on documentElement; switched to the native Tauri API after confirming it's the supported path.

@Genuifx Genuifx marked this pull request as ready for review May 19, 2026 14:32
@Genuifx Genuifx merged commit a80e6dd into main May 19, 2026
3 checks passed
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.

2 participants