From 8a71858eb2a9dc12a43d8fb56f803cdcae072b68 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Thu, 2 May 2024 05:44:15 +0800 Subject: [PATCH] feat: configure a default runtime for menu and tray icon types (#9630) * Use `tauri::Wry` as default runtime for menu types * do it properly * changes * same for tray icon * change file --------- Co-authored-by: amrbashir --- .changes/default-generic-for-menu.md | 5 +++++ .changes/default-generic-for-tray.md | 5 +++++ core/tauri/src/menu/mod.rs | 1 + core/tauri/src/tray/mod.rs | 1 + 4 files changed, 12 insertions(+) create mode 100644 .changes/default-generic-for-menu.md create mode 100644 .changes/default-generic-for-tray.md diff --git a/.changes/default-generic-for-menu.md b/.changes/default-generic-for-menu.md new file mode 100644 index 000000000..3e42d4bde --- /dev/null +++ b/.changes/default-generic-for-menu.md @@ -0,0 +1,5 @@ +--- +'tauri': patch:enhance +--- + +Provide a default for the runtime generic on `Menu`, `MenuItem`, `Submenu`, `PredefinedMenuItem`, `CheckMenuItem` and `IconMenuItem`. diff --git a/.changes/default-generic-for-tray.md b/.changes/default-generic-for-tray.md new file mode 100644 index 000000000..ca29a89fa --- /dev/null +++ b/.changes/default-generic-for-tray.md @@ -0,0 +1,5 @@ +--- +'tauri': patch:enhance +--- + +Provide a default for the runtime generic on `TrayIcon`. diff --git a/core/tauri/src/menu/mod.rs b/core/tauri/src/menu/mod.rs index de1bf7870..9d9c7059c 100644 --- a/core/tauri/src/menu/mod.rs +++ b/core/tauri/src/menu/mod.rs @@ -70,6 +70,7 @@ macro_rules! gen_wrappers { ),* ) => { $( + #[tauri_macros::default_runtime(crate::Wry, wry)] pub(crate) struct $inner { id: $crate::menu::MenuId, inner: ::std::option::Option<::muda::$type>, diff --git a/core/tauri/src/tray/mod.rs b/core/tauri/src/tray/mod.rs index 99f008002..66b9e2b83 100644 --- a/core/tauri/src/tray/mod.rs +++ b/core/tauri/src/tray/mod.rs @@ -243,6 +243,7 @@ impl TrayIconBuilder { /// This type is reference-counted and the icon is removed when the last instance is dropped. /// /// See [TrayIconBuilder] to construct this type. +#[tauri_macros::default_runtime(crate::Wry, wry)] pub struct TrayIcon { id: TrayIconId, inner: tray_icon::TrayIcon,