From 395022d65284ea95187a99a192efc1fb8b33fffc Mon Sep 17 00:00:00 2001 From: daboe01 Date: Sat, 6 Dec 2025 19:39:53 +0100 Subject: [PATCH] new: Hide main menu items that do not have submenus --- AppKit/CPMenu/_CPMenuBarWindow.j | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/AppKit/CPMenu/_CPMenuBarWindow.j b/AppKit/CPMenu/_CPMenuBarWindow.j index 513ec2049..d401b16fd 100644 --- a/AppKit/CPMenu/_CPMenuBarWindow.j +++ b/AppKit/CPMenu/_CPMenuBarWindow.j @@ -390,11 +390,18 @@ continue; } - if ([item isHidden]) + // Fix for #1742: If a main menu item does not have a submenu, it should not appear in the menu bar. + if ([item isHidden] || ![item submenu]) + { + [[item _menuItemView] setHidden:YES]; continue; + } - var menuItemView = [item _menuItemView], - frame = [menuItemView frame]; + var menuItemView = [item _menuItemView]; + + [menuItemView setHidden:NO]; + + var frame = [menuItemView frame]; if (isLeftAligned) { @@ -464,7 +471,7 @@ { var item = items[index]; - if ([item isHidden] || [item isSeparatorItem]) + if ([item isHidden] || [item isSeparatorItem] || ![item submenu]) continue; if (CGRectContainsPoint([self rectForItemAtIndex:index], aPoint))