window-management

Customize macOS SwiftUI window chrome, drag regions, behavior, and placement.

Updated Jul 31, 2026
One-click install
npx skills add https://github.com/AarnavBaddam/skills --skill window-management-aarnavbaddam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: window-management
Source: https://github.com/AarnavBaddam/skills/tree/main/window-management
Command: npx skills add https://github.com/AarnavBaddam/skills --skill window-management-aarnavbaddam

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? SwiftUI macOS apps often need windows with different roles—main browsers, About panels, media players, welcome screens—but default window chrome, restoration, and placement rarely fit each role. This Skill guides you through tuning each window's toolbar, drag regions, behavior, and placement using native SwiftUI scene and window modifiers. ## Core Features & Use Cases - Toolbar and Title Customization: Hide titles or toolbar backgrounds with .toolbar(removing: .title) and .toolbarBackgroundVisibility while keeping accessibility intact. - Drag Regions and Borderless Windows: Add WindowDragGesture overlays and .windowStyle(.plain) for custom chrome that stays movable. - Behavior and Placement Control: Configure minimize, restoration, launch behavior, and default/ideal placement using sizeThatFits and visibleRect. - Use Case: Build a media player window that hides its toolbar background, preserves aspect ratio when zoomed, clamps to the visible display area, and still drags from a custom overlay. ## Quick Start Use the window-management skill to customize my SwiftUI macOS window's toolbar, drag region, restoration behavior, and default placement.

Frequently Asked Questions about window-management

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I hide the window title in SwiftUI on macOS?

Use .toolbar(removing: .title) to stop drawing the title in the title bar while keeping it associated with the window for accessibility and menus. Combine it with .toolbarBackgroundVisibility(.hidden, for: .windowToolbar) if content should extend to the top edge.

How do I make a SwiftUI window draggable without a toolbar?

Attach WindowDragGesture() to a transparent overlay or non-interactive header region so it does not steal gestures from real controls. Pair it with .allowsWindowActivationEvents(true) so clicking and dragging a background window activates and moves it.

How do I control SwiftUI window size and position on macOS?

Use .defaultWindowPlacement for initial size and position, calling content.sizeThatFits(.unspecified) and reading context.defaultDisplay.visibleRect to clamp sizes. Use .windowIdealPlacement to define zoom behavior, such as preserving aspect ratio for media windows.

Can I disable window restoration for a SwiftUI scene?

Yes, apply .restorationBehavior(.disabled) to windows that should not reopen on launch, such as About panels or welcome windows. Keep restoration enabled for primary document windows, and only override the user's system-wide setting intentionally.

When should I use AppKit NSWindow instead of SwiftUI window modifiers?

Only reach for NSWindow bridging when SwiftUI modifiers like .windowMinimizeBehavior, .restorationBehavior, .defaultWindowPlacement, .windowIdealPlacement, .windowStyle, or .defaultLaunchBehavior cannot solve the problem. Prefer a narrow AppKit bridge rather than spreading it through the view tree.