From abea6e64e4d011583255387e78ba709e1183a356 Mon Sep 17 00:00:00 2001 From: Sanjay Date: Sat, 23 Aug 2025 04:35:45 -0700 Subject: [PATCH] macOS: default menu uses bundle name Use the bundle name in the default menu or fall back to using the process name as before. --- winit-appkit/src/menu.rs | 7 +++++-- winit/src/changelog/unreleased.md | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/winit-appkit/src/menu.rs b/winit-appkit/src/menu.rs index f99dc6d3..5568ff5f 100644 --- a/winit-appkit/src/menu.rs +++ b/winit-appkit/src/menu.rs @@ -2,7 +2,7 @@ use objc2::rc::Retained; use objc2::runtime::Sel; use objc2::{sel, MainThreadMarker}; use objc2_app_kit::{NSApplication, NSEventModifierFlags, NSMenu, NSMenuItem}; -use objc2_foundation::{ns_string, NSProcessInfo, NSString}; +use objc2_foundation::{ns_string, NSBundle, NSProcessInfo, NSString}; struct KeyEquivalent<'a> { key: &'a NSString, @@ -16,7 +16,10 @@ pub fn initialize(app: &NSApplication) { menubar.addItem(&app_menu_item); let app_menu = NSMenu::new(mtm); - let process_name = NSProcessInfo::processInfo().processName(); + let process_name = match NSBundle::mainBundle().name() { + Some(bundle_name) => bundle_name, + None => NSProcessInfo::processInfo().processName(), + }; // About menu item let about_item_title = ns_string!("About ").stringByAppendingString(&process_name); diff --git a/winit/src/changelog/unreleased.md b/winit/src/changelog/unreleased.md index 65fa6219..006ed035 100644 --- a/winit/src/changelog/unreleased.md +++ b/winit/src/changelog/unreleased.md @@ -174,6 +174,7 @@ changelog entry. - Rename `VideoModeHandle` to `VideoMode`, now it only stores plain data. - Make `Fullscreen::Exclusive` contain `(MonitorHandle, VideoMode)`. - Reworked the file drag-and-drop API. +- On macOS, the default menu uses the bundle name or falls back to the process name as before. The `WindowEvent::DroppedFile`, `WindowEvent::HoveredFile` and `WindowEvent::HoveredFileCancelled` events have been removed, and replaced with `WindowEvent::DragEntered`, `WindowEvent::DragMoved`,