diff --git a/.changes/fix-tray-attributes.md b/.changes/fix-tray-attributes.md
new file mode 100644
index 000000000..ce54c6893
--- /dev/null
+++ b/.changes/fix-tray-attributes.md
@@ -0,0 +1,5 @@
+---
+"tao": patch
+---
+
+Fixes `icon_as_template` and `menu_on_left_click` SystemTray implementation on macOS.
diff --git a/src/platform/macos.rs b/src/platform/macos.rs
index 04c52da94..631128200 100644
--- a/src/platform/macos.rs
+++ b/src/platform/macos.rs
@@ -616,17 +616,17 @@ pub trait SystemTrayBuilderExtMacOS {
#[cfg(feature = "tray")]
impl SystemTrayBuilderExtMacOS for SystemTrayBuilder {
fn with_icon_as_template(mut self, is_template: bool) -> Self {
- self.platform_tray_builder.system_tray.icon_is_template = is_template;
+ self.platform_tray_builder.icon_is_template = is_template;
self
}
fn with_menu_on_left_click(mut self, enable: bool) -> Self {
- self.platform_tray_builder.system_tray.menu_on_left_click = enable;
+ self.platform_tray_builder.menu_on_left_click = enable;
self
}
fn with_title(mut self, title: &str) -> Self {
- self.platform_tray_builder.system_tray.title = Some(title.to_owned());
+ self.platform_tray_builder.title = Some(title.to_owned());
self
}
}
@@ -649,11 +649,11 @@ pub trait SystemTrayExtMacOS {
#[cfg(feature = "tray")]
impl SystemTrayExtMacOS for SystemTray {
fn set_icon_as_template(&mut self, is_template: bool) {
- self.0.icon_is_template = is_template
+ self.0.set_icon_as_template(is_template);
}
fn enable_menu_on_left_click(&mut self, enable: bool) {
- self.0.menu_on_left_click = enable
+ self.0.set_show_menu_on_left_click(enable);
}
fn set_title(&mut self, title: &str) {
diff --git a/src/platform_impl/macos/system_tray.rs b/src/platform_impl/macos/system_tray.rs
index c7e35a8ac..445c977c8 100644
--- a/src/platform_impl/macos/system_tray.rs
+++ b/src/platform_impl/macos/system_tray.rs
@@ -40,35 +40,40 @@ enum ClickType {
}
pub struct SystemTrayBuilder {
- pub(crate) system_tray: SystemTray,
+ icon: Icon,
+ tray_menu: Option