Skip to Content

Overlay API

dmn.overlay controls the overlay visibility, lock state, resize anchor, and size.

Read state

get()

Returns the current overlay state.

const state = await dmn.overlay.get(); console.log('Visible:', state.visible); console.log('Locked:', state.locked); console.log('Anchor:', state.anchor);

Control state

setVisible(visible)

Shows or hides the overlay.

await dmn.overlay.setVisible(true); await dmn.overlay.setVisible(false);

setLock(locked)

Locks or unlocks the overlay. A locked overlay ignores pointer input and cannot be moved or resized by the user.

await dmn.overlay.setLock(true); await dmn.overlay.setLock(false);

setAnchor(anchor)

Sets the fixed point used when resizing the overlay.

Supported values: top-left, top-right, bottom-left, bottom-right, and center.

await dmn.overlay.setAnchor('top-left'); await dmn.overlay.setAnchor('center'); await dmn.overlay.setAnchor('bottom-right');

resize(payload)

Resizes the overlay and returns the bounds actually applied. The position may move to keep the selected anchor fixed.

interface ResizePayload { width: number; height: number; anchor?: string; contentLeftOffset?: number; contentTopOffset?: number; fixedPositionDeltaX?: number; fixedPositionDeltaY?: number; }
const bounds = await dmn.overlay.resize({ width: 800, height: 200, }); console.log('Applied bounds:', bounds);

Width and height are clamped to the supported 100 to 4096 range. OBS has no native overlay window, so this call is rejected there.

resetPosition()

Moves an off-screen overlay back to the center of the current monitor work area and returns the applied bounds.

const bounds = await dmn.overlay.resetPosition(); console.log('Restored bounds:', bounds);

OBS has no native overlay window, so this call is rejected there.

Events

onVisibility(listener)

const unsub = dmn.overlay.onVisibility(({ visible }) => { console.log(visible ? 'Overlay shown' : 'Overlay hidden'); }); dmn.plugin.registerCleanup(unsub);

onLock(listener)

const unsub = dmn.overlay.onLock(({ locked }) => { console.log(locked ? 'Overlay locked' : 'Overlay unlocked'); });

onAnchor(listener)

const unsub = dmn.overlay.onAnchor(({ anchor }) => { console.log('New anchor:', anchor); });

onResized(listener)

const unsub = dmn.overlay.onResized((bounds) => { console.log(`Position: ${bounds.x}, ${bounds.y}`); console.log(`Size: ${bounds.width} x ${bounds.height}`); });

dmn.overlay does not provide an API for moving the overlay to an arbitrary coordinate.