Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/dev-os/llms.txt
Use this file to discover all available pages before exploring further.
WindowManager is the central nervous system of DevOS. It uses a React Context to broadcast window state — which apps are open, which is focused, and what their geometry should be — to every component in the tree without prop drilling. All mutations (open, close, minimize, maximize, focus) flow through a single provider, keeping the rest of the codebase stateless and predictable.
WindowManagerProvider
Wrap your entire application inWindowManagerProvider (typically in main.js) so that every child component can access the window registry:
| State | Initial value | Description |
|---|---|---|
windows | [] | The array of all currently tracked window objects |
focusedWindowId | null | The id of the window that is currently active |
zIndexCounter | 10 | A monotonically increasing integer used to layer windows |
useWindowManager() hook
CalluseWindowManager() inside any component that is a descendant of WindowManagerProvider to read state or dispatch actions.
Return values
windows: WindowData[]
A snapshot array of every window that has been opened in the current session. Windows that have been closed are removed from the array entirely; windows that have been minimised remain in the array with isMinimized: true.
focusedWindowId: string | null
The id string of the window currently receiving keyboard/pointer focus, or null when no window is focused (e.g. immediately after the desktop loads, or after the last open window is closed).
openWindow(id, options)
Opens a new window, or un-minimises an existing window with the same id.
id is already open and not minimised, openWindow is a no-op for that window — it will not create a duplicate. If the window is minimised, it is restored and brought to the front. Newly created windows receive the current zIndexCounter value, and the counter is incremented.
closeWindow(id)
Removes the window with the given id from the windows array entirely and clears focusedWindowId if it matched. The app component inside the window is unmounted and its local state is discarded.
minimizeWindow(id)
Sets isMinimized: true on the target window and clears focusedWindowId if it matched. The window component returns null when minimised, but remains in the windows array, so the Taskbar button stays visible.
maximizeWindow(id)
Toggles isMaximized on the target window and brings it to the front by calling focusWindow internally. When maximised, the Window component animates to full-viewport width and calc(100vh - 48px) height.
focusWindow(id)
Sets focusedWindowId to id, assigns the current zIndexCounter value to that window’s zIndex, and increments the counter. This guarantees the most recently focused window is always rendered on top of all others.
Window object shape
Every entry in thewindows array conforms to the following interface:
| Field | Description |
|---|---|
id | Unique key; used to prevent duplicate windows and to target mutations |
title | Displayed in the window title bar and the Taskbar button |
icon | A Lucide React (or any React) component rendered at 16 px in the title bar |
component | The app component rendered inside the window body; receives no props |
isOpen | Always true for windows currently in the array |
isMinimized | true while the window is hidden to the taskbar |
isMaximized | true while the window fills the viewport |
zIndex | CSS z-index applied to the Framer Motion div; higher = in front |
defaultSize | The { width, height } in pixels used for the initial window size |
Code example
The following shows how to triggeropenWindow from an arbitrary component anywhere in the tree:
Usage outside the provider
useWindowManager throws a descriptive error if it is called outside of WindowManagerProvider:
undefined reference at runtime.