Documentation/FbWindow
class

FbWindow

js/foo_uie_jsplitter.js:202

Controls the main foobar2000 application window.

Global state: every JSplitter panel accesses the same native foobar2000 window through fb.Window. Window geometry X, Y, Width, Height, the numeric MinWidth, MinHeight, MaxWidth, MaxHeight, and the numeric pseudo-caption rectangle defined by SetPseudoCaption are global host state. These numeric values are not automatically restored when a panel reloads or unloads.

Window UI settings such as FrameStyle, Fullscreen, MainMenuHidden, StatusBarHidden, MinSize, MaxSize, and pseudo-caption activation are tracked per panel. The most recent explicit assignment made by any live panel becomes the effective global value. When that panel reloads or unloads, its request is removed and the previous request from another live panel, if any, becomes effective again.

If no panel has a request, FrameStyle defaults to FrameStyle.Default, and the boolean settings default to false.

So getters return the effective global value, not the last value assigned by the current panel.

If both minimum and maximum limits are enabled for the same axis, keep the nonzero minimum less than or equal to the nonzero maximum. Contradictory limits are not a supported configuration.

WARNING!
Most methods described here, except for basic window positioning and resizing, are incompatible with plugins that provide similar functionality, such as foo_ui_wizard, foo_openhacks, or foo_ui_hacks. If you intend to use these methods, uninstall such components first. Running them together may cause conflicting behavior and is not a supported configuration.
Legacy geometry API: window.FoobarWindowX, window.FoobarWindowY, window.FoobarWindowWidth, window.FoobarWindowHeight and window.MoveFoobarWindow are deprecated compatibility APIs and will be removed in a future release. New code should use fb.Window geometry properties and Move instead.

Examples

Borderless window with size limits
fb.Window.MinWidth = 500;
fb.Window.MinHeight = 300;
fb.Window.MinSize = true;

fb.Window.MaxWidth = 1600;
fb.Window.MaxHeight = 1000;
fb.Window.MaxSize = true;

fb.Window.FrameStyle = FrameStyle.NoBorder;
Window mode state is shared between panels
// Panel A:
fb.Window.FrameStyle = FrameStyle.NoBorder;

// Panel B, executed later:
fb.Window.FrameStyle = FrameStyle.Default;
// FrameStyle.Default is now effective globally. If Panel B unloads or reloads without this line (e.g. commented),
// Panel A's still-live FrameStyle.NoBorder request becomes effective again.
property

FrameStyle

js/foo_uie_jsplitter.js:288
FrameStyle: FrameStyle = FrameStyle.Default

Controls the native frame style of the main window.

Use FrameStyle:

  • FrameStyle.Default - use the normal foobar2000 window frame.
  • FrameStyle.NoCaption - remove the caption while keeping the native resizable frame. Windows continues to handle resizing, including the thin top resize grip.
  • FrameStyle.NoBorder - remove both the caption and resizable frame. JSplitter restores edge/corner resizing itself.

In No border mode with Default User Interface, a visible native status bar owns its bottom-right size grip. That grip may interfere with resizing from the bottom-right corner; hiding the status bar avoids this limitation.

Throws

Error —

If the value is not a valid FrameStyle value.

property

Fullscreen

js/foo_uie_jsplitter.js:304
Fullscreen: boolean = false

Enables fullscreen mode on the monitor containing the main window. The window covers the full monitor area, including the taskbar.

The previous window placement is restored when fullscreen is disabled, then the current effective FrameStyle is reapplied. Minimum and maximum size limits do not clamp the window while fullscreen is active.

If fullscreen is changed while a modal JSplitter/foobar2000 dialog is open, the native transition is deferred until the modal dialog closes. The property still reports the current effective requested state during that time.

property

Height

js/foo_uie_jsplitter.js:281
Height: number = 0

Height of the outer main-window rectangle, including the non-client frame when present.

property

MaxHeight

js/foo_uie_jsplitter.js:378
MaxHeight: number = 0

Maximum height of the outer main-window rectangle when MaxSize is enabled. A value of 0 disables the maximum-height constraint while leaving the maximum-width constraint independent.

property

MaxSize

js/foo_uie_jsplitter.js:361
MaxSize: boolean = false

Enables the maximum main-window size defined by MaxWidth and MaxHeight. Setting this property to true immediately clamps the current window size when needed. Changing an active maximum width or height also clamps the current size immediately. A limit value of 0 means that the corresponding axis is not constrained.

property

MaxWidth

js/foo_uie_jsplitter.js:370
MaxWidth: number = 0

