Skip to content

Window API

English API reference for the window family.

This page is the primary owner for the namespaces listed below. Method names, parameter keys, and return fields follow the C++ RegisterApi handlers.

window

window.blur

Public API method. Runtime authority: src/api/WindowApi.cpp:2411.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.blur');

window.broadcast

Source-reviewed contract

Authority: src/api/WindowApi.cpp:2245-2256.

ParameterTypeRequiredDefault
messagejsonYesnone

Return keys (vary by response variant): error, success; success

Semantics: message must be present but may be any JSON value. The handler identifies the caller window, broadcasts to the other managed windows, and returns no recipient count.

Public API method. Runtime authority: src/api/WindowApi.cpp:2468.

ParameterTypeRequiredDescription
messagejsonYesRequired.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.broadcast', { message: /* value */ });

window.cancelClose

Public API method. Runtime authority: src/api/WindowApi.cpp:2460.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.cancelClose');

window.center

Public API method. Runtime authority: src/api/WindowApi.cpp:2401.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.center');

window.clearClickThroughExcludeRegions

Public API method. Runtime authority: src/api/WindowApi.cpp:2466.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default .

Returns: {"error":"...","success":true,"windowId":"..."}

js
const result = await fb2k.invoke('window.clearClickThroughExcludeRegions', { windowId: /* value */ });

window.clearDragRegions

Public API method. Runtime authority: src/api/WindowApi.cpp:2420.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.clearDragRegions');

window.clearNoDragRegions

Public API method. Runtime authority: src/api/WindowApi.cpp:2422.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.clearNoDragRegions');

window.close

Public API method. Runtime authority: src/api/WindowApi.cpp:2388.

No parameters.

Returns: {"success":true}

js
const result = await fb2k.invoke('window.close');

window.closeAllPopups

Public API method. Runtime authority: src/api/WindowApi.cpp:2453.

No parameters.

Returns: {"success":true}

js
const result = await fb2k.invoke('window.closeAllPopups');

window.closePopup

Public API method. Runtime authority: src/api/WindowApi.cpp:2452.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default .

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.closePopup', { windowId: /* value */ });

window.confirmClose

Public API method. Runtime authority: src/api/WindowApi.cpp:2461.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.confirmClose');

window.createPopup

Public API method. Runtime authority: src/api/WindowApi.cpp:2451.

ParameterTypeRequiredDescription
alwaysOnTopbooleanNoOptional; default false.
backdropPolicyobjectNoOptional; default omitted.
beforeClosebooleanNoOptional; default false.
behaviorobjectNoOptional; default omitted.
clickThroughbooleanNoOptional; default false.
framebooleanNoOptional; default true.
heightintegerNoOptional; default 300.
maxHeightintegerNoOptional; default 0.
maxWidthintegerNoOptional; default 0.
minHeightintegerNoOptional; default 150.
minWidthintegerNoOptional; default 200.
profilestringNoOptional; default .
resizablebooleanNoOptional; default true.
showInTaskbarbooleanNoOptional; default false.
titlestringNoOptional; default .
transparentbooleanNoOptional; default false.
urlstringNoOptional; default .
widthintegerNoOptional; default 400.
xintegerNoOptional; default CW_USEDEFAULT.
yintegerNoOptional; default CW_USEDEFAULT.

Returns: {"error":"...","success":true,"windowId":"..."}

js
const result = await fb2k.invoke('window.createPopup', { alwaysOnTop: /* value */, backdropPolicy: /* value */, beforeClose: /* value */, behavior: /* value */, clickThrough: /* value */, frame: /* value */, height: /* value */, maxHeight: /* value */, maxWidth: /* value */, minHeight: /* value */, minWidth: /* value */, profile: /* value */, resizable: /* value */, showInTaskbar: /* value */, title: /* value */, transparent: /* value */, url: /* value */, width: /* value */, x: /* value */, y: /* value */ });

window.enterFullscreen

Source-reviewed contract

Authority: src/api/WindowApi.cpp:1538-1554.

