BrowserWindowOptions
Options for creating a new browser window.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
size: { width: 800, height: 600 },
url: 'https://example.com'
})
win.show()
Properties
title
readonly title?: string;
The title of the window.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
title: 'My Window'
})
size
readonly size?: Size;
The window size.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
size: { width: 800, height: 600 }
})
minimumSize
readonly minimumSize?: Size;
The window minimum size. By default, the minimum size of the window is 1x1.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
minimumSize: { width: 200, height: 100 }
})
position
readonly position?: Point;
The window position on the screen relative to the primary display.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
position: { x: 100, y: 100 }
})
resizable
readonly resizable?: boolean;
Whether the window should be resizable.
By default, the window is resizable.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
resizable: false
})
alwaysOnTop
readonly alwaysOnTop?: boolean;
Whether the window should be always on top.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
alwaysOnTop: true
})
transparentBackground
readonly transparentBackground?: boolean;
Whether the window background should be transparent on macOS.
On Windows and Linux, this property is ignored.
By default, the window background is not transparent.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
transparentBackground: true
})
opacity
readonly opacity?: number;
The opacity of the window. Valid values are between 0.0 (fully transparent) and 1.0 (fully opaque). By default, the opacity is 1.0. On Linux, this property is ignored. Out of bound number values are clamped to the [0, 1] range.
When the window background is transparent, the window opacity is ignored.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
opacity: 0.5
})
hasShadow
readonly hasShadow?: boolean;
Whether the window should have a shadow on macOS. On Windows and Linux, this property is ignored.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
hasShadow: true
})
windowTitleVisible
readonly windowTitleVisible?: boolean;
Whether the window title is visible.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
windowTitleVisible: true
})
windowTitlebarVisible
readonly windowTitlebarVisible?: boolean;
Whether the window titlebar is visible.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
windowTitlebarVisible: true
})
windowButtonVisible
readonly windowButtonVisible?: {
close?: boolean;
minimize?: boolean;
maximize?: boolean;
zoom?: boolean;
};
Whether the window buttons are visible.
By default, all window buttons are visible.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
windowButtonVisible: {
close: true,
minimize: false,
maximize: false,
zoom: false
}
})
windowDisplayPolicy
readonly windowDisplayPolicy?: WindowDisplayPolicy;
The display policy of the window accross multiple displays on macOS. On Windows and Linux, this property is ignored.
windowAnimationEnabled
readonly windowAnimationEnabled?: boolean;
Whether the window animation is enabled on macOS. On Windows and Linux, this property is ignored.
activationIndependenceEnabled
readonly activationIndependenceEnabled?: boolean;
Whether the user can interact with the always on top window without causing the application to be activated on macOS. On Windows and Linux, this property is ignored.
vibrancyEffect
readonly vibrancyEffect?: VibrancyEffect;
The vibrancy effect of the window on macOS. On Windows and Linux, this property is ignored.
windowButtonPosition
readonly windowButtonPosition?: Point;
The position of the traffic light buttons on the window titlebar on macOS.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
windowButtonPosition: { x: 10, y: 10 }
})
url
readonly url?: string;
The URL to load when the window is created.
It can be a remote URL (e.g., “https://example.com”), an absolute path
to a local file (e.g., “file:///path/to/file.html”), or the URL of
the application frontend entry point you can access via app.url.
Example
import { BrowserWindow } from '@mobrowser/api';
const win = new BrowserWindow({
url: 'https://example.com'
})
win.show()