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 ​

No parameters.

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

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

window.broadcast ​

ParameterTypeRequiredDescription
messagejsonYesJSON message body delivered to every window except the sender via window:message.

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

js
await fb2k.invoke('window.broadcast', { message: { type: 'themeChanged', theme: 'dark' } });

window.cancelClose ​

No parameters.

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

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

window.center ​

No parameters.

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

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

window.clearClickThroughExcludeRegions ​

ParameterTypeRequiredDescription
windowIdstringNoPopups only; may be omitted when calling from the target popup itself.

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

js
// popup-scoped; omit windowId only when calling from the popup itself
await fb2k.invoke('window.clearClickThroughExcludeRegions', { windowId: 'popup-1' });

window.clearDragRegions ​

No parameters.

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

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

window.clearNoDragRegions ​

No parameters.

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

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

window.close ​

No parameters.

Returns: {"success":true}

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

window.closeAllPopups ​

No parameters.

Returns: {"success":true}

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

window.closePopup ​

ParameterTypeRequiredDescription
windowIdstringYesPopup id to close; no fallback to the calling window.

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

js
// windowId is required here; there is no fallback to the calling window
await fb2k.invoke('window.closePopup', { windowId: 'popup-1' });

window.confirmClose ​

No parameters.

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

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

window.createPopup ​

ParameterTypeRequiredDefaultDescription
urlstringNo—Page loaded into the popup.
titlestringNo—
xintegerNosystem defaultSystem placement when omitted (CW_USEDEFAULT).
yintegerNosystem default
widthintegerNo400
heightintegerNo300
minWidthintegerNo200
minHeightintegerNo150
maxWidthintegerNo00 means no upper bound.
maxHeightintegerNo00 means no upper bound.
resizablebooleanNotrue
framebooleanNotruefalse creates a borderless popup.
transparentbooleanNofalseTransparent background.
alwaysOnTopbooleanNofalse
showInTaskbarbooleanNofalse
clickThroughbooleanNofalseMouse click-through.
beforeClosebooleanNofalseEmits window:beforeClose for close confirmation.
profilestringNo—Behavior preset: standard / miniPlayer / desktopLyrics.
behaviorobjectNo—Behavior overrides (see setPopupBehavior).
backdropPolicyobjectNo—Backdrop policy (see setBackdropPolicy).

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

js
const { windowId } = await fb2k.invoke('window.createPopup', {
    url: 'popup.html',
    width: 480,
    height: 320,
    title: 'Now Playing',
});

window.enterFullscreen ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window

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

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

window.exitFullscreen ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window

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

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

window.flash ​

ParameterTypeRequiredDefaultDescription
countintegerNo3Flash count.
enabledbooleanNotrue

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

js
// omit count and enabled to start flashing 3 times
await fb2k.invoke('window.flash');

window.flashTaskbar ​

ParameterTypeRequiredDefaultDescription
countintegerNo3Flash count.

Returns: {"success":true}

js
// omit count to flash 3 times
await fb2k.invoke('window.flashTaskbar');

window.focus ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowmain or a popup id.

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

js
// omit windowId to focus the calling window
await fb2k.invoke('window.focus');

window.getAllWindows ​

No parameters.

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

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

window.getBackdropPolicy ​

Reads a window's DWM backdrop policy. Supports both the main window and popups.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowTarget window.

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

resolvedBackdropPolicy is the effective policy after profile defaults are applied. A window that cannot be resolved returns { "success": false, "error": "..." }.

js
// omit windowId to read the calling window
const { resolvedBackdropPolicy } = await fb2k.invoke('window.getBackdropPolicy');

window.getBounds ​

No parameters.

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

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

window.getCaptionButtonsWidth ​

Reports the geometry of the main window's custom-drawn caption buttons (minimise / maximise / close), for frontends that render their own titlebar. Main window only: it does not accept windowId and ignores the calling window. Popups have no custom-drawn caption buttons, so there is no popup-scoped value to report.

No parameters.

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

