| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
MenuBarExtra lacks 1st-party API to get or set the menu presentation state, disable the menubar extra, access the NSStatusItem, or access the popup's NSWindow. (Still as of Xcode 26)
@main struct MyApp: App {
@State var isMenuPresented: Bool = false
@State var isMenuEnabled: Bool = true
@State var statusItem: NSStatusItem?
var body: some Scene {
MenuBarExtra("My App") {
MenuView()
.introspectMenuBarExtraWindow { window in
// if using `.window` MenuBarExtra style, optionally set up NSWindow
}
}
.menuBarExtraAccess(
isPresented: $isMenuPresented,
isEnabled: $isMenuEnabled // if omitted, defaults to `.constant(true)`
) { statusItem in
// optionally set up NSStatusItem, or store its reference in a state var
self.statusItem = statusItem
}
.menuBarExtraStyle(.window)
}
}The library is available as a Swift Package Manager (SPM) package.
Use the URL https://github.com/orchetect/MenuBarExtraAccess when adding the library to a project or Swift package.
Check out the Examples folder for a demonstration of the package's usage.
Check out MacControlCenterUI, a SwiftUI package built on MenuBarExtraAccess for easily building Control Center style menus.
Coded by a bunch of 🐹 hamsters in a trenchcoat that calls itself @orchetect.
Licensed under the MIT license. See LICENSE for details.
Please do not email maintainers for technical support. Several options are available for issues and questions:
If you enjoy using MenuBarExtraAccess and want to contribute to open-source financially, GitHub sponsorship is much appreciated. Feedback and code contributions are also welcome.
Contributions are welcome. Posting in Discussions first prior to new submitting PRs for features or modifications is encouraged.
In an effort to maintain a consistent level of code quality and safety, this repository was built by hand and is maintained without the use of AI code generation.
AI-assisted contributions are welcome, but must remain modest in scope, maintain the same degree of quality and care, and be thoroughly vetted before acceptance.
| Back | FazBrowse Home | New Git URL |