Split the tray into Apps and System sections
Control Center items sat in the same grid as third-party app icons, which
was hard to scan. Group them so Apple's Wi-Fi, Battery, Clock and friends
are listed separately from your apps' icons.
💘 Generated with Crush
Assisted-by: Crush:deepseek-v4.1-flash
This commit is contained in:
@@ -9,6 +9,8 @@ struct MenuBarItem: Identifiable, Equatable {
|
||||
let appName: String
|
||||
let title: String
|
||||
let icon: NSImage
|
||||
/// True for Apple's own items (Control Center, Spotlight, …).
|
||||
let isSystem: Bool
|
||||
let element: AXUIElement
|
||||
|
||||
static func == (lhs: MenuBarItem, rhs: MenuBarItem) -> Bool {
|
||||
@@ -91,6 +93,7 @@ final class MenuBarItemManager: ObservableObject {
|
||||
appName: app.localizedName ?? app.bundleIdentifier ?? "Unknown",
|
||||
title: title,
|
||||
icon: Self.icon(forTitle: title, app: app),
|
||||
isSystem: Self.isSystemBundle(app.bundleIdentifier),
|
||||
element: child
|
||||
))
|
||||
}
|
||||
@@ -134,6 +137,16 @@ final class MenuBarItemManager: ObservableObject {
|
||||
return AXUIElementPerformAction(item.element, kAXShowMenuAction as CFString) == .success
|
||||
}
|
||||
|
||||
// MARK: - Classification
|
||||
|
||||
/// Apple's own menu bar items (Control Center, Spotlight, the input-source
|
||||
/// agent, …) live under `com.apple.*` bundles; everything else is a third
|
||||
/// party app.
|
||||
nonisolated static func isSystemBundle(_ bundleID: String?) -> Bool {
|
||||
guard let bundleID else { return false }
|
||||
return bundleID.hasPrefix("com.apple.")
|
||||
}
|
||||
|
||||
// MARK: - Icons
|
||||
|
||||
/// Picks an icon for a menu bar item. Control Center owns many unrelated
|
||||
|
||||
Reference in New Issue
Block a user