Skip to content

utils/popoutBounds#

clampBoundsToDisplays()#

function clampBoundsToDisplays(bounds, displays): PopoutBounds | null;

Fit stored bounds onto the displays that actually exist right now.

Returns null when there is nothing sensible to restore (no bounds, no displays, degenerate size) — callers then let the OS place the window, which is always safe.

Parameters#

Parameter Type
bounds PopoutBounds | undefined
displays DisplayArea[]

Returns#

PopoutBounds | null


DisplayArea#

A display work area, as reported by Electron's screen module.

Properties#

height#

height: number;

width#

width: number;

x#

x: number;

y#

y: number;

PopoutBounds#

Screen-space sanity for persisted popout window positions.

A popout remembers where the user put it. Monitors come and go — undocking a laptop between sessions is routine — and a window restored onto a display that no longer exists is unreachable: it has no visible title bar to drag and no taskbar entry of its own. Every restore therefore goes through clampBoundsToDisplays first.

Properties#

height#

height: number;

width#

width: number;

x#

x: number;

y#

y: number;