Close the panel when a tray item is selected
Selecting a tile opened the app's menu while SimpleTopBar's own panel
stayed on top of it, and could leave menus such as Spotlight stranded
behind it. Dismiss the panel first so the selected menu is unobstructed.
💘 Generated with Crush
Assisted-by: Crush:deepseek-v4.1-flash
This commit is contained in:
@@ -30,6 +30,9 @@ final class MenuBarItemManager: ObservableObject {
|
||||
|
||||
private var observers: [NSObjectProtocol] = []
|
||||
|
||||
/// Called just before pressing an item so the owner can close its panel.
|
||||
var onWillPress: (() -> Void)?
|
||||
|
||||
private init() {}
|
||||
|
||||
func start() {
|
||||
@@ -113,6 +116,10 @@ final class MenuBarItemManager: ObservableObject {
|
||||
/// hide again shortly after. The reveal is momentary rather than lasting the
|
||||
/// whole time the panel is open.
|
||||
func press(_ item: MenuBarItem) {
|
||||
// Close our own panel first, otherwise it stays open on top of the
|
||||
// menu that is about to appear (and can leave menus behind it).
|
||||
onWillPress?()
|
||||
|
||||
let hider = MenuBarHider.shared
|
||||
let needsReveal = hider.isHiding
|
||||
guard needsReveal else {
|
||||
|
||||
Reference in New Issue
Block a user