Skip to content

perry/ui: option to start window maximized / fullscreen on launch #1280

Description

@proggeramlug

Summary

Add an API to launch a perry/ui window in the maximized (or fullscreen) state, instead of the explicit width/height it currently requires. Requested for Windows in discussion #1232, but should work cross-platform.

Current state

The window-creation API only accepts a fixed size:

  • Windows backend (crates/perry-ui-windows/src/ffi/app_window.rs): perry_ui_app_create(title, width, height) + set_size / set_min_size / set_max_size.
  • macOS backend (crates/perry-ui-macos/src/lib_ffi/window_misc.rs): mirrors the same surface.

Searching the workspace for maximize, maximized, zoom, fullscreen, SW_MAXIMIZE, WS_MAXIMIZE, showMaximized, windowState returns no hits — there is no programmatic way to start maximized today. The Win32 backend already uses ShowWindow but never with SW_MAXIMIZE/SW_SHOWMAXIMIZED.

Proposed shape

TypeScript-side, something like:

const app = createApp({
  title: "My App",
  windowState: "maximized", // "normal" (default) | "maximized" | "fullscreen"
});

Behind the scenes:

  • Windows: call ShowWindow(hwnd, SW_SHOWMAXIMIZED) on first show (or fullscreen via removing WS_OVERLAPPEDWINDOW and resizing to the monitor rect).
  • macOS: NSWindow.zoom(_:) for maximize / toggleFullScreen(_:) for fullscreen, called from the MainThreadMarker path.
  • Linux/GTK4 (if in scope): gtk_window_maximize / gtk_window_fullscreen.

Width/height should remain optional; if both are provided alongside windowState: "maximized", the maximized state wins on launch but the saved restore size honors them.

Linked discussion

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions