Skip to content

feat(settings): add a display-size selector for the WhatsApp webview - #20

Open
maerlin wants to merge 1 commit into
karem505:masterfrom
maerlin:feat/display-zoom
Open

feat(settings): add a display-size selector for the WhatsApp webview#20
maerlin wants to merge 1 commit into
karem505:masterfrom
maerlin:feat/display-zoom

Conversation

@maerlin

@maerlin maerlin commented Aug 8, 2026

Copy link
Copy Markdown

Problem

WhatsApp Web sizes its layout in px and has no scaling control of its own, so the chat list occupies the same width whatever the display. On a large high-DPI screen that leaves the conversation pane cramped while the chat list takes a disproportionate share of the window, and nothing inside whatRust could change it.

Change

A Display size selector under Settings → Preferences: Smaller (0.75), Small (0.85), Default (1.0), Big (1.15).

  • Stored as a zoom factor in settings.json, defaulting to 1.0, so existing files keep today's behaviour with no migration.
  • Applied through the webview's own page zoom (WebviewWindow::set_zoom), not a font-size override. A font-size override moves almost nothing on a page that sizes in px; scaling the page is what moves the chat list and the conversation together.
  • Set when an account window is built, and re-applied to every open account window when the setting changes, so a new size takes effect without a restart.
  • Saves on change rather than waiting for Save, since a size you have not seen is a guess.

Robustness:

  • zoom is clamped to 0.5–2.0 on load and on save, and a non-finite value falls back to 1.0, so a hand-edited settings.json cannot leave the app at a size you cannot read your way back out of.
  • The settings UI shows the option nearest the stored value rather than assuming it is one of the four presets.
  • Page zoom needs macOS 11 or later (Tauri's documented constraint); below that the call is a no-op and the window keeps the site's own sizing.

The select gets appearance: none plus an inline-SVG chevron: a native popup button carries fixed control metrics and ignores most of the .field padding, so it rendered visibly shorter than the text inputs beside it.

Testing

  • 4 new unit tests in settings.rs covering the presets, clamping, non-finite input, and an older settings.json with no zoom key. Full suite: 70 pass. cargo fmt --check clean.
  • Built a release bundle and ran it on macOS 15 (Apple Silicon) against a live account: switching size applies immediately across open account windows and survives a restart.
  • Not exercised on Linux or Windows beyond CI's compile; set_zoom is Tauri's own cross-platform API and there is no platform-specific code in this change.

WhatsApp Web sizes its layout in px and has no scaling control of its own, so the chat list occupies the same width whatever the display. On a large high-DPI screen that leaves the conversation pane cramped, and nothing inside whatRust could change it.

Add a Smaller / Small / Default / Big selector under Settings -> Preferences. It is stored as a `zoom` factor in settings.json and applied through the webview's page zoom rather than a font-size override, since a font-size override moves almost nothing on a page that sizes in px.

The zoom is set when an account window is built, and re-applied to every open account window when the setting changes, so a new size takes effect without a restart. It saves on change rather than on Save: you cannot judge a size you have not seen.

`zoom` is clamped to 0.5-2.0 on load and on save, and a non-finite value falls back to 1.0. A hand-edited settings.json therefore cannot leave the app at a size you cannot read your way back out of. Page zoom needs macOS 11 or later; on older systems the window keeps the site's own sizing.
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