Values are physical pixels and track the main window's DPI. When no main window exists the call returns the DIP-baseline defaults (width: 138, buttonWidth: 46) rather than an error, so callers cannot distinguish "no window" from a genuine 100%-scale measurement.

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

window.getCornerPreference ​

Returns the main window's Windows 11 corner-rounding preference; mode and preference are the same value under two names. Main window only: it does not accept windowId and ignores the calling window. Popups do not expose this setting — they manage corner rounding internally (rounded when borderless, system default otherwise) and report supportsCornerPreference: false in their capabilities.

No parameters.

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

When no main window exists the call returns "default" rather than an error.

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

window.getCurrentWindowId ​

No parameters.

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

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

window.getDevServerConfig ​

No parameters.

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

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

window.getDpiScale ​

No parameters.

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

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

window.getMaxSize ​

Reads a window's requested maximum size. Resolution selects the explicit windowId or the calling window; it does not fall back to the main window, so a call from an unresolvable context fails instead of silently reporting another window's constraints. Panel (DUI/CUI) callers are rejected with panelMode: true, because a panel is not a window shell.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowTarget window.

Returns: {"height":"...","success":true,"width":"...","windowId":"..."}. A window that cannot be resolved returns { "success": false, "error": "..." }.

Values are physical pixels; the host stores constraints in DIPs and converts using the target window's DPI. 0 means "no upper bound" and survives the conversion exactly.

The returned values are the requested constraints, not the currently effective window size. A physical → DIP → physical round-trip is quantized to whole DIPs, so at non-100% scaling get may differ from the value passed to set by up to 1px per axis (for example, 202px at 125% reads back as 203px). Treat the getters as reporting the constraint you set to within ±1px rather than byte-for-byte. 0 is exempt.

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

window.getMinSize ​

Reads a window's requested minimum size. Resolution selects the explicit windowId or the calling window; it does not fall back to the main window, so a call from an unresolvable context fails instead of silently reporting another window's constraints. Panel (DUI/CUI) callers are rejected with panelMode: true, because a panel is not a window shell.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowTarget window.

Returns: {"height":"...","success":true,"width":"...","windowId":"..."}. A window that cannot be resolved returns { "success": false, "error": "..." }.

Values are physical pixels; the host stores constraints in DIPs and converts using the target window's DPI.

The returned values are the requested constraints, not the currently effective window size. A physical → DIP → physical round-trip is quantized to whole DIPs, so at non-100% scaling get may differ from the value passed to set by up to 1px per axis (for example, 202px at 125% reads back as 203px). Treat the getters as reporting the constraint you set to within ±1px rather than byte-for-byte.

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

window.getMode ​

No parameters.

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

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

window.getPopupBehavior ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocalling popupPopups only.

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

js
const info = await fb2k.invoke('window.getPopupBehavior', { windowId: 'popup-1' });

window.getState ​

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 ​

No parameters.

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

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

window.getTitlebarHeight ​

No parameters.

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

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

window.getTitlebarInfo ​

Bundles the main window's titlebar height with its custom-drawn caption-button geometry and maximised state. Main window only: it does not accept windowId and ignores the calling window. Three of the four fields have no popup equivalent — popups expose only a titlebar height and have no custom-drawn caption buttons — so the call stays main-scoped rather than returning zeros for the missing fields.

No parameters.

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

Values are physical pixels and track the main window's DPI. When no main window exists the call returns the DIP-baseline defaults (height: 32, captionButtonsWidth: 138, captionButtonWidth: 46) rather than an error; those fallbacks are unscaled, so on non-100% displays they differ in unit from the normal path.

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

window.getZoom ​

No parameters.

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

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

window.hasSavedBounds ​

No parameters.

Returns: {"description":"...","hasSavedBounds":"..."}

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

window.isAlwaysOnTop ​

No parameters.

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

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

window.isClickThrough ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowPopups only.

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

js
const { clickThrough } = await fb2k.invoke('window.isClickThrough', { windowId: 'popup-1' });

window.isFullscreen ​

ParameterTypeRequiredDescription
windowIdstringNoTarget window id. Defaults to the calling window.

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

js
// omit windowId to query the calling window
const { isFullscreen } = await fb2k.invoke('window.isFullscreen');