ParameterTypeRequiredDefault
windowIdstringNocaller window

Return keys (vary by response variant): error, isFullscreen, success; success; isFullscreen, success

Semantics: The resolver targets windowId when supplied or the caller otherwise. Panel mode and shells without fullscreen capability return errors; already-fullscreen calls return success:false without changing state.

Public API method. Runtime authority: src/api/WindowApi.cpp:2434.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.

Returns: {"error":"...","isFullscreen":"...","success":true}

js
const result = await fb2k.invoke('window.enterFullscreen');

window.exitFullscreen

Source-reviewed contract

Authority: src/api/WindowApi.cpp:1554-1570.

ParameterTypeRequiredDefault
windowIdstringNocaller window

Return keys (vary by response variant): error, isFullscreen, success; success; isFullscreen, success

Semantics: The resolver targets windowId when supplied or the caller otherwise. Panel mode and unsupported shells fail; a non-fullscreen target returns success:false without restoring geometry.

Public API method. Runtime authority: src/api/WindowApi.cpp:2435.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.

Returns: {"error":"...","isFullscreen":"...","success":true}

js
const result = await fb2k.invoke('window.exitFullscreen');

window.flash

Public API method. Runtime authority: src/api/WindowApi.cpp:2414.

ParameterTypeRequiredDescription
countintegerNoOptional; default 3.
enabledbooleanNoOptional; default true.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.flash', { count: /* value */, enabled: /* value */ });

window.flashTaskbar

Public API method. Runtime authority: src/api/WindowApi.cpp:2433.

ParameterTypeRequiredDescription
countintegerNoOptional; default 3.

Returns: {"success":true}

js
const result = await fb2k.invoke('window.flashTaskbar', { count: /* value */ });

window.focus

Public API method. Runtime authority: src/api/WindowApi.cpp:2410.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default .

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.focus', { windowId: /* value */ });

window.getAllWindows

Public API method. Runtime authority: src/api/WindowApi.cpp:2454.

No parameters.

Returns: {"items":"...","success":true}

js
const result = await fb2k.invoke('window.getAllWindows');

window.getBackdropPolicy

Source-reviewed contract

Authority: src/api/WindowApi.cpp:2014-2023.

ParameterTypeRequiredDefault
windowIdstringNocaller window

Return keys (vary by response variant): error, success; backdropPolicy, resolvedBackdropPolicy, success, windowId

Semantics: Observation resolution selects the explicit windowId or caller. The response is the shell’s backdrop-policy object augmented with success and resolved windowId, including profile/default-resolved policy fields.

Public API method. Runtime authority: src/api/WindowApi.cpp:2458.

No parameters.

Returns: JSON object from the runtime handler.

js
const result = await fb2k.invoke('window.getBackdropPolicy');

window.getBounds

Public API method. Runtime authority: src/api/WindowApi.cpp:2399.

No parameters.

Returns: {"height":"...","width":"...","x":"...","y":"..."}

js
const result = await fb2k.invoke('window.getBounds');

window.getCaptionButtonsWidth

Public API method. Runtime authority: src/api/WindowApi.cpp:2418.

No parameters.

Returns: {"buttonWidth":"...","width":"..."}

js
const result = await fb2k.invoke('window.getCaptionButtonsWidth');

window.getCornerPreference

Public API method. Runtime authority: src/api/WindowApi.cpp:2428.

No parameters.

Returns: {"mode":"...","preference":"..."}

js
const result = await fb2k.invoke('window.getCornerPreference');

window.getCurrentWindowId

Public API method. Runtime authority: src/api/WindowApi.cpp:2455.

No parameters.

Returns: {"success":true,"windowId":"..."}

js
const result = await fb2k.invoke('window.getCurrentWindowId');

window.getDevServerConfig

Public API method. Runtime authority: src/api/WindowApi.cpp:2444.

No parameters.

Returns: {"devServerUrl":"...","success":true,"useDevServer":"..."}

js
const result = await fb2k.invoke('window.getDevServerConfig');

window.getDpiScale

