|
@@ -9,6 +9,7 @@ pub(crate) mod tray;
|
|
|
use crate::{
|
|
|
api::assets::Assets,
|
|
|
api::config::{Config, WindowUrl},
|
|
|
+ command::{CommandArg, CommandItem},
|
|
|
hooks::{InvokeHandler, OnPageLoad, PageLoadPayload, SetupHook},
|
|
|
manager::{Args, WindowManager},
|
|
|
plugin::{Plugin, PluginStore},
|
|
@@ -19,7 +20,7 @@ use crate::{
|
|
|
Dispatch, MenuId, Params, RunEvent, Runtime,
|
|
|
},
|
|
|
sealed::{ManagerBase, RuntimeOrDispatch},
|
|
|
- Context, Invoke, Manager, StateManager, Window,
|
|
|
+ Context, Invoke, InvokeError, Manager, StateManager, Window,
|
|
|
};
|
|
|
|
|
|
use tauri_utils::PackageInfo;
|
|
@@ -133,6 +134,13 @@ impl<P: Params> Clone for AppHandle<P> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+impl<'de, P: Params> CommandArg<'de, P> for AppHandle<P> {
|
|
|
+ /// Grabs the [`Window`] from the [`CommandItem`] and returns the associated [`AppHandle`]. This will never fail.
|
|
|
+ fn from_command(command: CommandItem<'de, P>) -> Result<Self, InvokeError> {
|
|
|
+ Ok(command.message.window().app_handle)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
impl<P: Params> AppHandle<P> {
|
|
|
/// Removes the system tray.
|
|
|
#[cfg(all(windows, feature = "system-tray"))]
|