Maximum width of the outer main-window rectangle when MaxSize is enabled. A value of 0 disables the maximum-width constraint while leaving the maximum-height constraint independent.

property

MinHeight

js/foo_uie_jsplitter.js:353
MinHeight: number = 0

Minimum height of the outer main-window rectangle when MinSize is enabled. A value of 0 disables the minimum-height constraint while leaving the minimum-width constraint independent.

property

MinSize

js/foo_uie_jsplitter.js:336
MinSize: boolean = false

Enables the minimum main-window size defined by MinWidth and MinHeight. Setting this property to true immediately clamps the current window size when needed. Changing an active minimum width or height also clamps the current size immediately. A limit value of 0 means that the corresponding axis is not constrained.

property

MinWidth

js/foo_uie_jsplitter.js:345
MinWidth: number = 0

Minimum width of the outer main-window rectangle when MinSize is enabled. A value of 0 disables the minimum-width constraint while leaving the minimum-height constraint independent.

property

StatusBarHidden

js/foo_uie_jsplitter.js:326
StatusBarHidden: boolean = false

Hides the foobar2000 status bar.

Available only with Default User Interface (DUI). Reading or writing this property with Columns UI throws an error.

Throws

Error —

When Columns UI is active.

property

Width

js/foo_uie_jsplitter.js:274
Width: number = 0

Width of the outer main-window rectangle, including the non-client frame when present.

property

X

js/foo_uie_jsplitter.js:260
X: number = 0

X coordinate of the outer main-window rectangle in screen coordinates.

property

Y

js/foo_uie_jsplitter.js:267
Y: number = 0

Y coordinate of the outer main-window rectangle in screen coordinates.

method

ClearPseudoCaption

js/foo_uie_jsplitter.js:433
ClearPseudoCaption()

Removes the current panel's pseudo-caption request previously enabled by SetPseudoCaption. The stored rectangle coordinates are not cleared. The request is also removed automatically when the panel reloads or unloads; if another live panel has an active request, pseudo-caption remains enabled.

method

Move

js/foo_uie_jsplitter.js:386
Move(x, y, width, height)

Moves and resizes the main foobar2000 window in one operation. The arguments describe the outer window rectangle in screen coordinates.

Parameters

NameTypeDescription
xnumber

X coordinate in screen coordinates.

ynumber

Y coordinate in screen coordinates.

widthnumber

Outer window width.

heightnumber

Outer window height.

method

MoveStart

js/foo_uie_jsplitter.js:397
MoveStart()

Starts the native Windows move operation for the main foobar2000 window, as if the user had started dragging its caption. This is useful when the script needs to decide dynamically whether a mouse action should start moving the window. For a fixed draggable area, SetPseudoCaption is usually simpler. The move loop is started asynchronously, so the JavaScript callback is not kept running for the duration of the drag.

Example

function on_mouse_lbtn_down(x, y) {
    if (y < 30) {
        fb.Window.MoveStart();
    }
}
method

SetPseudoCaption

js/foo_uie_jsplitter.js:411
SetPseudoCaption(x, y, width, height)

Defines a rectangular pseudo-caption area for the main foobar2000 window. Pressing the left mouse button anywhere inside this area starts the native Windows move operation, including when the pointer is over a child window such as a JSplitter panel. This provides a persistent alternative to calling MoveStart from a mouse callback and is especially useful with FrameStyle set to FrameStyle.NoCaption or FrameStyle.NoBorder.

The coordinates are pixel offsets from the top-left corner of the outer main-window rectangle. Calling this method again replaces the stored global rectangle and enables pseudo-caption for the current panel. The rectangle values remain stored globally, but the active request belongs to the panel and is automatically removed when that panel reloads or unloads. If another live panel has an active pseudo-caption request, it becomes effective again using the current stored rectangle.

With FrameStyle.NoBorder, resize edges take precedence over the pseudo-caption area. The pseudo-caption does not start a move operation while the main window is fullscreen or maximized. A left click inside the rectangle is consumed for window dragging, so interactive controls should not be placed inside it.

To unset pseudo-caption use ClearPseudoCaption

Parameters

NameTypeDescription
xnumber

Horizontal offset from the left edge of the outer main-window rectangle.

ynumber

Vertical offset from the top edge of the outer main-window rectangle.

widthnumber

Width of the pseudo-caption rectangle. Must be greater than 0.

heightnumber

Height of the pseudo-caption rectangle. Must be greater than 0.

Throws

Error —

If width or height is not greater than 0.

Example

fb.Window.FrameStyle = FrameStyle.NoBorder;
fb.Window.SetPseudoCaption(8, 8, 400, 32);