Public API method. Runtime authority: src/api/WindowApi.cpp:2432.

No parameters.

Returns: {"dpi":"...","scale":"...","success":true}

js
const result = await fb2k.invoke('window.getDpiScale');

window.getMaxSize

Public API method. Runtime authority: src/api/WindowApi.cpp:2405.

No parameters.

Returns: {"height":"...","width":"..."}

js
const result = await fb2k.invoke('window.getMaxSize');

window.getMinSize

Public API method. Runtime authority: src/api/WindowApi.cpp:2403.

No parameters.

Returns: {"height":"...","width":"..."}

js
const result = await fb2k.invoke('window.getMinSize');

window.getMode

Public API method. Runtime authority: src/api/WindowApi.cpp:2469.

No parameters.

Returns: {"mode":"...","panel":"...","panelMode":"...","windowId":"..."}

js
const result = await fb2k.invoke('window.getMode');

window.getPopupBehavior

Public API method. Runtime authority: src/api/WindowApi.cpp:2456.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default .

Returns: {"success":true,"windowId":"..."}

js
const result = await fb2k.invoke('window.getPopupBehavior', { windowId: /* value */ });

window.getState

Public API method. Runtime authority: src/api/WindowApi.cpp:2393.

No parameters.

Returns: {"alwaysOnTop":"...","focused":"...","fullscreen":"...","height":"...","isAlwaysOnTop":"...","isFocused":"...","isFullscreen":"...","isMaximized":"...","isMinimized":"...","maximized":"...","minimized":"...","width":"...","x":"...","y":"..."}

js
const result = await fb2k.invoke('window.getState');

window.getTitle

Public API method. Runtime authority: src/api/WindowApi.cpp:2413.

No parameters.

Returns: {"title":"..."}

js
const result = await fb2k.invoke('window.getTitle');

window.getTitlebarHeight

Public API method. Runtime authority: src/api/WindowApi.cpp:2416.

No parameters.

Returns: {"height":"..."}

js
const result = await fb2k.invoke('window.getTitlebarHeight');

window.getTitlebarInfo

Public API method. Runtime authority: src/api/WindowApi.cpp:2423.

No parameters.

Returns: {"captionButtonWidth":"...","captionButtonsWidth":"...","height":"...","isMaximized":"..."}

js
const result = await fb2k.invoke('window.getTitlebarInfo');

window.getZoom

Public API method. Runtime authority: src/api/WindowApi.cpp:2448.

No parameters.

Returns: {"dpi":"...","dpiScale":"...","success":true,"zoom":"..."}

js
const result = await fb2k.invoke('window.getZoom');

window.hasSavedBounds

Public API method. Runtime authority: src/api/WindowApi.cpp:2446.

No parameters.

Returns: {"Window has saved position from previous session":"...","description":"...","hasSavedBounds":"..."}

js
const result = await fb2k.invoke('window.hasSavedBounds');

window.isAlwaysOnTop

Public API method. Runtime authority: src/api/WindowApi.cpp:2397.

No parameters.

Returns: {"enabled":"...","isAlwaysOnTop":"..."}

js
const result = await fb2k.invoke('window.isAlwaysOnTop');

window.isClickThrough

Public API method. Runtime authority: src/api/WindowApi.cpp:2464.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default .

Returns: {"clickThrough":"...","error":"...","success":true}

js
const result = await fb2k.invoke('window.isClickThrough', { windowId: /* value */ });

window.isFullscreen

Public API method. Runtime authority: src/api/WindowApi.cpp:2392.

ParameterTypeRequiredDescription
windowIdstringNoOptional target window id resolved by WindowTargetResolver::ResolveForObservation; omitted uses the caller window.

Returns: {"fullscreen":"...","isFullscreen":"..."}

js
const result = await fb2k.invoke('window.isFullscreen', { windowId: /* value */ });

window.isMaximized

Public API method. Runtime authority: src/api/WindowApi.cpp:2390.

No parameters.

Returns: {"isMaximized":"...","maximized":"..."}

js
const result = await fb2k.invoke('window.isMaximized');

