Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispositioned Popover #13

Open
Yang-Xijie opened this issue Aug 20, 2021 · 0 comments
Open

Dispositioned Popover #13

Yang-Xijie opened this issue Aug 20, 2021 · 0 comments

Comments

@Yang-Xijie
Copy link
Owner

statusBarItem?.button?.action = #selector(AppDelegate.togglePopover(_:))
// When starting the app, show the popover. If don't do like this, open the app and shortcuts will not work until click the icon on the menu bar.
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
    if let button = self.statusBarItem?.button {
        self.popover.show(
            relativeTo: button.bounds,
            of: button, preferredEdge: NSRectEdge.minY)
    }
}

The problem is that if the user hide the menu bar (System Preferences -> Dock & Menu Bar -> Dock & Menu Bar -> Automatically hide and show the menu bar -> checked), the popover will appear on the top left corner of the screen, instead of appearing below the menu bar icon.

Also check zaferarican/menubarpopoverswiftui2#3 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant