diff --git a/Ice/Accessibility/AccessibilityMenuBarItem.swift b/Ice/Accessibility/AccessibilityMenuBarItem.swift index e7ce0c98..49a0a9b6 100644 --- a/Ice/Accessibility/AccessibilityMenuBarItem.swift +++ b/Ice/Accessibility/AccessibilityMenuBarItem.swift @@ -12,6 +12,11 @@ struct AccessibilityMenuBarItem { /// The underyling UI element. let uiElement: UIElement + /// A Boolean value that indicates whether the menu bar item is enabled. + var isEnabled: Bool { + (try? uiElement.attribute(.enabled)) == true + } + /// Creates an accessibility menu bar item from the given UI element. /// /// - Parameter uiElement: A UI element that represents a menu bar item. diff --git a/Ice/MenuBar/MenuBarManager.swift b/Ice/MenuBar/MenuBarManager.swift index 727a7127..1cde3098 100644 --- a/Ice/MenuBar/MenuBarManager.swift +++ b/Ice/MenuBar/MenuBarManager.swift @@ -287,7 +287,9 @@ final class MenuBarManager: ObservableObject { var menuBarFrame = try menuBar.frame() menuBarFrame.origin = CGDisplayBounds(display).origin menuBarFrame.size.width = try menuBar.menuBarItems().reduce(into: 0) { width, item in - try width += item.frame().width + if item.isEnabled { + try width += item.frame().width + } } if menuBarFrame.width == .zero { return menuBarFrame