# feat\(web\): configurable browser defaults in Settings → Integrations · PR \#7082 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/7082)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: merged

Source repository: pingdotgg/t3code

Source branch: browser-viewport-defaults

Target branch: main

Head commit: 6489255f56d9ac7435a7189f827a687c1650ab93

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/7082)

[Commits](https://git.cafe/pingdotgg/t3code/pull/7082/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/7082/diffs?format=markdown)

## Description

---

Adds a **Settings → Integrations** page whose first section is **Browser**, holding the defaults a preview tab opens at.

The preview browser always opened in fill mode, at 100% zoom, following the system appearance, with no way to say otherwise. That's rarely what you want if you work in responsive mode against a handful of known viewports.

## What's configurable

| Setting | Options |
|---|---|
| Default viewport | Fill panel, Responsive (custom W×H), or any device preset — with an orientation toggle |
| Default zoom | Chrome's zoom ladder, 25%–500% |
| Default appearance | System / Light / Dark |
| Auto-show floating preview | Whether an agent-opened preview pops the floating player into view |

## Notes for review

**Defaults apply at creation, not after.** The viewport travels with `preview.open` and zoom/appearance with `createTab`. Applying them post-registration would paint one frame at 100%/system first — a visible flash on every tab open.

**Both entry points collapse onto one setting.** This removes an existing inconsistency where hand-opened tabs fell back to 1024×768 and agent-opened tabs to 1280×800. Agents keep a 1280×800 fallback, but only when no default is configured: a fill-mode tab is sized by whatever the panel happens to be, and agents assert against what they open.

**Rotation preserves preset identity.** `resolvePreviewViewport` already stores rotated presets as the id plus swapped dimensions, so a rotated iPad Mini stays an iPad Mini rather than decaying into a custom size.

**Dimensions commit on blur,** via `onValueCommitted`. Typing `2560` passes through `256`, itself a legal dimension, so a change-handler would persist that intermediate size and rewrite settings on every keystroke.

**Web clients get the defaults disabled,** framed as one dimmed block. They're client-local settings for a Chromium guest only the desktop app hosts — editing them from a browser tab would write preferences belonging to a different client, reading as though the desktop app had been configured when it hadn't. Disabled rather than hidden so the reason is visible.

## Testing

Typecheck and lint clean; full suite passing. Exercised in a running dev instance: all controls work, values round-trip through a reload, and settings search indexes every row.

Not covered: a desktop tab actually opening at the configured size. The preview is desktop-only and I verified the settings layer in a web build. The consumption path is traced — `registerWebview` re-asserts from tab state and `navigate` preserves both fields, so only `closeTab` resets — but that's inspection, not a runtime check.


<!-- Macroscope's pull request summary starts here -->
<!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. -->
<!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. -->
> [!NOTE]
> ### Add configurable browser defaults (viewport, zoom, appearance, floating preview) to Settings → Integrations
> - Adds a new `/settings/integrations` route and `IntegrationsSettingsPanel` with a Browser section where users can configure default viewport, zoom, appearance, and auto-show floating preview behavior; controls are disabled outside Electron.
> - Stores the four new browser defaults in `ClientSettingsSchema` and includes them in the "Restore Defaults" flow and settings search.
> - New preview sessions (opened via automation or manually) now use the user's configured default viewport instead of always defaulting to fill; `shouldOpenPreviewMiniPlayer` respects the `autoShowFloatingPreview` preference when the agent doesn't explicitly specify open/show.
> - `acquireDesktopTab` delays tab creation until client settings are hydrated and passes initial zoom and color scheme to `createTab`, so tabs no longer start at 100% zoom with the system appearance before defaults are applied.
> - `normalizePreviewOpenInput` no longer forces `open: true` by default — both `open` and `show` remain unset when neither is provided by the agent.
>
> <!-- Macroscope's review summary starts here -->
>
> <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 6489255.</sup>
> <!-- Macroscope's review summary ends here -->
>
<!-- Macroscope's pull request summary ends here -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches preview open/automation, desktop IPC tab creation, and server MCP normalization across many entry points; behavior changes for agent floating preview and initial viewport sizing, though defaults are conservative and explicit agent flags still win.
> 
> **Overview**
> Adds **Settings → Integrations → Browser** so users can set default preview **viewport**, **zoom**, **appearance**, and whether agent opens should **auto-show the floating preview**. These live in new client settings fields and apply when a tab is opened without its own size or visibility.
> 
> **Defaults are applied at creation** so tabs do not flash at 100% zoom / system theme or reflow from fill mode: viewport goes on `preview.open`, zoom and color scheme on desktop `createTab` (with zoom clamped to the preset ladder). Imperative open paths **await client settings hydration** before reading defaults.
> 
> **Hand-opened tabs and agent `preview_open`** both use the same configured viewport; the server no longer defaults `open` to `true`, so unstated agent visibility follows **`browserAutoShowFloatingPreview`** on the desktop client. Agent tabs still get a fixed **1280×800** fallback only when the session is still in fill mode after open.
> 
> Device-toolbar toggle from fill mode now uses the configured default viewport when set; restore-dirty detection uses structural viewport equality. Web builds show the controls disabled in a framed block; settings search and restore include the new rows.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6489255f56d9ac7435a7189f827a687c1650ab93. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
