[positioner] handleIconState in JS (#1822)

* [positioner] handleIconState in JS

* update readme

* fix change file version

* fixes

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
Jacob Bolda
2024-10-01 10:15:22 -03:00
committed by GitHub
co-authored by Lucas Nogueira
parent 30bcf5dcc2
commit 2f7e32b5e0
11 changed files with 103 additions and 6 deletions
+12
View File
@@ -4,6 +4,7 @@
// SPDX-License-Identifier: MIT
import { invoke } from '@tauri-apps/api/core'
import type { TrayIconEvent } from '@tauri-apps/api/tray'
/**
* Well known window positions.
@@ -37,3 +38,14 @@ export async function moveWindow(to: Position): Promise<void> {
position: to
})
}
export async function handleIconState(event: TrayIconEvent): Promise<void> {
await invokeSetTrayIconState(event.rect)
}
async function invokeSetTrayIconState(rect: TrayIconEvent['rect']) {
await invoke('plugin:positioner|set_tray_icon_state', {
position: rect.position,
size: rect.size
})
}