window.WindowManager
Manage the current window object.
#
Hierarchy↳
WindowManager
#
Constructors#
constructor• new WindowManager(label
)
#
ParametersName | Type |
---|---|
label | WindowLabel |
#
Inherited fromWebviewWindowHandle.constructor
#
Defined in#
Properties#
label• label: WindowLabel
Window label.
#
Inherited from#
Defined in#
listeners• listeners: Object
Local event listeners.
#
Index signature▪ [key: string
]: EventCallback
<any
>[]
#
Inherited from#
Defined in#
Methods#
_handleTauriEvent▸ _handleTauriEvent<T
>(event
, handler
): boolean
#
Type parametersName |
---|
T |
#
ParametersName | Type |
---|---|
event | string |
handler | EventCallback <T > |
#
Returnsboolean
#
Inherited fromWebviewWindowHandle._handleTauriEvent
#
Defined in#
center▸ center(): Promise
<void
>
Centers the window.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
close▸ close(): Promise
<void
>
Closes the window.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
emit▸ emit(event
, payload?
): Promise
<void
>
Emits an event to the backend, tied to the webview window.
#
ParametersName | Type | Description |
---|---|---|
event | string | Event name. |
payload? | string | Event payload. |
#
ReturnsPromise
<void
>
#
Inherited from#
Defined in#
hide▸ hide(): Promise
<void
>
Sets the window visibility to false.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
innerPosition▸ innerPosition(): Promise
<PhysicalPosition
>
The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop.
#
ReturnsPromise
<PhysicalPosition
>
#
Defined in#
innerSize▸ innerSize(): Promise
<PhysicalSize
>
The physical size of the window's client area. The client area is the content of the window, excluding the title bar and borders.
#
ReturnsPromise
<PhysicalSize
>
#
Defined in#
isDecorated▸ isDecorated(): Promise
<boolean
>
Gets the window's current decorated state.
#
ReturnsPromise
<boolean
>
#
Defined in#
isFullscreen▸ isFullscreen(): Promise
<boolean
>
Gets the window's current fullscreen state.
#
ReturnsPromise
<boolean
>
#
Defined in#
isMaximized▸ isMaximized(): Promise
<boolean
>
Gets the window's current maximized state.
#
ReturnsPromise
<boolean
>
#
Defined in#
isResizable▸ isResizable(): Promise
<boolean
>
Gets the window's current resizable state.
#
ReturnsPromise
<boolean
>
#
Defined in#
isVisible▸ isVisible(): Promise
<boolean
>
Gets the window's current visible state.
#
ReturnsPromise
<boolean
>
#
Defined in#
listen▸ listen<T
>(event
, handler
): Promise
<UnlistenFn
>
Listen to an event emitted by the backend that is tied to the webview window.
#
Type parametersName |
---|
T |
#
ParametersName | Type | Description |
---|---|---|
event | EventName | Event name. |
handler | EventCallback <T > | Event handler. |
#
ReturnsPromise
<UnlistenFn
>
A promise resolving to a function to unlisten to the event.
#
Inherited from#
Defined in#
maximize▸ maximize(): Promise
<void
>
Maximizes the window.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
minimize▸ minimize(): Promise
<void
>
Minimizes the window.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
once▸ once<T
>(event
, handler
): Promise
<UnlistenFn
>
Listen to an one-off event emitted by the backend that is tied to the webview window.
#
Type parametersName |
---|
T |
#
ParametersName | Type | Description |
---|---|---|
event | string | Event name. |
handler | EventCallback <T > | Event handler. |
#
ReturnsPromise
<UnlistenFn
>
A promise resolving to a function to unlisten to the event.
#
Inherited from#
Defined in#
outerPosition▸ outerPosition(): Promise
<PhysicalPosition
>
The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.
#
ReturnsPromise
<PhysicalPosition
>
#
Defined in#
outerSize▸ outerSize(): Promise
<PhysicalSize
>
The physical size of the entire window. These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead.
#
ReturnsPromise
<PhysicalSize
>
#
Defined in#
requestUserAttention▸ requestUserAttention(requestType
): Promise
<void
>
Requests user attention to the window, this has no effect if the application
is already focused. How requesting for user attention manifests is platform dependent,
see UserAttentionType
for details.
Providing null
will unset the request for user attention. Unsetting the request for
user attention might not be done automatically by the WM when the window receives input.
#
Platform-specific- macOS:
null
has no effect.
#
ParametersName | Type |
---|---|
requestType | null | UserAttentionType |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
scaleFactor▸ scaleFactor(): Promise
<number
>
The scale factor that can be used to map physical pixels to logical pixels.
#
ReturnsPromise
<number
>
#
Defined in#
setAlwaysOnTop▸ setAlwaysOnTop(alwaysOnTop
): Promise
<void
>
Whether the window should always be on top of other windows.
#
ParametersName | Type | Description |
---|---|---|
alwaysOnTop | boolean | Whether the window should always be on top of other windows or not. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setDecorations▸ setDecorations(decorations
): Promise
<void
>
Whether the window should have borders and bars.
#
ParametersName | Type | Description |
---|---|---|
decorations | boolean | Whether the window should have borders and bars. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setFocus▸ setFocus(): Promise
<void
>
Bring the window to front and focus.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setFullscreen▸ setFullscreen(fullscreen
): Promise
<void
>
Sets the window fullscreen state.
#
ParametersName | Type | Description |
---|---|---|
fullscreen | boolean | Whether the window should go to fullscreen or not. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setIcon▸ setIcon(icon
): Promise
<void
>
Sets the window icon.
#
ParametersName | Type | Description |
---|---|---|
icon | string | number [] | Icon bytes or path to the icon file. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setMaxSize▸ setMaxSize(size
): Promise
<void
>
Sets the window max size. If the size
argument is undefined, the max size is unset.
example
import { appWindow, LogicalSize } from '@tauri-apps/api/window'
await appWindow.setMaxSize(new LogicalSize(600, 500))
#
ParametersName | Type | Description |
---|---|---|
size | undefined | PhysicalSize | LogicalSize | The logical or physical size. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setMinSize▸ setMinSize(size
): Promise
<void
>
Sets the window min size. If the size
argument is not provided, the min size is unset.
example
import { appWindow, PhysicalSize } from '@tauri-apps/api/window'
await appWindow.setMinSize(new PhysicalSize(600, 500))
#
ParametersName | Type | Description |
---|---|---|
size | undefined | PhysicalSize | LogicalSize | The logical or physical size. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setPosition▸ setPosition(position
): Promise
<void
>
Sets the window position.
example
import { appWindow, LogicalPosition } from '@tauri-apps/api/window'
await appWindow.setPosition(new LogicalPosition(600, 500))
#
ParametersName | Type | Description |
---|---|---|
position | PhysicalPosition | LogicalPosition | The new position, in logical or physical pixels. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setResizable▸ setResizable(resizable
): Promise
<void
>
Updates the window resizable flag.
#
ParametersName | Type |
---|---|
resizable | boolean |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setSize▸ setSize(size
): Promise
<void
>
Resizes the window.
example
import { appWindow, LogicalSize } from '@tauri-apps/api/window'
await appWindow.setSize(new LogicalSize(600, 500))
#
ParametersName | Type | Description |
---|---|---|
size | PhysicalSize | LogicalSize | The logical or physical size. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setSkipTaskbar▸ setSkipTaskbar(skip
): Promise
<void
>
Whether to show the window icon in the task bar or not.
#
ParametersName | Type | Description |
---|---|---|
skip | boolean | true to hide window icon, false to show it. |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
setTitle▸ setTitle(title
): Promise
<void
>
Sets the window title.
#
ParametersName | Type | Description |
---|---|---|
title | string | The new title |
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
show▸ show(): Promise
<void
>
Sets the window visibility to true.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
startDragging▸ startDragging(): Promise
<void
>
Starts dragging the window.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
toggleMaximize▸ toggleMaximize(): Promise
<void
>
Toggles the window maximized state.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
unmaximize▸ unmaximize(): Promise
<void
>
Unmaximizes the window.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.
#
Defined in#
unminimize▸ unminimize(): Promise
<void
>
Unminimizes the window.
#
ReturnsPromise
<void
>
A promise indicating the success or failure of the operation.