window.isMaximized ​

No parameters.

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

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

window.isMinimized ​

No parameters.

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

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

window.isResizable ​

Reports a window's requested resizable state. Resolution selects the explicit windowId or the calling window; it does not fall back to the main window. Panel (DUI/CUI) callers are rejected with panelMode: true.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowTarget window.

Returns: {"resizable":"...","success":true,"windowId":"..."}. A window that cannot be resolved returns { "success": false, "error": "..." }.

Every window shell — including fully borderless popups — supports changing this at runtime via window.setResizable.

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

window.maximize ​

No parameters.

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

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

window.minimize ​

No parameters.

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

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

window.refreshWebView ​

No parameters.

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

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

window.reload ​

No parameters.

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

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

window.resetZoom ​

No parameters.

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

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

window.restore ​

No parameters.

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

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

window.sendMessage ​

ParameterTypeRequiredDescription
targetWindowIdstringYesTarget window id (main or a popup id).
messagejsonYesArbitrary JSON delivered via the window:message event.

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

js
await fb2k.invoke('window.sendMessage', {
    targetWindowId: 'popup-1',
    message: { type: 'seek', position: 42 },
});

window.setAcrylic ​

Applies or clears the acrylic backdrop. Not supported in panel mode.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
enabledbooleanNotrue
darkModebooleanNocurrent mode

Returns: { "success": true, "enabled": true }, plus darkMode echoed back only when you supplied it.

success reports whether the backdrop was actually applied, so it can be false even for a valid window when the platform refuses the effect.

js
await fb2k.invoke('window.setAcrylic', { enabled: true, darkMode: true });

window.setAlwaysOnTop ​

ParameterTypeRequiredDefaultDescription
enabledbooleanNotrue

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

js
await fb2k.invoke('window.setAlwaysOnTop', { enabled: true });

window.setBackdropPolicy ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
backdropPolicyobjectYes—Field-level patch; a null field resets it to the default.

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

js
await fb2k.invoke('window.setBackdropPolicy', {
    backdropPolicy: { activeEffect: 'acrylic', darkMode: true },
});

window.setBackgroundTransparency ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
transparentbooleanNotrue

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

js
await fb2k.invoke('window.setBackgroundTransparency', { transparent: true });

window.setBlur ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
enabledbooleanNotrue

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

js
await fb2k.invoke('window.setBlur', { enabled: true });

window.setBounds ​

ParameterTypeRequiredDefaultDescription
xintegerNocurrent value
yintegerNocurrent value
widthintegerNocurrent value
heightintegerNocurrent value

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

js
await fb2k.invoke('window.setBounds', { x: 100, y: 100, width: 480, height: 320 });

window.setClickThrough ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowPopups only.
enabledbooleanNotrue

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

js
await fb2k.invoke('window.setClickThrough', { enabled: true });

window.setClickThroughExcludeRegions ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocalling popupPopups only.
regionsarrayNo—CSS-pixel rectangles { x, y, width, height }.

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

js
await fb2k.invoke('window.setClickThroughExcludeRegions', {
    regions: [{ x: 12, y: 12, width: 160, height: 40 }],
});

window.setCornerPreference ​

Sets the main window's Windows 11 corner-rounding preference. Main window only: it does not accept windowId and ignores the calling window. Popups do not accept this setting — they manage corner rounding internally and report supportsCornerPreference: false — so the call has no popup-scoped form. Panel (DUI/CUI) callers are rejected with panelMode: true.

ParameterTypeRequiredDescription
modestringNo"default", "none", "round" or "small"; defaults to "default".

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

"default" maps to rounded corners, because a borderless window has no standard non-client frame for the system default to apply to.

js
await fb2k.invoke('window.setCornerPreference', { mode: 'round' });

window.setDarkMode ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
enabledbooleanNotrue

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

js
await fb2k.invoke('window.setDarkMode', { enabled: true });

window.setDevServerConfig ​

ParameterTypeRequiredDefaultDescription
useDevServerbooleanNofalse
devServerUrlstringNo—Dev server address, e.g. http://localhost:5173.

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