window.isMinimized

Public API method. Runtime authority: src/api/WindowApi.cpp:2391.

No parameters.

Returns: {"minimized":"..."}

js
const result = await fb2k.invoke('window.isMinimized');

window.isResizable

Public API method. Runtime authority: src/api/WindowApi.cpp:2407.

No parameters.

Returns: {"resizable":"..."}

js
const result = await fb2k.invoke('window.isResizable');

window.maximize

Public API method. Runtime authority: src/api/WindowApi.cpp:2386.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.maximize');

window.minimize

Public API method. Runtime authority: src/api/WindowApi.cpp:2385.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.minimize');

window.refreshWebView

Public API method. Runtime authority: src/api/WindowApi.cpp:2442.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.refreshWebView');

window.reload

Public API method. Runtime authority: src/api/WindowApi.cpp:2443.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.reload');

window.resetZoom

Public API method. Runtime authority: src/api/WindowApi.cpp:2449.

No parameters.

Returns: {"error":"...","success":true,"zoom":"..."}

js
const result = await fb2k.invoke('window.resetZoom');

window.restore

Public API method. Runtime authority: src/api/WindowApi.cpp:2387.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.restore');

window.sendMessage

Source-reviewed contract

Authority: src/api/WindowApi.cpp:2223-2242.

ParameterTypeRequiredDefault
targetWindowIdstringYesnone
messagejsonYesnone

Return keys (vary by response variant): error, success; error, success; error, success; success

Semantics: Both a non-empty targetWindowId and present message are required. The message is forwarded as arbitrary JSON from the caller identity; a missing recipient returns the target-not-found error.

Public API method. Runtime authority: src/api/WindowApi.cpp:2467.

ParameterTypeRequiredDescription
targetWindowIdstringYesRequired.
messagejsonYesRequired.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.sendMessage', { message: /* value */, targetWindowId: /* value */ });

window.setAcrylic

Source-reviewed contract

Authority: src/api/WindowApi.cpp:1593-1617.

ParameterTypeRequiredDefault
windowIdstringNocaller window
enabledbooleanNotrue
darkModebooleanNoleave existing mode

Returns: {"darkMode":"...","enabled":true,"success":true}

Semantics: The mutation resolver chooses explicit windowId or caller. enabled patches compatibility backdrop to acrylic or clears it; darkMode is only patched when supplied, and panel mode is unsupported.

Public API method. Runtime authority: src/api/WindowApi.cpp:2439.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
enabledbooleanNoOptional; default true.
darkModebooleanNoOptional; default leave existing mode.
js
const result = await fb2k.invoke('window.setAcrylic', { darkMode: /* value */, enabled: /* value */ });

window.setAlwaysOnTop

Public API method. Runtime authority: src/api/WindowApi.cpp:2396.

ParameterTypeRequiredDescription
enabledbooleanNoOptional; default true.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.setAlwaysOnTop', { enabled: /* value */ });

window.setBackdropPolicy

Source-reviewed contract

Authority: src/api/WindowApi.cpp:2026-2047.

ParameterTypeRequiredDefault
windowIdstringNocaller window
backdropPolicyobjectYesnone

Return keys (vary by response variant): error, success; backdropPolicy, resolvedBackdropPolicy, success, windowId

Semantics: backdropPolicy must be present and an object before target resolution. The shell validates/applies the patch; the successful response returns the updated policy info plus success and windowId.

Public API method. Runtime authority: src/api/WindowApi.cpp:2459.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
backdropPolicyobjectYesRequired.

Returns: {"error":"...","failed to update backdrop policy":"...","success":true}

js
const result = await fb2k.invoke('window.setBackdropPolicy', { backdropPolicy: /* value */ });

window.setBackgroundTransparency

Public API method. Runtime authority: src/api/WindowApi.cpp:2441.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
transparentbooleanNoOptional; default true.

Returns: {"WebView background is now transparent - DWM effects will show through":"...","description":"...","error":"...","success":true,"transparent":"..."}

