t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Desktop BrowserWindow minWidth of 840 breaks half-screen tiling on scaled displays

Open tbcarver opened this issue 2 months ago • 4 comments

Summary

The desktop app's main BrowserWindow is created with minWidth: 840 (currently around line 398 in apps/desktop/src/window/DesktopWindow.ts). This prevents the window from being tiled/snapped to exactly half of the screen on a large number of real-world displays, because the logical (post-DPI-scaling) half-screen width is often below 840px — even on physically large or high-resolution monitors.

This is not a window-manager quirk or an inherent Electron limitation: other Electron apps (e.g. Claude Code, Codex) tile correctly to half-screen on the same machines. The web version of T3 Code also has no such restriction, since it has no native window minimum.

Repro data across multiple machines

  • KDE Linux, 1920 physical px @ 125% scaling → 1536 logical px → half-screen = 768 logical px. Falls short of 840.
  • Windows, Dell XPS 17 (3840×2400 physical) @ 250% scaling → 1536 logical px → half-screen = 768 logical px. Falls short of 840, despite the panel being physically very large.

In both cases the issue is the same: logical half-screen width < 840, driven by the display's scaling factor, not the physical screen size. A physically huge 4K panel can still fail this check if scaling is high enough — which is common.

Why this matters for accessibility, not just small screens

DPI/text scaling isn't only used on small or old displays — many users, including older developers or those with reduced vision, deliberately run higher scaling factors (125–250%) on larger monitors for readable text. Assuming "large physical monitor = enough logical width" doesn't hold for this group. A high minWidth effectively punishes users who scale up for legibility by breaking basic window tiling for them.

Requested change

Lower the native minimum width, e.g.:

- minWidth: 840,
+ minWidth: 600,
  minHeight: 620,

600 comfortably fits half-screen tiling in both scaled scenarios above while still leaving room for the app's UI. Alternatively, consider exposing this as a user-configurable setting rather than a hardcoded constant, since ideal minimums will vary by user/display.

Related

  • #8849 — Text clipped on right edge when window is tiled narrower than 840px (Wayland/Linux)
  • #861 — Desktop app appears too small on high-DPI displays on Windows/Linux

tbcarver avatar Sep 20 '26 19:09 tbcarver

Triage

This is a real desktop window-management bug. Electron BrowserWindow sizes are DIP. On both repros the logical desktop is 1536 wide, so half-screen is 768 — below the hardcoded 840. Taskbar / panel chrome makes the snap target a bit smaller still. Other Electron apps tile on the same machines because they do not set this floor; the web client has no native min at all.

840 is enforced twice, not only at the line cited in the report:

  • apps/desktop/src/window/DesktopWindow.ts (electronWindow.create({ minWidth: 840, minHeight: 620 }))
  • apps/desktop/src/settings/DesktopAppSettings.ts (MIN_MAIN_WINDOW_SIZE.width = 840, used by DesktopWindowBoundsSchema and normalizeMainWindowBounds)

The settings test already drops width: 839 on load (mainWindowBounds becomes null). If only the create option changes, a snapped 768-wide window still fails to persist and restarts at the 1100×780 default.

The number is not arbitrary. The two-pane layout floor is THREAD_SIDEBAR_MIN_WIDTH (208) + THREAD_MAIN_CONTENT_MIN_WIDTH (640) = 848. useIsMobile is max-md (767px). The 768 half-screen users actually get stays in desktop sidebar mode, so main is ~560 — already under the 640 chat floor. Preview + chat + sidebar wants 928. The requested 600 would allow the snap and would also switch the sidebar to the mobile sheet; the restored size after snap is still ~768, where the desktop two-pane layout is already tight.

So this is not a one-constant change. A fix has to move the native min and the persistence floor together, then decide what the shell does at ~768 with the sidebar open (collapse / tolerate / lower the content floor). Do not land minWidth: 600 alone.

Not a wash of #8849 or #861

  • #8849 is the same 840 constant and the opposite failure: Hyprland ignores the min, allocates ~664, and the renderer still paints at 840 so text clips. This ticket is WMs that honor the min and refuse the tile (KDE / Windows snap). Related; not the same bug.
  • #861 is high-DPI UI scale on Windows/Linux (auto-zoom / a settings control). Scaling is why logical half-width drops below 840. That ticket does not ask to lower the native min.

Leaving open. Accepting as the desktop min-width vs. scaled half-screen snap class.

juliusmarminge avatar Sep 20 '26 20:09 juliusmarminge

I'd like to take this — I'll prepare a focused fix and regression coverage.

cestercian avatar Sep 21 '26 06:09 cestercian

stepping back — #12859 already covers this

cestercian avatar Sep 21 '26 06:09 cestercian

Another data point: 14" MacBook Pro display in Omarchy (Hyprland) — 3024×1900 at scale 2, so the logical desktop is 1512 px wide. An even two-window split gives each tile 737 px, ~100 px below the 840 minimum. Electron keeps rendering at 840, and Hyprland crops the overflow, so chat text and the composer are cut off mid-glyph on the right edge (same symptom as #8849).

This is plain integer 2× scaling, not fractional scaling, so a large share of Mac-sized laptop screens can't use half-screen tiling with T3 Code today. Confirmed on t3code-bin 0.1.0 (minWidth: 840 still in app.asar).

Either #13125 or #19232 would fix it for me.

Mahognes avatar Oct 17 '26 14:10 Mahognes