js
await fb2k.invoke('window.setDevServerConfig', {
    useDevServer: true,
    devServerUrl: 'http://localhost:5173',
});

window.setDragRegions ​

ParameterTypeRequiredDescription
regionsarrayNoCSS-pixel rectangles { x, y, width, height }.

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

js
await fb2k.invoke('window.setDragRegions', {
    regions: [{ x: 0, y: 0, width: 800, height: 32 }],
});

window.setFrameless ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
framelessbooleanNotrue

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

js
await fb2k.invoke('window.setFrameless', { frameless: true });

window.setFullscreen ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
enabledbooleanNotrue

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

js
await fb2k.invoke('window.setFullscreen', { enabled: true });

window.setMaxSize ​

Sets a window's maximum size. Resolution selects the explicit windowId or the calling window; it never falls back to the main window, so a call from an unresolvable context fails rather than resizing an unintended window. Panel (DUI/CUI) callers are rejected with panelMode: true.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowTarget window.
widthintegerNo0
heightintegerNo0

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

Values are physical pixels, converted to the host's DIP storage using the target window's DPI; 0 (or negative) clears the bound. Applying a constraint re-validates the current window size immediately, so a window already larger than the new maximum is shrunk rather than waiting for the next user resize.

js
await fb2k.invoke('window.setMaxSize', { width: 1920, height: 1080 });

window.setMica ​

Applies or clears the Mica backdrop. Not supported in panel mode.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
enabledbooleanNotrue
variantstringNomicamica or mica-alt.
darkModebooleanNocurrent mode

Returns: { "success": true, "enabled": true, "variant": "mica" }, plus darkMode echoed back only when you supplied it.

Only mica-alt selects the alternate variant; every other value — including an unrecognized one — is normalized to mica rather than rejected. The returned variant echoes that normalized request, not the effect that ended up on screen: popups do not support Mica Alt and are downgraded, so variant: "mica-alt" can come back for a window that received a different backdrop. success reports whether the backdrop was actually applied and can be false for a valid window when the platform refuses the effect.

js
await fb2k.invoke('window.setMica', { enabled: true, variant: 'mica-alt' });

window.setMicaEffect ​

Compatibility alias of window.setMica. Same parameters, same behavior, same return shape — prefer window.setMica in new code. Because both share one implementation, the panel-mode rejection names window.setMica even when you called this alias.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window
enabledbooleanNotrue
variantstringNomicamica or mica-alt.
darkModebooleanNocurrent mode

Returns: { "success": true, "enabled": true, "variant": "mica" }, plus darkMode echoed back only when you supplied it.

js
await fb2k.invoke('window.setMicaEffect', { enabled: true });

window.setMinSize ​

Sets a window's minimum size. Resolution selects the explicit windowId or the calling window; it never falls back to the main window, so a call from an unresolvable context fails rather than resizing an unintended window. Panel (DUI/CUI) callers are rejected with panelMode: true.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowTarget window.
widthintegerNo0
heightintegerNo0

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

Values are physical pixels, converted to the host's DIP storage using the target window's DPI, which keeps the constraint stable across DPI changes. Non-positive values normalise to a 1px floor. Applying a constraint re-validates the current window size immediately, so a window already smaller than the new minimum is grown rather than waiting for the next user resize.

js
await fb2k.invoke('window.setMinSize', { width: 480, height: 320 });

window.setNoDragRegions ​

ParameterTypeRequiredDescription
regionsarrayNoCSS-pixel rectangles { x, y, width, height }.

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

js
await fb2k.invoke('window.setNoDragRegions', {
    regions: [{ x: 690, y: 0, width: 110, height: 32 }],
});

window.setPopupBehavior ​

Updates a popup's behavior policy at runtime. Popups only — the main window is not a valid target.

ParameterTypeRequiredDefaultDescription
windowIdstringNocalling popupTarget popup id.
profilestringNocurrent profilestandard, miniPlayer, or desktopLyrics.
behaviorobjectNo—Field-level overrides. Applied only when supplied.

