Window
이 콘텐츠는 아직 번역되지 않았습니다.
Module @netwiv/api/window · Kind Class
import { Window } from '@netwiv/api/window';Constructor
Section titled “Constructor”new Window(label: string, options?: WindowOptions | undefined)Static members
Section titled “Static members”getAll
Section titled “getAll”getAll(): Promise<Window[]>getByLabel
Section titled “getByLabel”getByLabel(label: string): Promise<Window | null>getCurrent
Section titled “getCurrent”getCurrent(): WindowgetFocusedWindow
Section titled “getFocusedWindow”getFocusedWindow(): Promise<Window | null>Instance members
Section titled “Instance members”center
Section titled “center”center(): Promise<void>Centers the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().center();clearEffects
Section titled “clearEffects”clearEffects(): Promise<void>Clear any applied effects if possible.
close(): Promise<void>Closes the window.
Note this emits a closeRequested event so you can intercept it. To force window close, use {@link Window.destroy}.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().close();destroy
Section titled “destroy”destroy(): Promise<void>Destroys the window. Behaves like {@link Window.close} but forces the window close instead of emitting a closeRequested event.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().destroy();emit<T>(event: string, payload?: T | undefined): Promise<void>Emits an event to all {@link EventTargettargets}.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' });emitTo
Section titled “emitTo”emitTo<T>(target: string | EventTarget, event: string, payload?: T | undefined): Promise<void>Emits an event to all {@link EventTargettargets} matching the given target.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().emit('main', 'window-loaded', { loggedIn: true, token: 'authToken' });hide(): Promise<void>Sets the window visibility to false.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().hide();innerPosition
Section titled “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.
Example
import { getCurrentWindow } from '@netwiv/api/window';const position = await getCurrentWindow().innerPosition();innerSize
Section titled “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.
Example
import { getCurrentWindow } from '@netwiv/api/window';const size = await getCurrentWindow().innerSize();isAlwaysOnTop
Section titled “isAlwaysOnTop”isAlwaysOnTop(): Promise<boolean>Whether the window is configured to be always on top of other windows or not.
Example
import { getCurrentWindow } from '@netwiv/api/window';const alwaysOnTop = await getCurrentWindow().isAlwaysOnTop();isClosable
Section titled “isClosable”isClosable(): Promise<boolean>Gets the window’s native close button state.
Platform-specific
Section titled “Platform-specific”- iOS / Android: Unsupported.
Example
import { getCurrentWindow } from '@netwiv/api/window';const closable = await getCurrentWindow().isClosable();isDecorated
Section titled “isDecorated”isDecorated(): Promise<boolean>Gets the window’s current decorated state.
Example
import { getCurrentWindow } from '@netwiv/api/window';const decorated = await getCurrentWindow().isDecorated();isEnabled
Section titled “isEnabled”isEnabled(): Promise<boolean>Whether the window is enabled or disabled.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setEnabled(false);isFocused
Section titled “isFocused”isFocused(): Promise<boolean>Gets the window’s current focus state.
Example
import { getCurrentWindow } from '@netwiv/api/window';const focused = await getCurrentWindow().isFocused();isFullscreen
Section titled “isFullscreen”isFullscreen(): Promise<boolean>Gets the window’s current fullscreen state.
Example
import { getCurrentWindow } from '@netwiv/api/window';const fullscreen = await getCurrentWindow().isFullscreen();isMaximizable
Section titled “isMaximizable”isMaximizable(): Promise<boolean>Gets the window’s native maximize button state.
Platform-specific
Section titled “Platform-specific”- Linux / iOS / Android: Unsupported.
Example
import { getCurrentWindow } from '@netwiv/api/window';const maximizable = await getCurrentWindow().isMaximizable();isMaximized
Section titled “isMaximized”isMaximized(): Promise<boolean>Gets the window’s current maximized state.
Example
import { getCurrentWindow } from '@netwiv/api/window';const maximized = await getCurrentWindow().isMaximized();isMinimizable
Section titled “isMinimizable”isMinimizable(): Promise<boolean>Gets the window’s native minimize button state.
Platform-specific
Section titled “Platform-specific”- Linux / iOS / Android: Unsupported.
Example
import { getCurrentWindow } from '@netwiv/api/window';const minimizable = await getCurrentWindow().isMinimizable();isMinimized
Section titled “isMinimized”isMinimized(): Promise<boolean>Gets the window’s current minimized state.
Example
import { getCurrentWindow } from '@netwiv/api/window';const minimized = await getCurrentWindow().isMinimized();isResizable
Section titled “isResizable”isResizable(): Promise<boolean>Gets the window’s current resizable state.
Example
import { getCurrentWindow } from '@netwiv/api/window';const resizable = await getCurrentWindow().isResizable();isVisible
Section titled “isVisible”isVisible(): Promise<boolean>Gets the window’s current visible state.
Example
import { getCurrentWindow } from '@netwiv/api/window';const visible = await getCurrentWindow().isVisible();label: stringThe window label. It is a unique identifier for the window, can be used to reference it later.
listen
Section titled “listen”listen<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>Listen to an emitted event on this window.
Example
import { getCurrentWindow } from '@netwiv/api/window';const unlisten = await getCurrentWindow().listen<string>('state-changed', (event) => { console.log(`Got error: ${payload}`);});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();listeners
Section titled “listeners”listeners: Record<string, EventCallback<any>[]>Local event listeners.
maximize
Section titled “maximize”maximize(): Promise<void>Maximizes the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().maximize();minimize
Section titled “minimize”minimize(): Promise<void>Minimizes the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().minimize();once<T>(event: EventName, handler: EventCallback<T>): Promise<UnlistenFn>Listen to an emitted event on this window only once.
Example
import { getCurrentWindow } from '@netwiv/api/window';const unlisten = await getCurrentWindow().once<null>('initialized', (event) => { console.log(`Window initialized!`);});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();onCloseRequested
Section titled “onCloseRequested”onCloseRequested(handler: (event: CloseRequestedEvent): void | Promise<void>) => Promise<UnlistenFn>Listen to window close requested. Emitted when the user requests to closes the window.
Example
import { getCurrentWindow } from "@netwiv/api/window";import { confirm } from '@netwiv/api/dialog';const unlisten = await getCurrentWindow().onCloseRequested(async (event) => { const confirmed = await confirm('Are you sure?'); if (!confirmed) { // user did not confirm closing the window; let's prevent it event.preventDefault(); }});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();onDragDropEvent
Section titled “onDragDropEvent”onDragDropEvent(handler: EventCallback<DragDropEvent>): Promise<UnlistenFn>Listen to a file drop event. The listener is triggered when the user hovers the selected files on the webview, drops the files or cancels the operation.
Example
import { getCurrentWindow } from "@netwiv/api/webview";const unlisten = await getCurrentWindow().onDragDropEvent((event) => { if (event.payload.type === 'over') { console.log('User hovering', event.payload.position); } else if (event.payload.type === 'drop') { console.log('User dropped', event.payload.paths); } else { console.log('File drop cancelled'); }});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();onFocusChanged
Section titled “onFocusChanged”onFocusChanged(handler: EventCallback<boolean>): Promise<UnlistenFn>Listen to window focus change.
Example
import { getCurrentWindow } from "@netwiv/api/window";const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => { console.log('Focus changed, window is focused? ' + focused);});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();onMoved
Section titled “onMoved”onMoved(handler: EventCallback<PhysicalPosition>): Promise<UnlistenFn>Listen to window move.
Example
import { getCurrentWindow } from "@netwiv/api/window";const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => { console.log('Window moved', position);});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();onResized
Section titled “onResized”onResized(handler: EventCallback<PhysicalSize>): Promise<UnlistenFn>Listen to window resize.
Example
import { getCurrentWindow } from "@netwiv/api/window";const unlisten = await getCurrentWindow().onResized(({ payload: size }) => { console.log('Window resized', size);});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();onScaleChanged
Section titled “onScaleChanged”onScaleChanged(handler: EventCallback<ScaleFactorChanged>): Promise<UnlistenFn>Listen to window scale change. Emitted when the window’s scale factor has changed. The following user actions can cause DPI changes:
- Changing the display’s resolution.
- Changing the display’s scale factor (e.g. in Control Panel on Windows).
- Moving the window to a display with a different scale factor.
Example
import { getCurrentWindow } from "@netwiv/api/window";const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => { console.log('Scale changed', payload.scaleFactor, payload.size);});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();onThemeChanged
Section titled “onThemeChanged”onThemeChanged(handler: EventCallback<Theme>): Promise<UnlistenFn>Listen to the system theme change.
Example
import { getCurrentWindow } from "@netwiv/api/window";const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => { console.log('New theme: ' + theme);});
// you need to call unlisten if your handler goes out of scope e.g. the component is unmountedunlisten();outerPosition
Section titled “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.
Example
import { getCurrentWindow } from '@netwiv/api/window';const position = await getCurrentWindow().outerPosition();outerSize
Section titled “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.
Example
import { getCurrentWindow } from '@netwiv/api/window';const size = await getCurrentWindow().outerSize();requestUserAttention
Section titled “requestUserAttention”requestUserAttention(requestType: UserAttentionType | null): 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
Section titled “Platform-specific”- macOS:
nullhas no effect. - Linux: Urgency levels have the same effect.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().requestUserAttention();scaleFactor
Section titled “scaleFactor”scaleFactor(): Promise<number>The scale factor that can be used to map physical pixels to logical pixels.
Example
import { getCurrentWindow } from '@netwiv/api/window';const factor = await getCurrentWindow().scaleFactor();setAlwaysOnBottom
Section titled “setAlwaysOnBottom”setAlwaysOnBottom(alwaysOnBottom: boolean): Promise<void>Whether the window should always be below other windows.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setAlwaysOnBottom(true);setAlwaysOnTop
Section titled “setAlwaysOnTop”setAlwaysOnTop(alwaysOnTop: boolean): Promise<void>Whether the window should always be on top of other windows.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setAlwaysOnTop(true);setBackgroundColor
Section titled “setBackgroundColor”setBackgroundColor(color: Color): Promise<void>Sets the window background color.
Platform-specific:
Section titled “Platform-specific:”- Windows: alpha channel is ignored.
- iOS / Android: Unsupported.
setBadgeCount
Section titled “setBadgeCount”setBadgeCount(count?: number | undefined): Promise<void>Sets the badge count. It is app wide and not specific to this window.
Platform-specific
Section titled “Platform-specific”- Windows: Unsupported. Use
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setBadgeCount(5);setBadgeLabel
Section titled “setBadgeLabel”setBadgeLabel(label?: string | undefined): Promise<void>Sets the badge cont macOS only.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setBadgeLabel("Hello");setClosable
Section titled “setClosable”setClosable(closable: boolean): Promise<void>Sets whether the window’s native close button is enabled or not.
Platform-specific
Section titled “Platform-specific”- Linux: GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible
- iOS / Android: Unsupported.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setClosable(false);setContentProtected
Section titled “setContentProtected”setContentProtected(protected_: boolean): Promise<void>Prevents the window contents from being captured by other apps.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setContentProtected(true);setCursorGrab
Section titled “setCursorGrab”setCursorGrab(grab: boolean): Promise<void>Grabs the cursor, preventing it from leaving the window.
There’s no guarantee that the cursor will be hidden. You should hide it by yourself if you want so.
Platform-specific
Section titled “Platform-specific”- Linux: Unsupported.
- macOS: This locks the cursor in a fixed location, which looks visually awkward.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setCursorGrab(true);setCursorIcon
Section titled “setCursorIcon”setCursorIcon(icon: CursorIcon): Promise<void>Modifies the cursor icon of the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setCursorIcon('help');setCursorPosition
Section titled “setCursorPosition”setCursorPosition(position: LogicalPosition | PhysicalPosition | Position): Promise<void>Changes the position of the cursor in window coordinates.
Example
import { getCurrentWindow, LogicalPosition } from '@netwiv/api/window';await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300));setCursorVisible
Section titled “setCursorVisible”setCursorVisible(visible: boolean): Promise<void>Modifies the cursor’s visibility.
Platform-specific
Section titled “Platform-specific”- Windows: The cursor is only hidden within the confines of the window.
- macOS: The cursor is hidden as long as the window has input focus, even if the cursor is outside of the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setCursorVisible(false);setDecorations
Section titled “setDecorations”setDecorations(decorations: boolean): Promise<void>Whether the window should have borders and bars.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setDecorations(false);setEffects
Section titled “setEffects”setEffects(effects: Effects): Promise<void>Set window effects.
setEnabled
Section titled “setEnabled”setEnabled(enabled: boolean): Promise<void>Enable or disable the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setEnabled(false);setFocus
Section titled “setFocus”setFocus(): Promise<void>Bring the window to front and focus.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setFocus();setFocusable
Section titled “setFocusable”setFocusable(focusable: boolean): Promise<void>Sets whether the window can be focused.
Platform-specific
Section titled “Platform-specific”- macOS: If the window is already focused, it is not possible to unfocus it after calling
set_focusable(false). In this case, you might consider calling {@link Window.setFocus} but it will move the window to the back i.e. at the bottom in terms of z-order.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setFocusable(true);setFullscreen
Section titled “setFullscreen”setFullscreen(fullscreen: boolean): Promise<void>Sets the window fullscreen state.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setFullscreen(true);setIcon
Section titled “setIcon”setIcon(icon: string | number[] | Image | ArrayBuffer | Uint8Array<ArrayBufferLike>): Promise<void>Sets the window icon.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setIcon('/tauri/awesome.png');Note that you may need the image-ico or image-png Cargo features to use this API.
To enable it, change your Cargo.toml file:
[dependencies]tauri = { version = "...", features = ["...", "image-png"] }setIgnoreCursorEvents
Section titled “setIgnoreCursorEvents”setIgnoreCursorEvents(ignore: boolean): Promise<void>Changes the cursor events behavior.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setIgnoreCursorEvents(true);setMaximizable
Section titled “setMaximizable”setMaximizable(maximizable: boolean): Promise<void>Sets whether the window’s native maximize button is enabled or not. If resizable is set to false, this setting is ignored.
Platform-specific
Section titled “Platform-specific”- macOS: Disables the “zoom” button in the window titlebar, which is also used to enter fullscreen mode.
- Linux / iOS / Android: Unsupported.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setMaximizable(false);setMaxSize
Section titled “setMaxSize”setMaxSize(size: LogicalSize | PhysicalSize | Size | null | undefined): Promise<void>Sets the window maximum inner size. If the size argument is undefined, the constraint is unset.
Example
import { getCurrentWindow, LogicalSize } from '@netwiv/api/window';await getCurrentWindow().setMaxSize(new LogicalSize(600, 500));setMinimizable
Section titled “setMinimizable”setMinimizable(minimizable: boolean): Promise<void>Sets whether the window’s native minimize button is enabled or not.
Platform-specific
Section titled “Platform-specific”- Linux / iOS / Android: Unsupported.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setMinimizable(false);setMinSize
Section titled “setMinSize”setMinSize(size: LogicalSize | PhysicalSize | Size | null | undefined): Promise<void>Sets the window minimum inner size. If the size argument is not provided, the constraint is unset.
Example
import { getCurrentWindow, PhysicalSize } from '@netwiv/api/window';await getCurrentWindow().setMinSize(new PhysicalSize(600, 500));setOverlayIcon
Section titled “setOverlayIcon”setOverlayIcon(icon?: string | number[] | Image | ArrayBuffer | Uint8Array<ArrayBufferLike> | undefined): Promise<void>Sets the overlay icon. Windows only The overlay icon can be set for every window.
Note that you may need the image-ico or image-png Cargo features to use this API.
To enable it, change your Cargo.toml file:
[dependencies]tauri = { version = "...", features = ["...", "image-png"] }Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setOverlayIcon("/tauri/awesome.png");setPosition
Section titled “setPosition”setPosition(position: LogicalPosition | PhysicalPosition | Position): Promise<void>Sets the window outer position.
Example
import { getCurrentWindow, LogicalPosition } from '@netwiv/api/window';await getCurrentWindow().setPosition(new LogicalPosition(600, 500));setProgressBar
Section titled “setProgressBar”setProgressBar(state: ProgressBarState): Promise<void>Sets the taskbar progress state.
Platform-specific
Section titled “Platform-specific”- Linux / macOS: Progress bar is app-wide and not specific to this window.
- Linux: Only supported desktop environments with
libunity(e.g. GNOME).
Example
import { getCurrentWindow, ProgressBarStatus } from '@netwiv/api/window';await getCurrentWindow().setProgressBar({ status: ProgressBarStatus.Normal, progress: 50,});setResizable
Section titled “setResizable”setResizable(resizable: boolean): Promise<void>Updates the window resizable flag.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setResizable(false);setShadow
Section titled “setShadow”setShadow(enable: boolean): Promise<void>Whether or not the window should have shadow.
Platform-specific
Section titled “Platform-specific”- Windows:
falsehas no effect on decorated window, shadows are always ON.truewill make undecorated window have a 1px white border, and on Windows 11, it will have a rounded corners.
- Linux: Unsupported.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setShadow(false);setSimpleFullscreen
Section titled “setSimpleFullscreen”setSimpleFullscreen(fullscreen: boolean): Promise<void>On macOS, Toggles a fullscreen mode that doesn’t require a new macOS space. Returns a boolean indicating whether the transition was successful (this won’t work if the window was already in the native fullscreen). This is how fullscreen used to work on macOS in versions before Lion. And allows the user to have a fullscreen window without using another space or taking control over the entire monitor.
On other platforms, this is the same as {@link Window.setFullscreen}.
setSize
Section titled “setSize”setSize(size: LogicalSize | PhysicalSize | Size): Promise<void>Resizes the window with a new inner size.
Example
import { getCurrentWindow, LogicalSize } from '@netwiv/api/window';await getCurrentWindow().setSize(new LogicalSize(600, 500));setSizeConstraints
Section titled “setSizeConstraints”setSizeConstraints(constraints: WindowSizeConstraints | null | undefined): Promise<void>Sets the window inner size constraints.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setSizeConstraints({ minWidth: 300 });setSkipTaskbar
Section titled “setSkipTaskbar”setSkipTaskbar(skip: boolean): Promise<void>Whether the window icon should be hidden from the taskbar or not.
Platform-specific
Section titled “Platform-specific”- macOS: Unsupported.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setSkipTaskbar(true);setTheme
Section titled “setTheme”setTheme(theme?: Theme | null | undefined): Promise<void>Set window theme, pass in null or undefined to follow system theme
Platform-specific
Section titled “Platform-specific”- Linux / macOS: Theme is app-wide and not specific to this window.
- iOS / Android: Unsupported.
setTitle
Section titled “setTitle”setTitle(title: string): Promise<void>Sets the window title.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().setTitle('Tauri');setTitleBarStyle
Section titled “setTitleBarStyle”setTitleBarStyle(style: TitleBarStyle): Promise<void>Sets the title bar style. macOS only.
setVisibleOnAllWorkspaces
Section titled “setVisibleOnAllWorkspaces”setVisibleOnAllWorkspaces(visible: boolean): Promise<void>Sets whether the window should be visible on all workspaces or virtual desktops.
Platform-specific
Section titled “Platform-specific”- Windows / iOS / Android: Unsupported.
show(): Promise<void>Sets the window visibility to true.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().show();startDragging
Section titled “startDragging”startDragging(): Promise<void>Starts dragging the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().startDragging();startResizeDragging
Section titled “startResizeDragging”startResizeDragging(direction: ResizeDirection): Promise<void>Starts resize-dragging the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().startResizeDragging();theme(): Promise<Theme | null>Gets the window’s current theme.
Platform-specific
Section titled “Platform-specific”- macOS: Theme was introduced on macOS 10.14. Returns
lighton macOS 10.13 and below.
Example
import { getCurrentWindow } from '@netwiv/api/window';const theme = await getCurrentWindow().theme();title(): Promise<string>Gets the window’s current title.
Example
import { getCurrentWindow } from '@netwiv/api/window';const title = await getCurrentWindow().title();toggleMaximize
Section titled “toggleMaximize”toggleMaximize(): Promise<void>Toggles the window maximized state.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().toggleMaximize();unmaximize
Section titled “unmaximize”unmaximize(): Promise<void>Unmaximizes the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().unmaximize();unminimize
Section titled “unminimize”unminimize(): Promise<void>Unminimizes the window.
Example
import { getCurrentWindow } from '@netwiv/api/window';await getCurrentWindow().unminimize();Descriptions come from the pinned @tauri-apps/api@2.11.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.