Skip to content

feat(desktop): Zoom the desktop app like a browser - #12

Open
fismif wants to merge 3 commits into
eclipse-enclave:mainfrom
fismif:main
Open

fismif wants to merge 3 commits into
eclipse-enclave:mainfrom
fismif:main

Conversation

@fismif

@fismif fismif commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What and why

The desktop app had no zoom: a bare system webview ignores the browser zoom shortcuts. An injected script now catches them and sets the webview's native zoom, 50–300% in 10% steps. The level is kept between launches in a file the desktop app owns, not in the daemon's settings. Closes #11.

keydown / Ctrl+wheel / pinch          (desktop/internal/zoom Script)
  window.homeshellZoom(step)          bound Go function, main thread
    zoom.Next(level, step)            clamp, 10% grid
    setZoom(window, level)            WebKitGTK zoom level / WKWebView.pageZoom
    Store.Save(level)                 <config dir>/homeshell-desktop/desktop.json
Input Linux macOS
In / out / reset Ctrl + = + / - _ / 0 Cmd + the same keys
Wheel / pinch Ctrl + wheel Ctrl + wheel, pinch
  • On macOS, Ctrl + these keys still reach the page (e.g. a terminal), as in Safari.
  • Pinch zooms while the fingers move, one step per factor of 1.1 in scale, so pinching out and in by the same factor steps the same amount.
  • homeshell-desktop/, not homeshell/: on macOS the latter is the daemon's data directory.

Evidence (Linux, real window via xdotool, level read back from desktop.json):

  • Before: Ctrl+= did nothing.
  • After: Ctrl+= ×2 → 1.2, Ctrl+Shift+- → 1.1, Ctrl+0 → 1.0, Ctrl+wheel up → 1.1.
    The level is restored on relaunch.

Not run on a Mac: pinch is untested by hand. desktop/cmd/** now triggers the Release Assets Smoke Test, so this PR compiles zoom_darwin.go on macOS. No e2e test: Playwright drives Chromium and cannot reach the native webview. The injected script runs under Node in a table-driven Go test (TestScript) instead.

Merge danger: two-way door, desktop app only. No daemon, API or webapp change. The smoke test now also runs on PRs touching desktop/cmd/.

Changelog

- The desktop app zooms like a browser: Ctrl + `+`/`-`/`0` (Cmd on macOS), Ctrl + mouse wheel
  and pinch. The zoom level is kept between launches.

Checklist

  • Tests added: unit and e2e, or a regression test for a bug fix (see AGENTS.md) (unit only, see above)
  • Docs updated per the trigger table in AGENTS.md

Ctrl/Cmd + =/+/-/0, Ctrl + wheel and pinch set the webview's native zoom
(50-300% in 10% steps), and the level is kept between launches in
homeshell/desktop.json under the user config directory.

Closes eclipse-enclave#11
@fismif

fismif commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@EclipseSourceAI

@EclipseSourceAI EclipseSourceAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Autonomous AI review. May contain mistakes.

Useful comment? React 👍. Disagree? React 👎 to reject it for follow-up reviews. A reply explaining why helps too.

This agent never approves PRs. A maintainer must sign off.

Only a maintainer can re-request a review from this agent.

Powered by Eclipse Enclave via review-guard-mcp

This PR adds browser-style zoom to the desktop app. A script injected with window.Init catches the zoom keys, Ctrl+wheel and macOS pinch, and calls a bound Go function (homeshellZoom). That function steps the level on a 10% grid (zoom.Next), sets the webview's native zoom through a small cgo shim per platform (WebKitGTK set_zoom_level / WKWebView pageZoom) and saves the level to desktop.json. Nothing changes in the daemon, the API or the webapp.

What I checked

  • Native handles: against the pinned webview_go (6173450d4dd6), the shims reach the right objects. GTK adds the WebKitWebView as the window's only child. Cocoa makes the WKWebView the content view, and does that inside the constructor, so restoring the zoom before SetHtml works on macOS too.
  • Linux build: the webkit2gtk-4.0 directive goes through the existing pkg-config shim, so it links 4.1 like webview_go itself does.
  • Injected script: I ran it under Node with edge cases. Keys and wheel behave as described.
  • UI test: I didn't run a Playwright check. It drives Chromium and can't reach the native webview, as the PR says.

Where a maintainer should look

  • macOS: nothing compiles zoom_darwin.go on this PR (see inline). Nobody has run it on a Mac, and pinch is untested.
  • Where the zoom file lives: on macOS, desktop.json lands in the daemon's data directory. On Linux it goes to a different location (~/.config/homeshell).
  • Smaller points: pinch steps aren't symmetric between zooming in and out, and the webkit 4.0 shim's TODO needs to mention this new directive.

Comment thread desktop/internal/zoom/zoom.go Resolved
Comment thread desktop/internal/zoom/zoom.go Resolved
Keep desktop.json in its own homeshell-desktop directory, since on macOS
homeshell/ is the daemon's data directory. Step pinch zoom by factors of
1.1 so in and out are symmetric, and zoom while the fingers move. Build
desktop/cmd/ in the release assets smoke test, the only PR build of the
macOS code. Note the zoom shim in the webkit2gtk-4.0 shim's TODO.

@EclipseSourceAI EclipseSourceAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Autonomous AI review. May contain mistakes.

Useful comment? React 👍. Disagree? React 👎 to reject it for follow-up reviews. A reply explaining why helps too.

This agent never approves PRs. A maintainer must sign off.

Only a maintainer can re-request a review from this agent.

Powered by Eclipse Enclave via review-guard-mcp

Follow-up review: the only commit since my last pass (9b86f24) is exactly the fix-up for the four points I raised, nothing else changed.

I checked each fix against the code instead of just taking the reply at face value:

  • desktop.json now lives under homeshell-desktop/ on both platforms, confirmed by the new TestDefaultStoreHasItsOwnDirectory test and the os.UserConfigDir() call.
  • Pinch zoom now steps by log(scale)/log(1.1), so 3x and 1/3x both give 12 steps (verified the math directly with node -e), and it now reacts on gesturechange for live feedback. The new TestScript cases match this behavior exactly.
  • release-assets-smoke.yml now triggers on desktop/cmd/**, so the macOS cgo code gets a PR build.
  • The webkit2gtk-4.0.pc shim's TODO now mentions zoom_linux.go as a second consumer to update when the shim is removed.

No new issues found in the delta. No inline comments this round.

These previous comments can be resolved as they are now handled:

I can't resolve them myself as I would need write permission on this repository.

@fismif
fismif marked this pull request as ready for review November 13, 2026 15: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.

Zooming in the desktop app

2 participants