Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_as_help_menu_for_nsapp and set_as_windows_menu_for_nsapp are broken on macOS #263

Open
rosingrind opened this issue Jan 21, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@rosingrind
Copy link

According to https://stackoverflow.com/a/74964099, setting windowsMenu and helpMenu at NSApp should fill these menus with pre-defined macOS items such as window controls, Spotlight menu item, etc.

On latest muda-v0.15.3 and macOS 15.2 (24C101) I don't get expected behavior, take https://github.com/tauri-apps/muda/blob/muda-v0.15.3/examples/winit.rs and this patch:

diff --git a/examples/winit.rs b/examples/winit.rs
--- a/examples/winit.rs
+++ b/examples/winit.rs
@@ -68,8 +68,9 @@
     let file_m = Submenu::new("&File", true);
     let edit_m = Submenu::new("&Edit", true);
     let window_m = Submenu::new("&Window", true);
+    let help_m = Submenu::new("&Help", true);
 
-    menu_bar.append_items(&[&file_m, &edit_m, &window_m]);
+    menu_bar.append_items(&[&file_m, &edit_m, &window_m, &help_m]);
 
     let custom_i_1 = MenuItem::new(
         "C&ustom 1",
@@ -125,6 +126,8 @@
 
     edit_m.append_items(&[&copy_i, &PredefinedMenuItem::separator(), &paste_i]);
 
+    help_m.append(&PredefinedMenuItem::separator());
+
     #[cfg(target_os = "windows")]
     {
         use winit::raw_window_handle::*;
@@ -138,7 +141,8 @@
     #[cfg(target_os = "macos")]
     {
         menu_bar.init_for_nsapp();
-        window_m.set_as_windows_menu_for_nsapp();
+        // help_m.set_as_help_menu_for_nsapp();
+        // window_m.set_as_windows_menu_for_nsapp();
     }
 
     let menu_channel = MenuEvent::receiver();

with set_as_windows_menu_for_nsapp call:

Image

with set_as_help_menu_for_nsapp call:

Image

without set_as_windows_menu_for_nsapp call:

Image

without set_as_help_menu_for_nsapp call:

Image
@FabianLars FabianLars added the bug Something isn't working label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants