mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-23 11:36:13 +02:00
38 lines
742 B
TypeScript
38 lines
742 B
TypeScript
// Copyright 2021 Jonas Kruckenberg
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { invoke } from "@tauri-apps/api/tauri";
|
|
|
|
/**
|
|
* Well known window positions.
|
|
*/
|
|
export enum Position {
|
|
TopLeft = 0,
|
|
TopRight,
|
|
BottomLeft,
|
|
BottomRight,
|
|
TopCenter,
|
|
BottomCenter,
|
|
LeftCenter,
|
|
RightCenter,
|
|
Center,
|
|
TrayLeft,
|
|
TrayBottomLeft,
|
|
TrayRight,
|
|
TrayBottomRight,
|
|
TrayCenter,
|
|
TrayBottomCenter,
|
|
}
|
|
|
|
/**
|
|
* Moves the `Window` to the given {@link Position} using `WindowExt.move_window()`
|
|
* All positions are relative to the **current** screen.
|
|
*
|
|
* @param to The {@link Position} to move to.
|
|
*/
|
|
export async function moveWindow(to: Position): Promise<void> {
|
|
await invoke("plugin:positioner|move_window", {
|
|
position: to,
|
|
});
|
|
}
|