feat(settings): add a display-size selector for the WhatsApp webview - #20
Open
maerlin wants to merge 1 commit into
Open
feat(settings): add a display-size selector for the WhatsApp webview#20maerlin wants to merge 1 commit into
maerlin wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).
zoomfactor insettings.json, defaulting to 1.0, so existing files keep today's behaviour with no migration.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.changerather than waiting for Save, since a size you have not seen is a guess.Robustness:
zoomis clamped to 0.5–2.0 on load and on save, and a non-finite value falls back to 1.0, so a hand-editedsettings.jsoncannot leave the app at a size you cannot read your way back out of.The select gets
appearance: noneplus an inline-SVG chevron: a native popup button carries fixed control metrics and ignores most of the.fieldpadding, so it rendered visibly shorter than the text inputs beside it.Testing
settings.rscovering the presets, clamping, non-finite input, and an oldersettings.jsonwith nozoomkey. Full suite: 70 pass.cargo fmt --checkclean.set_zoomis Tauri's own cross-platform API and there is no platform-specific code in this change.