fix(desktop): clean up lingering menu popup windows#7593
Conversation
Greptile SummaryThis PR adds an
Confidence Score: 4/5The change is a targeted, isolated workaround for a known macOS rendering bug; it touches only one new delegate method and has no effect on the rest of the app's lifecycle. The fix works correctly for its stated purpose today, but it relies on an undocumented AppKit window-title prefix and scans all process windows without scoping to the status-bar menu — both are fragile points that could silently break or cause unintended side effects in future macOS versions or if the codebase grows. desktop/Desktop/Sources/OmiApp.swift — specifically the Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant StatusBarMenu as NSMenu (status bar)
participant AppDelegate as AppDelegate (NSMenuDelegate)
participant MainQueue as DispatchQueue.main
participant AppWindows as NSApp.windows
User->>StatusBarMenu: Clicks away / dismisses menu
StatusBarMenu->>AppDelegate: menuDidClose(_:)
AppDelegate->>MainQueue: asyncAfter(deadline: .now() + 0.1)
Note over MainQueue: 100 ms delay
MainQueue->>AppWindows: Iterate all windows
loop For each window
AppWindows-->>MainQueue: window
alt "title.hasPrefix(Item-) && isVisible"
MainQueue->>AppWindows: window.orderOut(nil)
Note over AppWindows: Lingering popup dismissed
end
end
Reviews (1): Last reviewed commit: "fix(desktop): clean up lingering menu po..." | Re-trigger Greptile |
|
Addressed Greptile's menu cleanup comments in follow-up commit |
cac1ecc to
681b8dd
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
kodjima33
left a comment
There was a problem hiding this comment.
Owner-override merge: desktop bug fix (menu popup cleanup), small surgical Swift change, no abuse signals
Summary
NSMenuDelegate.menuDidClose(_:)cleanup pass for status-bar menu popup windowsItem-*Closes #7516
Why
Issue #7516 reports a transparent Omi-owned popup-layer window left behind after dismissing the macOS status-bar menu on an external display. The window is invisible but still intercepts clicks in a rectangular area under the menu-bar icon.
Omi already filters these menu popup windows in
revealMainWindowIfAvailable()by checkingwindow.title.hasPrefix("Item-"), but there was no matching close-time cleanup.Implementation details
menuDidClose(_:)in the existingAppDelegate: NSMenuDelegateNSApp.windowswhose title starts withItem-orderOut(nil)instead of closing unrelated app windowsThe fix is intentionally narrow: it only touches AppKit menu popup windows created for the status-bar menu and leaves the main app, floating bar, and agent windows alone.
Verification
xcrun swift build -c debug --package-path Desktop