mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +02:00
[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:
@@ -63,10 +63,27 @@ async fn move_window<R: Runtime>(window: tauri::Window<R>, position: Position) -
|
||||
window.move_window(position)
|
||||
}
|
||||
|
||||
#[cfg(feature = "tray-icon")]
|
||||
#[tauri::command]
|
||||
fn set_tray_icon_state<R: Runtime>(
|
||||
app: AppHandle<R>,
|
||||
position: PhysicalPosition<f64>,
|
||||
size: PhysicalSize<f64>,
|
||||
) {
|
||||
app.state::<Tray>()
|
||||
.0
|
||||
.lock()
|
||||
.unwrap()
|
||||
.replace((position, size));
|
||||
}
|
||||
|
||||
/// The Tauri plugin that exposes [`WindowExt::move_window`] to the webview.
|
||||
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
let plugin =
|
||||
plugin::Builder::new("positioner").invoke_handler(tauri::generate_handler![move_window]);
|
||||
let plugin = plugin::Builder::new("positioner").invoke_handler(tauri::generate_handler![
|
||||
move_window,
|
||||
#[cfg(feature = "tray-icon")]
|
||||
set_tray_icon_state
|
||||
]);
|
||||
|
||||
#[cfg(feature = "tray-icon")]
|
||||
let plugin = plugin.setup(|app_handle, _api| {
|
||||
|
||||
Reference in New Issue
Block a user