js
const result = await fb2k.invoke('window.setBackgroundTransparency', { transparent: /* value */, windowId: /* value */ });

window.setBlur

Public API method. Runtime authority: src/api/WindowApi.cpp:2438.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
enabledbooleanNoOptional; default true.

Returns: {"enabled":"...","success":true}

js
const result = await fb2k.invoke('window.setBlur', { enabled: /* value */, windowId: /* value */ });

window.setBounds

Source-reviewed contract

Authority: src/api/WindowApi.cpp:761-789.

ParameterTypeRequiredDefault
xintegerNocurrent x
yintegerNocurrent y
widthintegerNocurrent width
heightintegerNocurrent height

Return keys (vary by response variant): error, success; success

Semantics: Only supplied fields are read as integers; omitted coordinates and dimensions retain the current window rectangle. The method is unsupported in panel mode and operates only on the caller window.

Public API method. Runtime authority: src/api/WindowApi.cpp:2400.

ParameterTypeRequiredDescription
xintegerNoOptional; default current x.
yintegerNoOptional; default current y.
widthintegerNoOptional; default current width.
heightintegerNoOptional; default current height.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.setBounds', { height: /* value */, width: /* value */, x: /* value */, y: /* value */ });

window.setClickThrough

Public API method. Runtime authority: src/api/WindowApi.cpp:2463.

ParameterTypeRequiredDescription
enabledbooleanNoOptional; default true.
windowIdstringNoOptional; default .

Returns: {"clickThrough":"...","error":"...","success":true}

js
const result = await fb2k.invoke('window.setClickThrough', { enabled: /* value */, windowId: /* value */ });

window.setClickThroughExcludeRegions

Public API method. Runtime authority: src/api/WindowApi.cpp:2465.

ParameterTypeRequiredDescription
regionsarrayNoOptional; default omitted.
windowIdstringNoOptional; default .

Returns: {"count":0,"dpiScale":"...","success":true,"warning":"...","windowId":"..."}

js
const result = await fb2k.invoke('window.setClickThroughExcludeRegions', { regions: /* value */, windowId: /* value */ });

window.setCornerPreference

Public API method. Runtime authority: src/api/WindowApi.cpp:2427.

ParameterTypeRequiredDescription
modestringNoOptional; default default.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.setCornerPreference', { mode: /* value */ });

window.setDarkMode

Public API method. Runtime authority: src/api/WindowApi.cpp:2440.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
enabledbooleanNoOptional; default true.

Returns: {"enabled":"...","success":true}

js
const result = await fb2k.invoke('window.setDarkMode', { enabled: /* value */, windowId: /* value */ });

window.setDevServerConfig

Public API method. Runtime authority: src/api/WindowApi.cpp:2445.

ParameterTypeRequiredDescription
devServerUrlstringNoOptional; default .
useDevServerbooleanNoOptional; default false.

Returns: {"devServerUrl":"...","success":true,"useDevServer":"..."}

js
const result = await fb2k.invoke('window.setDevServerConfig', { devServerUrl: /* value */, useDevServer: /* value */ });

window.setDragRegions

Public API method. Runtime authority: src/api/WindowApi.cpp:2419.

ParameterTypeRequiredDescription
regionsarrayNoOptional; default omitted.

Returns: {"count":"...","dpiScale":"...","error":"...","success":true}

js
const result = await fb2k.invoke('window.setDragRegions', { regions: /* value */ });

window.setFrameless

Public API method. Runtime authority: src/api/WindowApi.cpp:2462.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
framelessbooleanNoOptional; default true.

Returns: {"error":"...","frameless":"...","success":true}

js
const result = await fb2k.invoke('window.setFrameless', { frameless: /* value */, windowId: /* value */ });

window.setFullscreen

Source-reviewed contract

Authority: src/api/WindowApi.cpp:899-921.

ParameterTypeRequiredDefault
windowIdstringNocaller window
enabledbooleanNotrue

Return keys (vary by response variant): error, fullscreen, success; fullscreen, success

