#14

Save and restore window position and size

Open1byeopened 6d ago

Problem

Native Rake windows open at their default size and position on every launch. Users expect a desktop app to reopen where they left it. Today each app would have to build that itself.

Proposal

An opt-in policy on App, stored through the existing preferences service:

  • On move, resize, fullscreen change and close, save each window's bounds, display, and maximized or fullscreen state under a stable window key.
  • On launch, restore it. If the saved display is gone, or the bounds are now off-screen, fall back to the default placement.
  • Write at most once per short interval while the user is dragging or resizing.
  • Let apps opt out per window and reset the saved state.

gpui-pre has window_bounds() and restore_native_window_state(), so most of this is wiring.

Out of scope

  • Web, where the browser owns the window.
  • Restoring tabs and routes. Durable session restore is a separate topic.

Done when

  • The desktop example reopens at its saved size and position on macOS, Windows and Linux (X11 and Wayland). Results include each OS version and display setup tested.
  • Tests cover off-screen bounds, a disconnected display, mixed display scales and corrupt saved data.
  • Wayland limits are documented, because compositors may not let apps place windows.

Depends on

The move from GPUI CE to gpui-pre.

Activity

0

No activity yet.