ReviewOS

also looking at this

craft-native/craft

feat: portable typed window controls on Linux and Windows

#326
Merged glennmichael123 wants to merge codex/portable-window-parity into main
9 files +652 -32
docs/features/window-management.mdmodified+19-3
Changes to docs/features/window-management.md
@@ -32,8 +32,10 @@ The `craft-native` SDK returns a typed `Window` handle. Runtime-created
3232windows are available on macOS, Linux, and Windows and must provide either
3333`html` or `url` content. The common create, close, title, geometry, and event
3434routes are cross-platform; some advanced window controls remain macOS-only.
35On Linux, the window manager may ignore position requests, especially before
36the window is shown.
35Bounds, centering, resizing constraints, resizability and fullscreen controls
36also work on the typed handle on all three desktop platforms. On Linux,
37position and fullscreen requests are advisory to the window manager (and
38global positioning can be unavailable under Wayland).
3739
3840```typescript
3941import { createWindow } from 'craft-native'
@@ -62,7 +64,21 @@ const settings = await createWindow({
6264})
6365
6466await settings.setTitle('Settings — Account')
65```
67await settings.setBounds({ x: 120, y: 80, width: 800 })
68await settings.setMinimumSize(480, 360)
69await settings.setMaximumSize(1600, 1200)
70await settings.setResizable(false)
71const canResize = await settings.isResizable()
72await settings.center()
73await settings.setFullscreen(true)
74await settings.toggleFullscreen()
75```
76
77The bounds update preserves omitted coordinates and dimensions. Native window
78managers can adjust requested geometry for decorations or screen constraints;
79read `getBounds()` after a resize event if you need the actual result.
80Creation-time `minWidth`/`minHeight` and `maxWidth`/`maxHeight` may constrain
81either axis independently; the native window system's own minimum still applies.
6682
6783The older `createWindow(html, options)` overload remains available when the
6884content is already in a string.