Semantics: The mutation resolver chooses explicit windowId or caller. enabled enters and false exits fullscreen only on shells advertising fullscreen capability; panel mode is rejected.

Public API method. Runtime authority: src/api/WindowApi.cpp:2408.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
enabledbooleanNoOptional; default true.

Returns: {"error":"...","fullscreen":"...","success":true}

js
const result = await fb2k.invoke('window.setFullscreen', { enabled: /* value */ });

window.setMaxSize

Public API method. Runtime authority: src/api/WindowApi.cpp:2404.

ParameterTypeRequiredDescription
heightintegerNoOptional; default 0.
widthintegerNoOptional; default 0.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.setMaxSize', { height: /* value */, width: /* value */ });

window.setMica

Source-reviewed contract

Authority: src/api/WindowApi.cpp:1573-1576.

ParameterTypeRequiredDefault
windowIdstringNocaller window
enabledbooleanNotrue
variantstringNomica
darkModebooleanNoleave existing mode

Returns: {"darkMode":"...","enabled":true,"success":true,"variant":"..."}

Semantics: setMica delegates to SetMicaEffectImpl: only mica-alt selects the alternate variant, all other values normalize to mica. It patches the resolved caller/target shell and is unsupported in panel mode.

Public API method. Runtime authority: src/api/WindowApi.cpp:2436.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
enabledbooleanNoOptional; default true.
variantstringNoOptional; default mica.
darkModebooleanNoOptional; default leave existing mode.
js
const result = await fb2k.invoke('window.setMica', { enabled: true, variant: 'mica' });

window.setMicaEffect

Source-reviewed contract

Authority: src/api/WindowApi.cpp:1579-1582.

ParameterTypeRequiredDefault
windowIdstringNocaller window
enabledbooleanNotrue
variantstringNomica
darkModebooleanNoleave existing mode

Returns: {"darkMode":"...","enabled":true,"success":true,"variant":"..."}

Semantics: setMicaEffect is a direct compatibility alias of setMica and delegates to the same Mica implementation, including variant normalization, target resolution, and panel restriction.

Public API method. Runtime authority: src/api/WindowApi.cpp:2437.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.
enabledbooleanNoOptional; default true.
variantstringNoOptional; default mica.
darkModebooleanNoOptional; default leave existing mode.
js
const result = await fb2k.invoke('window.setMicaEffect', { enabled: true, variant: 'mica' });

window.setMinSize

Public API method. Runtime authority: src/api/WindowApi.cpp:2402.

ParameterTypeRequiredDescription
heightintegerNoOptional; default 0.
widthintegerNoOptional; default 0.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.setMinSize', { height: /* value */, width: /* value */ });

window.setNoDragRegions

Public API method. Runtime authority: src/api/WindowApi.cpp:2421.

ParameterTypeRequiredDescription
regionsarrayNoOptional; default omitted.

Returns: {"count":"...","dpiScale":"...","error":"...","success":true}

js
const result = await fb2k.invoke('window.setNoDragRegions', { regions: /* value */ });

window.setPopupBehavior

Source-reviewed contract

Authority: src/api/WindowApi.cpp:1978-2011.

ParameterTypeRequiredDefault
windowIdstringNocaller popup
profilestringNoleave profile unchanged
behaviorobjectNono behavior patch

Returns: {"error":"...","success":true,"windowId":"..."}

Semantics: Explicit windowId must name a popup rather than main; without it the caller must resolve to a popup. profile and behavior are independently presence-sensitive and are validated by UpdatePopupBehavior.

Public API method. Runtime authority: src/api/WindowApi.cpp:2457.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller popup.
profilestringNoOptional; default leave profile unchanged.
behaviorobjectNoOptional; default no behavior patch.
js
const result = await fb2k.invoke('window.setPopupBehavior', { behavior: /* value */, profile: /* value */, windowId: /* value */ });

window.setPosition

Public API method. Runtime authority: src/api/WindowApi.cpp:2430.

ParameterTypeRequiredDescription
xintegerNoOptional; default 0.
yintegerNoOptional; default 0.

