Skip to main content
Version: v2.8.1

Window

These methods give control of the application window.

WindowSetTitleโ€‹

Sets the text in the window title bar.

Go: WindowSetTitle(ctx context.Context, title string)
JS: WindowSetTitle(title: string)

WindowFullscreenโ€‹

Makes the window full screen.

Go: WindowFullscreen(ctx context.Context)
JS: WindowFullscreen()

WindowUnfullscreenโ€‹

Restores the previous window dimensions and position prior to full screen.

Go: WindowUnfullscreen(ctx context.Context)
JS: WindowUnfullscreen()

WindowIsFullscreenโ€‹

Returns true if the window is full screen.

Go: WindowIsFullscreen(ctx context.Context) bool
JS: WindowIsFullscreen() Promise<boolean>

WindowCenterโ€‹

Centers the window on the monitor the window is currently on.

Go: WindowCenter(ctx context.Context)
JS: WindowCenter()

WindowExecJSโ€‹

Executes arbitrary JS code in the window.

This method runs the code in the browser asynchronously and returns immediately. If the script causes any errors, they will only be available in the browser console.

Go: WindowExecJS(ctx context.Context, js string)

WindowReloadโ€‹

Performs a "reload" (Reloads current page).

Go: WindowReload(ctx context.Context)
JS: WindowReload()

WindowReloadAppโ€‹

Reloads the application frontend.

Go: WindowReloadApp(ctx context.Context)
JS: WindowReloadApp()

WindowSetSystemDefaultThemeโ€‹

Windows only.

Go: WindowSetSystemDefaultTheme(ctx context.Context)
JS: WindowSetSystemDefaultTheme()

Sets window theme to system default (dark/light).

WindowSetLightThemeโ€‹

Windows only.

Go: WindowSetLightTheme(ctx context.Context)
JS: WindowSetLightTheme()

Sets window theme to light.

WindowSetDarkThemeโ€‹

Windows only.

Go: WindowSetDarkTheme(ctx context.Context)
JS: WindowSetDarkTheme()

Sets window theme to dark.

WindowShowโ€‹

Shows the window, if it is currently hidden.

Go: WindowShow(ctx context.Context)
JS: WindowShow()

WindowHideโ€‹

Hides the window, if it is currently visible.

Go: WindowHide(ctx context.Context)
JS: WindowHide()

WindowIsNormalโ€‹

Returns true if the window not minimised, maximised or fullscreen.

Go: WindowIsNormal(ctx context.Context) bool
JS: WindowIsNormal() Promise<boolean>

WindowSetSizeโ€‹

Sets the width and height of the window.

Go: WindowSetSize(ctx context.Context, width int, height int)
JS: WindowSetSize(width: number, height: number)

WindowGetSizeโ€‹

Gets the width and height of the window.

Go: WindowGetSize(ctx context.Context) (width int, height int)
JS: WindowGetSize(): Promise<Size>

WindowSetMinSizeโ€‹

Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.

Setting a size of 0,0 will disable this constraint.

Go: WindowSetMinSize(ctx context.Context, width int, height int)
JS: WindowSetMinSize(width: number, height: number)

WindowSetMaxSizeโ€‹

Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.

Setting a size of 0,0 will disable this constraint.

Go: WindowSetMaxSize(ctx context.Context, width int, height int)
JS: WindowSetMaxSize(width: number, height: number)

WindowSetAlwaysOnTopโ€‹

Sets the window AlwaysOnTop or not on top.

Go: WindowSetAlwaysOnTop(ctx context.Context, b bool)
JS: WindowSetAlwaysOnTop(b: boolean)

WindowSetPositionโ€‹

Sets the window position relative to the monitor the window is currently on.

Go: WindowSetPosition(ctx context.Context, x int, y int)
JS: WindowSetPosition(x: number, y: number)

WindowGetPositionโ€‹

Gets the window position relative to the monitor the window is currently on.

Go: WindowGetPosition(ctx context.Context) (x int, y int)
JS: WindowGetPosition(): Promise<Position>

WindowMaximiseโ€‹

Maximises the window to fill the screen.

Go: WindowMaximise(ctx context.Context)
JS: WindowMaximise()

WindowUnmaximiseโ€‹

Restores the window to the dimensions and position prior to maximising.

Go: WindowUnmaximise(ctx context.Context)
JS: WindowUnmaximise()

WindowIsMaximisedโ€‹

Returns true if the window is maximised.

Go: WindowIsMaximised(ctx context.Context) bool
JS: WindowIsMaximised() Promise<boolean>

WindowToggleMaximiseโ€‹

Toggles between Maximised and UnMaximised.

Go: WindowToggleMaximise(ctx context.Context)
JS: WindowToggleMaximise()

WindowMinimiseโ€‹

Minimises the window.

Go: WindowMinimise(ctx context.Context)
JS: WindowMinimise()

WindowUnminimiseโ€‹

Restores the window to the dimensions and position prior to minimising.

Go: WindowUnminimise(ctx context.Context)
JS: WindowUnminimise()

WindowIsMinimisedโ€‹

Returns true if the window is minimised.

Go: WindowIsMinimised(ctx context.Context) bool
JS: WindowIsMinimised() Promise<boolean>

WindowSetBackgroundColourโ€‹

Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.

Valid values for R, G, B and A are 0-255.

Windows

On Windows, only alpha values of 0 or 255 are supported. Any value that is not 0 will be considered 255.

Go: WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)
JS: WindowSetBackgroundColour(R, G, B, A)

WindowPrintโ€‹

Opens tha native print dialog.

Go: WindowPrint(ctx context.Context)
JS: WindowPrint()

TypeScript Object Definitionsโ€‹

Positionโ€‹

interface Position {
x: number;
y: number;
}

Sizeโ€‹

interface Size {
w: number;
h: number;
}