feat(positioner): add moveWindowConstrained for tray-icon positions (#2076)

This commit is contained in:
Jakob Westhoff
2024-11-20 02:05:37 +02:00
committed by GitHub
parent 383e636a8e
commit 4db626354c
11 changed files with 352 additions and 163 deletions
+13
View File
@@ -39,6 +39,19 @@ export async function moveWindow(to: Position): Promise<void> {
})
}
/**
* Moves the `Window` to the given {@link Position} using `WindowExt.move_window_constrained()`
*
* This move operation constrains the window to the screen dimensions in case of
* tray-icon positions.
* @param to The (tray) {@link Position} to move to.
*/
export async function moveWindowConstrained(to: Position): Promise<void> {
await invoke('plugin:positioner|move_window_constrained', {
position: to
})
}
export async function handleIconState(event: TrayIconEvent): Promise<void> {
await invoke('plugin:positioner|set_tray_icon_state', {
position: event.rect.position,