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}
const result = await fb2k.invoke('window.blur');window.broadcast
| Parameter | Type | Required | Description |
|---|---|---|---|
message | json | Yes | JSON message body delivered to every window except the sender via window:message. |
Returns: {"error":"...","success":true}
await fb2k.invoke('window.broadcast', { message: { type: 'themeChanged', theme: 'dark' } });window.cancelClose
No parameters.
Returns: {"error":"...","success":true}
const result = await fb2k.invoke('window.cancelClose');window.center
No parameters.
Returns: {"error":"...","success":true}
const result = await fb2k.invoke('window.center');window.clearClickThroughExcludeRegions
| Parameter | Type | Required | Description |
|---|---|---|---|
windowId | string | No | Popups only; may be omitted when calling from the target popup itself. |
Returns: {"error":"...","success":true,"windowId":"..."}
// 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}
const result = await fb2k.invoke('window.clearDragRegions');window.clearNoDragRegions
No parameters.
Returns: {"error":"...","success":true}
const result = await fb2k.invoke('window.clearNoDragRegions');window.close
No parameters.
Returns: {"success":true}
const result = await fb2k.invoke('window.close');window.closeAllPopups
No parameters.
Returns: {"success":true}
const result = await fb2k.invoke('window.closeAllPopups');window.closePopup
| Parameter | Type | Required | Description |
|---|---|---|---|
windowId | string | Yes | Popup id to close; no fallback to the calling window. |
Returns: {"error":"...","success":true}
// 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}
const result = await fb2k.invoke('window.confirmClose');window.createPopup
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | No | — | Page loaded into the popup. |
title | string | No | — | |
x | integer | No | system default | System placement when omitted (CW_USEDEFAULT). |
y | integer | No | system default | |
width | integer | No | 400 | |
height | integer | No | 300 | |
minWidth | integer | No | 200 | |
minHeight | integer | No | 150 | |
maxWidth | integer | No | 0 | 0 means no upper bound. |
maxHeight | integer | No | 0 | 0 means no upper bound. |
resizable | boolean | No | true | |
frame | boolean | No | true | false creates a borderless popup. |
transparent | boolean | No | false | Transparent background. |
alwaysOnTop | boolean | No | false | |
showInTaskbar | boolean | No | false | |
clickThrough | boolean | No | false | Mouse click-through. |
beforeClose | boolean | No | false | Emits window:beforeClose for close confirmation. |
profile | string | No | — | Behavior preset: standard / miniPlayer / desktopLyrics. |
behavior | object | No | — | Behavior overrides (see setPopupBehavior). |
backdropPolicy | object | No | — | Backdrop policy (see setBackdropPolicy). |
Returns: {"error":"...","success":true,"windowId":"..."}
const { windowId } = await fb2k.invoke('window.createPopup', {
url: 'popup.html',
width: 480,
height: 320,
title: 'Now Playing',
});window.enterFullscreen
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window |
Returns: {"error":"...","isFullscreen":"...","success":true}
const result = await fb2k.invoke('window.enterFullscreen');window.exitFullscreen
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window |
Returns: {"error":"...","isFullscreen":"...","success":true}
const result = await fb2k.invoke('window.exitFullscreen');window.flash
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
count | integer | No | 3 | Flash count. |
enabled | boolean | No | true |
Returns: {"error":"...","success":true}
// omit count and enabled to start flashing 3 times
await fb2k.invoke('window.flash');window.flashTaskbar
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
count | integer | No | 3 | Flash count. |
Returns: {"success":true}
// omit count to flash 3 times
await fb2k.invoke('window.flashTaskbar');window.focus
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | main or a popup id. |
Returns: {"error":"...","success":true}
// omit windowId to focus the calling window
await fb2k.invoke('window.focus');window.getAllWindows
No parameters.
Returns: {"items":"...","success":true}
const result = await fb2k.invoke('window.getAllWindows');window.getBackdropPolicy
Reads a window's DWM backdrop policy. Supports both the main window and popups.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Target 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": "..." }.
// omit windowId to read the calling window
const { resolvedBackdropPolicy } = await fb2k.invoke('window.getBackdropPolicy');window.getBounds
No parameters.
Returns: {"height":"...","width":"...","x":"...","y":"..."}
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.
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.
const result = await fb2k.invoke('window.getCornerPreference');window.getCurrentWindowId
No parameters.
Returns: {"success":true,"windowId":"..."}
const result = await fb2k.invoke('window.getCurrentWindowId');window.getDevServerConfig
No parameters.
Returns: {"devServerUrl":"...","success":true,"useDevServer":"..."}
const result = await fb2k.invoke('window.getDevServerConfig');window.getDpiScale
No parameters.
Returns: {"dpi":"...","scale":"...","success":true}
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Target 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.
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Target 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.
const result = await fb2k.invoke('window.getMinSize');window.getMode
No parameters.
Returns: {"mode":"...","panel":"...","panelMode":"...","windowId":"..."}
const result = await fb2k.invoke('window.getMode');window.getPopupBehavior
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | calling popup | Popups only. |
Returns: {"success":true,"windowId":"..."}
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":"..."}
const result = await fb2k.invoke('window.getState');window.getTitle
No parameters.
Returns: {"title":"..."}
const result = await fb2k.invoke('window.getTitle');window.getTitlebarHeight
No parameters.
Returns: {"height":"..."}
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.
const result = await fb2k.invoke('window.getTitlebarInfo');window.getZoom
No parameters.
Returns: {"dpi":"...","dpiScale":"...","success":true,"zoom":"..."}
const result = await fb2k.invoke('window.getZoom');window.hasSavedBounds
No parameters.
Returns: {"description":"...","hasSavedBounds":"..."}
const result = await fb2k.invoke('window.hasSavedBounds');window.isAlwaysOnTop
No parameters.
Returns: {"enabled":"...","isAlwaysOnTop":"..."}
const result = await fb2k.invoke('window.isAlwaysOnTop');window.isClickThrough
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Popups only. |
Returns: {"clickThrough":"...","error":"...","success":true}
const { clickThrough } = await fb2k.invoke('window.isClickThrough', { windowId: 'popup-1' });window.isFullscreen
| Parameter | Type | Required | Description |
|---|---|---|---|
windowId | string | No | Target window id. Defaults to the calling window. |
Returns: {"fullscreen":"...","isFullscreen":"..."}
// omit windowId to query the calling window
const { isFullscreen } = await fb2k.invoke('window.isFullscreen');window.isMaximized
No parameters.
Returns: {"isMaximized":"...","maximized":"..."}
const result = await fb2k.invoke('window.isMaximized');window.isMinimized
No parameters.
Returns: {"minimized":"..."}
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Target 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.
const result = await fb2k.invoke('window.isResizable');window.maximize
No parameters.
Returns: {"error":"...","success":true}
const result = await fb2k.invoke('window.maximize');window.minimize
No parameters.
Returns: {"error":"...","success":true}
const result = await fb2k.invoke('window.minimize');window.refreshWebView
No parameters.
Returns: {"error":"...","success":true}
const result = await fb2k.invoke('window.refreshWebView');window.reload
No parameters.
Returns: {"error":"...","success":true}
const result = await fb2k.invoke('window.reload');window.resetZoom
No parameters.
Returns: {"error":"...","success":true,"zoom":"..."}
const result = await fb2k.invoke('window.resetZoom');window.restore
No parameters.
Returns: {"error":"...","success":true}
const result = await fb2k.invoke('window.restore');window.sendMessage
| Parameter | Type | Required | Description |
|---|---|---|---|
targetWindowId | string | Yes | Target window id (main or a popup id). |
message | json | Yes | Arbitrary JSON delivered via the window:message event. |
Returns: {"error":"...","success":true}
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
enabled | boolean | No | true | |
darkMode | boolean | No | current 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.
await fb2k.invoke('window.setAcrylic', { enabled: true, darkMode: true });window.setAlwaysOnTop
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
enabled | boolean | No | true |
Returns: {"error":"...","success":true}
await fb2k.invoke('window.setAlwaysOnTop', { enabled: true });window.setBackdropPolicy
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
backdropPolicy | object | Yes | — | Field-level patch; a null field resets it to the default. |
Returns: {"error":"...","success":true}
await fb2k.invoke('window.setBackdropPolicy', {
backdropPolicy: { activeEffect: 'acrylic', darkMode: true },
});window.setBackgroundTransparency
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
transparent | boolean | No | true |
Returns: {"description":"...","error":"...","success":true,"transparent":"..."}
await fb2k.invoke('window.setBackgroundTransparency', { transparent: true });window.setBlur
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
enabled | boolean | No | true |
Returns: {"enabled":"...","success":true}
await fb2k.invoke('window.setBlur', { enabled: true });window.setBounds
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x | integer | No | current value | |
y | integer | No | current value | |
width | integer | No | current value | |
height | integer | No | current value |
Returns: {"error":"...","success":true}
await fb2k.invoke('window.setBounds', { x: 100, y: 100, width: 480, height: 320 });window.setClickThrough
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Popups only. |
enabled | boolean | No | true |
Returns: {"clickThrough":"...","error":"...","success":true}
await fb2k.invoke('window.setClickThrough', { enabled: true });window.setClickThroughExcludeRegions
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | calling popup | Popups only. |
regions | array | No | — | CSS-pixel rectangles { x, y, width, height }. |
Returns: {"count":0,"dpiScale":"...","success":true,"warning":"...","windowId":"..."}
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.
| Parameter | Type | Required | Description |
|---|---|---|---|
mode | string | No | "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.
await fb2k.invoke('window.setCornerPreference', { mode: 'round' });window.setDarkMode
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
enabled | boolean | No | true |
Returns: {"enabled":"...","success":true}
await fb2k.invoke('window.setDarkMode', { enabled: true });window.setDevServerConfig
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
useDevServer | boolean | No | false | |
devServerUrl | string | No | — | Dev server address, e.g. http://localhost:5173. |
Returns: {"devServerUrl":"...","success":true,"useDevServer":"..."}
await fb2k.invoke('window.setDevServerConfig', {
useDevServer: true,
devServerUrl: 'http://localhost:5173',
});window.setDragRegions
| Parameter | Type | Required | Description |
|---|---|---|---|
regions | array | No | CSS-pixel rectangles { x, y, width, height }. |
Returns: {"count":"...","dpiScale":"...","error":"...","success":true}
await fb2k.invoke('window.setDragRegions', {
regions: [{ x: 0, y: 0, width: 800, height: 32 }],
});window.setFrameless
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
frameless | boolean | No | true |
Returns: {"error":"...","frameless":"...","success":true}
await fb2k.invoke('window.setFrameless', { frameless: true });window.setFullscreen
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
enabled | boolean | No | true |
Returns: {"error":"...","fullscreen":"...","success":true}
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Target window. |
width | integer | No | 0 | |
height | integer | No | 0 |
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.
await fb2k.invoke('window.setMaxSize', { width: 1920, height: 1080 });window.setMica
Applies or clears the Mica backdrop. Not supported in panel mode.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
enabled | boolean | No | true | |
variant | string | No | mica | mica or mica-alt. |
darkMode | boolean | No | current 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.
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | |
enabled | boolean | No | true | |
variant | string | No | mica | mica or mica-alt. |
darkMode | boolean | No | current mode |
Returns: { "success": true, "enabled": true, "variant": "mica" }, plus darkMode echoed back only when you supplied it.
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Target window. |
width | integer | No | 0 | |
height | integer | No | 0 |
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.
await fb2k.invoke('window.setMinSize', { width: 480, height: 320 });window.setNoDragRegions
| Parameter | Type | Required | Description |
|---|---|---|---|
regions | array | No | CSS-pixel rectangles { x, y, width, height }. |
Returns: {"count":"...","dpiScale":"...","error":"...","success":true}
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | calling popup | Target popup id. |
profile | string | No | current profile | standard, miniPlayer, or desktopLyrics. |
behavior | object | No | — | 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.
// 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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x | integer | No | 0 | |
y | integer | No | 0 |
Returns: {"success":true}
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.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window | Target window. |
resizable | boolean | No | true |
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.
await fb2k.invoke('window.setResizable', { resizable: false });window.setSize
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
width | integer | No | 800 | |
height | integer | No | 600 |
Returns: {"success":true}
await fb2k.invoke('window.setSize', { width: 1024, height: 640 });window.setTitle
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
title | string | No | foobar2000 |
Returns: {"error":"...","success":true}
await fb2k.invoke('window.setTitle', { title: 'Now Playing' });window.setTitlebarHeight
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
height | integer | No | 32 | Valid range 24–100. |
Returns: {"error":"...","height":"...","success":true}
await fb2k.invoke('window.setTitlebarHeight', { height: 40 });window.setZoom
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
zoom | number | No | 1 | Zoom factor, e.g. 1.25. |
Returns: {"error":"...","success":true,"zoom":"..."}
await fb2k.invoke('window.setZoom', { zoom: 1.25 });window.setZoomForDpi
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
dpi | integer | No | 0 | Omit or 0 to derive from the calling window's current DPI. |
Returns: {"dpi":"...","error":"...","success":true,"zoom":"..."}
// omit dpi to derive the zoom from the calling window's current DPI
const { zoom } = await fb2k.invoke('window.setZoomForDpi');window.showSystemMenu
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
x | integer | No | 0 | Exclusion area left; without w/h, x/y are used as the menu position. |
y | integer | No | 0 | Exclusion area top. |
w | integer | No | 0 | Exclusion area width. |
h | integer | No | 0 | Exclusion area height. |
Returns: {"error":"...","success":true}
// 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}
const result = await fb2k.invoke('window.startDrag');window.startResize
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
edge | string | No | bottomright | Edge or corner to drag. |
Returns: {"error":"...","success":true}
await fb2k.invoke('window.startResize', { edge: 'bottomright' });window.toggleAlwaysOnTop
No parameters.
Returns: {"enabled":"...","success":true}
const result = await fb2k.invoke('window.toggleAlwaysOnTop');window.toggleFullscreen
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
windowId | string | No | caller window |
Returns: {"error":"...","fullscreen":"...","success":true}
const result = await fb2k.invoke('window.toggleFullscreen');window.toggleMaximize
No parameters.
Returns: {"maximized":"...","success":true}
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.