Returns: {"success":true}

js
const result = await fb2k.invoke('window.setPosition', { x: /* value */, y: /* value */ });

window.setResizable

Public API method. Runtime authority: src/api/WindowApi.cpp:2406.

ParameterTypeRequiredDescription
resizablebooleanNoOptional; default true.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.setResizable', { resizable: /* value */ });

window.setSize

Public API method. Runtime authority: src/api/WindowApi.cpp:2431.

ParameterTypeRequiredDescription
heightintegerNoOptional; default 600.
widthintegerNoOptional; default 800.

Returns: {"success":true}

js
const result = await fb2k.invoke('window.setSize', { height: /* value */, width: /* value */ });

window.setTitle

Public API method. Runtime authority: src/api/WindowApi.cpp:2412.

ParameterTypeRequiredDescription
titlestringNoOptional; default foobar2000.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.setTitle', { title: /* value */ });

window.setTitlebarHeight

Public API method. Runtime authority: src/api/WindowApi.cpp:2417.

ParameterTypeRequiredDescription
heightintegerNoOptional; default 32.

Returns: {"error":"...","height":"...","success":true}

js
const result = await fb2k.invoke('window.setTitlebarHeight', { height: /* value */ });

window.setZoom

Public API method. Runtime authority: src/api/WindowApi.cpp:2447.

ParameterTypeRequiredDescription
zoomnumberNoOptional; default 1.

Returns: {"error":"...","success":true,"zoom":"..."}

js
const result = await fb2k.invoke('window.setZoom', { zoom: /* value */ });

window.setZoomForDpi

Public API method. Runtime authority: src/api/WindowApi.cpp:2450.

ParameterTypeRequiredDescription
dpiintegerNoOptional; default 0.

Returns: {"dpi":"...","error":"...","success":true,"zoom":"..."}

js
const result = await fb2k.invoke('window.setZoomForDpi', { dpi: /* value */ });

window.showSystemMenu

Public API method. Runtime authority: src/api/WindowApi.cpp:2415.

ParameterTypeRequiredDescription
hintegerNoOptional; default 0.
wintegerNoOptional; default 0.
xintegerNoOptional; default 0.
yintegerNoOptional; default 0.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.showSystemMenu', { h: /* value */, w: /* value */, x: /* value */, y: /* value */ });

window.startDrag

Public API method. Runtime authority: src/api/WindowApi.cpp:2394.

No parameters.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.startDrag');

window.startResize

Public API method. Runtime authority: src/api/WindowApi.cpp:2395.

ParameterTypeRequiredDescription
edgestringNoOptional; default bottomright.

Returns: {"error":"...","success":true}

js
const result = await fb2k.invoke('window.startResize', { edge: /* value */ });

window.toggleAlwaysOnTop

Public API method. Runtime authority: src/api/WindowApi.cpp:2398.

No parameters.

Returns: {"enabled":"...","success":true}

js
const result = await fb2k.invoke('window.toggleAlwaysOnTop');

window.toggleFullscreen

Source-reviewed contract

Authority: src/api/WindowApi.cpp:921-944.

ParameterTypeRequiredDefault
windowIdstringNocaller window

Return keys (vary by response variant): error, fullscreen, success; fullscreen, success

Semantics: The mutation resolver chooses explicit windowId or caller. The method flips the shell fullscreen state only when capability is available; panel mode and unsupported targets return false/error.

Public API method. Runtime authority: src/api/WindowApi.cpp:2409.

ParameterTypeRequiredDescription
windowIdstringNoOptional; default caller window.

Returns: {"error":"...","fullscreen":"...","success":true}

js
const result = await fb2k.invoke('window.toggleFullscreen');

window.toggleMaximize

Public API method. Runtime authority: src/api/WindowApi.cpp:2389.

No parameters.

Returns: {"maximized":"...","success":true}

js
const result = await fb2k.invoke('window.toggleMaximize');

Contract supplements

The sections below close public-contract findings from the strict parameter audit without replacing existing explanations.