Returns: { "success": true, "windowId": "...", "profile": "...", "behavior": { ... }, "resolvedBehavior": { ... } }

resolvedBehavior is the effective policy after the profile defaults and your overrides are merged. profile and behavior are independent: supplying one does not reset the other, and a null value inside behavior erases that override rather than storing null.

Profile matching is case-insensitive and also accepts hyphen and underscore spellings, so miniPlayer, miniplayer, mini-player, and mini_player are equivalent. The returned profile is always one of the three canonical names.

Passing windowId: "main" fails with window.setPopupBehavior does not support main window. Omitting windowId requires the caller to itself be a popup, otherwise the call fails with Window not found.

js
// switch profile only
await fb2k.invoke('window.setPopupBehavior', { profile: 'miniPlayer' });
// field-level override, keeping the current profile
await fb2k.invoke('window.setPopupBehavior', { behavior: { closeOnFocusLoss: true } });

window.setPosition ​

ParameterTypeRequiredDefaultDescription
xintegerNo0
yintegerNo0

Returns: {"success":true}

js
await fb2k.invoke('window.setPosition', { x: 100, y: 100 });

window.setResizable ​

Sets whether a window can be resized by the user. Resolution selects the explicit windowId or the calling window; it never falls back to the main window. Panel (DUI/CUI) callers are rejected with panelMode: true. Setting the value a window already has succeeds — idempotent calls are not failures.

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller windowTarget window.
resizablebooleanNotrue

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

Every window shell supports this at runtime, including fully borderless popups (frame: false plus transparent: true with no backdrop effect): those windows collapse their entire non-client area, so adding a sizing border changes hit-testing without altering appearance. success: false therefore indicates a genuine Win32 failure — the style could not be written, or the frame could not be refreshed — not an unsupported window shape; the requested state is not committed in that case.

Behavior change

This call previously always targeted the main window regardless of caller, so invoking it from a popup reconfigured the main window instead.

js
await fb2k.invoke('window.setResizable', { resizable: false });

window.setSize ​

ParameterTypeRequiredDefaultDescription
widthintegerNo800
heightintegerNo600

Returns: {"success":true}

js
await fb2k.invoke('window.setSize', { width: 1024, height: 640 });

window.setTitle ​

ParameterTypeRequiredDefaultDescription
titlestringNofoobar2000

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

js
await fb2k.invoke('window.setTitle', { title: 'Now Playing' });

window.setTitlebarHeight ​

ParameterTypeRequiredDefaultDescription
heightintegerNo32Valid range 24–100.

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

js
await fb2k.invoke('window.setTitlebarHeight', { height: 40 });

window.setZoom ​

ParameterTypeRequiredDefaultDescription
zoomnumberNo1Zoom factor, e.g. 1.25.

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

js
await fb2k.invoke('window.setZoom', { zoom: 1.25 });

window.setZoomForDpi ​

ParameterTypeRequiredDefaultDescription
dpiintegerNo0Omit or 0 to derive from the calling window's current DPI.

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

js
// omit dpi to derive the zoom from the calling window's current DPI
const { zoom } = await fb2k.invoke('window.setZoomForDpi');

window.showSystemMenu ​

ParameterTypeRequiredDefaultDescription
xintegerNo0Exclusion area left; without w/h, x/y are used as the menu position.
yintegerNo0Exclusion area top.
wintegerNo0Exclusion area width.
hintegerNo0Exclusion area height.

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

js
// pass w/h to keep the menu clear of the button that opened it
await fb2k.invoke('window.showSystemMenu', { x: 8, y: 0, w: 32, h: 32 });

window.startDrag ​

No parameters.

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

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

window.startResize ​

ParameterTypeRequiredDefaultDescription
edgestringNobottomrightEdge or corner to drag.

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

js
await fb2k.invoke('window.startResize', { edge: 'bottomright' });

window.toggleAlwaysOnTop ​

No parameters.

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

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

window.toggleFullscreen ​

ParameterTypeRequiredDefaultDescription
windowIdstringNocaller window

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

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

window.toggleMaximize ​

No parameters.

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

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

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.