Skip to content

feat(ui): #1280 App({ windowState }) — start maximized / fullscreen - #1283

Merged
proggeramlug merged 1 commit into
mainfrom
worktree-ui-1280-window-state
May 21, 2026
Merged

feat(ui): #1280 App({ windowState }) — start maximized / fullscreen#1283
proggeramlug merged 1 commit into
mainfrom
worktree-ui-1280-window-state

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Summary

Codegen

The App({...}) LLVM lowering in crates/perry-codegen/src/lower_call/native/mod.rs already special-cases title / width / height / body / icon; this PR adds a windowState arm that lowers the string to an i64 pointer and emits perry_ui_app_set_window_state(handle, str_ptr) between set_icon and set_body. Each backend records the state in its per-app entry and applies it at app_run time, because both Win32 (ShowWindow(SW_SHOWMAXIMIZED)) and AppKit (zoom: / toggleFullScreen:) need the window to already exist + be visible before the state transition takes effect.

Verification

Tested locally on macOS by compiling a windowState: "maximized" smoke and a windowState: "fullscreen" smoke with PERRY_UI_TEST_MODE=1 PERRY_UI_SCREENSHOT_PATH=.... Both produced screenshots covering the full display; the maximized variant kept the title bar visible, and the fullscreen variant removed it.

Cross-platform paths verified by symbol/syntax review only — perry-ui-windows can't link on macOS (webview2-com-sys is Win-only) and perry-ui-gtk4 needs webkitgtk-6.0 which isn't installed here.

Test plan

  • CI green (lint, cargo-test, api-docs-drift, security-audit)
  • Manual: build a sample TS app with App({ windowState: "maximized", ... }) on Windows and confirm the window opens already maximized.
  • Manual: same on macOS — confirm green-button-style zoom on launch.
  • Manual: windowState: "fullscreen" on Windows (borderless full-monitor) and macOS (native fullscreen Space).

Adds a `windowState?: "normal" | "maximized" | "fullscreen"` option to the
`App({...})` config so apps can launch already maximized or fullscreen
without the user having to hit the green button / F11. Original request
from discussion #1232 was for Windows; implemented cross-platform.

- codegen: `perry-codegen` lowers the new prop to a
  `perry_ui_app_set_window_state(handle, str_ptr)` call between
  `set_icon` and `set_body` so each backend can record the state and
  apply it at `app_run` time.
- Windows: `SW_SHOWMAXIMIZED` for maximized; for fullscreen strip
  `WS_OVERLAPPEDWINDOW` and resize to the full monitor rect via
  `MonitorFromWindow` + `GetMonitorInfoW`.
- macOS: `NSWindow.zoom:` for maximized; `toggleFullScreen:` for
  fullscreen (falls back to zoom if the window isn't resizable, since
  AppKit silently no-ops fullscreen on non-resizable windows).
- GTK4: `gtk_window_maximize` / `gtk_window_fullscreen`, applied just
  before `present()` so the window appears already in the target state.
- iOS / tvOS / visionOS / watchOS / Android: no-op stubs — full-screen
  windowing isn't a desktop concept on those platforms.
- types: `windowState` added to the `App(config)` signature in
  `types/perry/ui/index.d.ts`.

Verified locally on macOS via `PERRY_UI_TEST_MODE=1` screenshots —
"maximized" fills the screen with the title bar visible; "fullscreen"
removes the title bar and covers the entire monitor.
@proggeramlug
proggeramlug merged commit ced5c86 into main May 21, 2026
9 checks passed
@proggeramlug
proggeramlug deleted the worktree-ui-1280-window-state branch May 21, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant