Interface: Windows
Defined in: types/desktop-engine.d.ts:4308
Where other apps' windows are (DesktopEngine.windows), e.g. for a companion that walks on their title bars. Needs the "window-positions" permission in manifest.json (and "apiVersion": 6); DesktopEngine.windows is null without it, when the user didn't allow it, and in the app's previews in the details pane.
Only the windows on the Spaces shown now (on every display), at least 40 points each way. Never the content's own windows (nor any of DesktopEngine's), the menu bar, the Dock or desktop icons, and never what a window shows, its title or its app. Minimized and hidden windows aren't listed, and a closing one leaves once it's half faded (about 0.1 second after it closes). While Mission Control is open, or when the system doesn't tell where the windows are, list() and visibleTopEdges() give the list as it last was, whether the content listens or not.
The app watches the windows only while the content listens to change: about 10 times a second, up to 60 times a second while the mouse button is down on a window (it may be dragged or resized), and once a second while all the content that listens has stopped drawing or is paused. Without a listener, list() and visibleTopEdges() ask the system when called: call them when deciding something, not every frame.
Extends
Properties
onchange
onchange:
| EventHandler<Windows, void>
| null
| undefined;Defined in: types/desktop-engine.d.ts:4325
change callback
Methods
addEventListener()
addEventListener<K>(type, listener): void;Defined in: types/desktop-engine.d.ts:143
Adds an event listener; type may be given with or without the on prefix
Type Parameters
| Type Parameter |
|---|
K extends "change" |
Parameters
| Parameter | Type |
|---|---|
type | K | `on${K}` |
listener | EventHandler<Windows, WindowsEventMap[K]> |
Returns
void
Inherited from
EventedObject.addEventListener
destroy()
destroy(): void;Defined in: types/desktop-engine.d.ts:147
Clears all event listeners and on callbacks so the object can be garbage-collected; components also process their children recursively
Returns
void
Inherited from
list()
list(): readonly WindowInfo[];Defined in: types/desktop-engine.d.ts:4315
The windows, front to back: the first one is in front of all the others. While the content listens to change, the ones as of the last change (or now, before the first); otherwise the ones now, asked of the system when called. Within one run of the content's code, list() and visibleTopEdges() give the same list. A window behind others can be covered by them: visibleTopEdges() gives the parts of the top edges nothing covers
Returns
readonly WindowInfo[]
offchange()
offchange(): void;Defined in: types/desktop-engine.d.ts:4327
Removes the onchange callback
Returns
void
removeEventListener()
removeEventListener<K>(type, listener): void;Defined in: types/desktop-engine.d.ts:145
Removes the given event listener
Type Parameters
| Type Parameter |
|---|
K extends "change" |
Parameters
| Parameter | Type |
|---|---|
type | K | `on${K}` |
listener | EventHandler<Windows, WindowsEventMap[K]> |
Returns
void
Inherited from
EventedObject.removeEventListener
visibleTopEdges()
visibleTopEdges(): readonly TopEdge[];Defined in: types/desktop-engine.d.ts:4323
Where a companion can stand: the parts of the windows' top edges that no window in front covers (a companion is above all windows, so one standing on a covered edge would look like it stands on the window in front). Front to back, a window's parts from left to right; a window that a window in front cuts in two has two. Full screen windows (Split View ones too) have none, their top is the display's. Parts can reach past the displays' edges, as windows do
Returns
readonly TopEdge[]
