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

FB10185203: It should be possible to programmatically show/hide the window presented by SwiftUI MenuBarExtra #328

Open
sindresorhus opened this issue Jun 11, 2022 · 2 comments

Comments

@sindresorhus
Copy link
Member

  • Date: 2022-06-12
  • Resolution: Open
  • Area: SwiftUI Framework
  • OS: macOS 12.4
  • Type: Suggestion

Description

Lets say you make a menu bar app using the new MenuBarExtra SwiftUI scene and the WindowMenuBarExtraStyle.window style. When you click the menu bar item, it presents a window. It’s common to provide a way for the user to show and hide the window using a global keyboard shortcut. However, there is no way to programmatically toggle this window. So this feature cannot be implemented. It would be nice if the menu when using PullDownMenuBarExtraStyle.menu could be programmatically toggled too.

Most of my menu bar apps have a setting where the user can choose a global keyboard shortcut to toggle the window, so I will sadly not be able to move to MenuBarExtra at this time.

@Iomegan
Copy link

Iomegan commented Feb 17, 2023

This also makes sense for apps that want to show another window from the menu bar.

openWindow(id: "main-app-window")

will open a window but not close MenuBarExtra with WindowMenuBarExtraStyle.window.

@dgrcode
Copy link

dgrcode commented Oct 7, 2023

I recommend this package https://github.com/orchetect/MenuBarExtraAccess, found in a similar request #383 (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

3 participants