Skip to content

@tauri-apps/plugin-positioner

Move the window to well-known positions, including positions relative to the tray icon.

function handleIconState(event: TrayIconEvent): Promise<void>;

Defined in: plugins/positioner/guest-js/index.ts:135

Reports the tray icon’s current position and size so the Tray* Position variants can be resolved.

This is an internal helper meant to be called from the tray icon’s event handler (the action callback passed to TrayIcon.new()), forwarding every TrayIconEvent it receives so that moveWindow and moveWindowConstrained can later position the window relative to the tray icon.

import { handleIconState } from '@tauri-apps/plugin-positioner'
import { TrayIcon, type TrayIconEvent } from '@tauri-apps/api/tray'
const action = async (event: TrayIconEvent) => {
await handleIconState(event)
}
const tray = await TrayIcon.new({ id: 'main', action })
Parameter Type Description
event TrayIconEvent The tray icon event to read the position and size from.

Promise<void>

2.0.0


function moveWindow(to: Position): Promise<void>;

Defined in: plugins/positioner/guest-js/index.ts:83

Moves the Window to the given Position using WindowExt.move_window() All positions are relative to the current screen.

import { moveWindow, Position } from '@tauri-apps/plugin-positioner'
await moveWindow(Position.TopRight)
Parameter Type Description
to Position The Position to move to.

Promise<void>

2.0.0


function moveWindowConstrained(to: Position): Promise<void>;

Defined in: plugins/positioner/guest-js/index.ts:105

Moves the Window to the given Position using WindowExt.move_window_constrained()

This move operation constrains the window to the screen dimensions in case of tray-icon positions.

import { moveWindowConstrained, Position } from '@tauri-apps/plugin-positioner'
await moveWindowConstrained(Position.TrayCenter)
Parameter Type Description
to Position The (tray) Position to move to.

Promise<void>

2.1.0

Defined in: plugins/positioner/guest-js/index.ts:18

Well known window positions.

Enumeration Member Value Description Defined in
BottomCenter 5 Bottom center of the screen. plugins/positioner/guest-js/index.ts:30
BottomLeft 2 Bottom left corner of the screen. plugins/positioner/guest-js/index.ts:24
BottomRight 3 Bottom right corner of the screen. plugins/positioner/guest-js/index.ts:26
Center 8 Center of the screen. plugins/positioner/guest-js/index.ts:36
LeftCenter 6 Vertically centered on the left edge of the screen. plugins/positioner/guest-js/index.ts:32
RightCenter 7 Vertically centered on the right edge of the screen. plugins/positioner/guest-js/index.ts:34
TopCenter 4 Top center of the screen. plugins/positioner/guest-js/index.ts:28
TopLeft 0 Top left corner of the screen. plugins/positioner/guest-js/index.ts:20
TopRight 1 Top right corner of the screen. plugins/positioner/guest-js/index.ts:22
TrayBottomCenter 14 Directly below the tray icon, horizontally centered on it. Requires the tray-icon feature and the tray icon’s events to be forwarded through handleIconState. plugins/positioner/guest-js/index.ts:66
TrayBottomLeft 10 Directly below the tray icon, aligned with its left edge. Requires the tray-icon feature and the tray icon’s events to be forwarded through handleIconState. plugins/positioner/guest-js/index.ts:46
TrayBottomRight 12 Directly below the tray icon, aligned with its right edge. Requires the tray-icon feature and the tray icon’s events to be forwarded through handleIconState. plugins/positioner/guest-js/index.ts:56
TrayCenter 13 Above the tray icon, horizontally centered on it. Requires the tray-icon feature and the tray icon’s events to be forwarded through handleIconState. plugins/positioner/guest-js/index.ts:61
TrayLeft 9 Above the tray icon, aligned with its left edge. Requires the tray-icon feature and the tray icon’s events to be forwarded through handleIconState. plugins/positioner/guest-js/index.ts:41
TrayRight 11 Above the tray icon, aligned with its right edge. Requires the tray-icon feature and the tray icon’s events to be forwarded through handleIconState. plugins/positioner/guest-js/index.ts:51

© 2026 Tauri Contributors. CC-BY / MIT