Contract supplement: window.focus

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:947-1009.

ParameterTypeRequiredDefaultDescription
windowIdstringNo``Optional; default .

Return fields

FieldTypeOptional
errorstringYes
successbooleanNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.focus', { windowId: /* value */ });

Contract supplement: window.getBackdropPolicy

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:2014-2023.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.

Return fields

FieldTypeOptional
errorstringYes
successbooleanNo
backdropPolicyobjectNo
resolvedBackdropPolicyobjectNo
windowIdstringNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.getBackdropPolicy', { windowId: /* value */ });

Contract supplement: window.isFullscreen

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:577-584.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.

Return fields

FieldTypeOptional
fullscreenjsonNo
isFullscreenjsonNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.isFullscreen', { windowId: /* value */ });

Contract supplement: window.setAcrylic

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:1593-1617.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.
enabledbooleanNotrueOptional; default true.
darkModebooleanNoleave existing modeOptional; default leave existing mode.

Return fields

FieldTypeOptional

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.setAcrylic', { windowId: /* value */, enabled: /* value */, darkMode: /* value */ });

Contract supplement: window.setBackdropPolicy

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:2026-2047.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.
backdropPolicyobjectYesnoneRequired.

Return fields

FieldTypeOptional
errorstringYes
successbooleanNo
backdropPolicyobjectNo
resolvedBackdropPolicyobjectNo
windowIdstringNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.setBackdropPolicy', { windowId: /* value */, backdropPolicy: /* value */ });

Contract supplement: window.setBackgroundTransparency

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:1632-1658.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.
transparentbooleanNotrueOptional; default true.

Return fields

FieldTypeOptional
errorstringYes
successbooleanNo
descriptionjsonNo
transparentjsonNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.setBackgroundTransparency', { windowId: /* value */, transparent: /* value */ });

Contract supplement: window.setBlur

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:1582-1593.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.
enabledbooleanNotrueOptional; default true.

Return fields

FieldTypeOptional
enabledjsonNo
successbooleanNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.setBlur', { windowId: /* value */, enabled: /* value */ });

Contract supplement: window.setDarkMode

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:1617-1627.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.
enabledbooleanNotrueOptional; default true.

Return fields

FieldTypeOptional
enabledjsonNo
successbooleanNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.setDarkMode', { windowId: /* value */, enabled: /* value */ });

Contract supplement: window.setFrameless

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:2088-2101.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.
framelessbooleanNotrueOptional; default true.

Return fields

FieldTypeOptional
errorstringYes
successbooleanNo
framelessjsonNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.setFrameless', { windowId: /* value */, frameless: /* value */ });

Contract supplement: window.setFullscreen

Verified contract supplement. Runtime authority: src/api/WindowApi.cpp:899-921.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowOptional; default caller window.
enabledbooleanNotrueOptional; default true.

Return fields

FieldTypeOptional
errorstringYes
fullscreenjsonNo
successbooleanNo

Semantics: omitted optional parameters use handler defaults; failure branches and error fields are defined by this source file.

js
const result = await fb2k.invoke('window.setFullscreen', { windowId: /* value */, enabled: /* value */ });

Runtime behavior and events

All window.* calls run in the context of the calling WebView unless a method accepts windowId. A value of main identifies the main shell; popup IDs are returned by window.createPopup and window.getAllWindows. Calls that require a standalone shell report an unsupported or not-found result in panel mode instead of silently targeting an unrelated window.

window.setDragRegions, window.setNoDragRegions, and click-through exclude regions accept CSS-pixel rectangles. The native handler converts them using the target window DPI. Popup-only operations such as click-through and close confirmation reject a main-window target.

The runtime emits window:stateChanged when shell state changes and routes window:beforeClose to the popup that requested close confirmation. Popup lifecycle and coordination events include window:popupOpened, window:popupClosed, window:message, window:behaviorChanged, window:backdropStateChanged, window:hoverStateChanged, window:minimizeSuppressed, and window:alwaysOnTopChanged. Event payloads are runtime data; callers should tolerate fields added by the shell.