Skip to content

Commit

Permalink
Fixed regression introduced in 1.1.0 where a window-based MenuBarExtr…
Browse files Browse the repository at this point in the history
…a would fail to close its window (#14)
  • Loading branch information
orchetect committed Oct 4, 2024
1 parent 03f6bfb commit ada1c2d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/MenuBarExtraAccess/MenuBarExtraAccess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ struct MenuBarExtraAccess<Content: Scene>: Scene {
print("MenuBarExtra index \(index) drop-down window did resign as key.")
#endif

// it's possible for a window to resign key without actually closing, so let's
// close it as a failsafe.
if window.isVisible {
#if DEBUG
print("Closing MenuBarExtra index \(index) drop-down window as a result of it resigning as key.")
#endif

window.close()
}

MenuBarExtraUtils.setKnownPresented(for: .index(index), state: false)
isMenuPresented = false
}
Expand Down

0 comments on commit ada1c2d

Please sign in to comment.