-
Notifications
You must be signed in to change notification settings - Fork 899
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
Allow users to take control of the macOS menu bar #1855
Comments
You can obtain the NSApplication from anywhere in the process using |
Funnily enough, the |
I don't think such an API should be added to winit, because:
Although I am a proponent of merging #1583 because that addresses the use case of "I just want my simple little application to feel native on macOS". |
It doesn't seem very complex to me, as it's just two wrapper methods.
I wasn't really proposing that Winit add such functionality, so I'm not sure what you're addressing here. In any case, since this requires users to reach for macOS native APIs themselves, then I guess making them call this particular set of methods themselves isn't too much to ask of them. |
I agree. |
I don't know what's with me today. I completely missed that you only proposed to expose those two functions. But then just exposing those functions wouldn't help too much as you pointed out as well.
The part of the sentence you quoted was just explaining why this is a macOS-only addition but again when I wrote that sentence I thought you were proposing to define an API for constructing the entire menubar with all its sub elements. |
The ability to manipulate the macOS menu bar is important for GUI applications, but doing it is currently impossible with Winit's current API.
Setting and accessing the menu bar requires going through
NSApplication
, which Winit currently wholly owns, and doesn't expose anywhere. One approach here would be to exposeNSApplication
directly, but I guess that's not the direction we should go in, given thatEventLoopWindowTargetExtMacOS.hide_application
andEventLoopWindowTargetExtMacOS.hide_other_applications
are just thin wrappers aroundNSApplication
methods (?).Based on this, I propose that a
set_main_menu
and amain_menu
method are added toEventLoopWindowTargetExt
, which wrapsetMainMenu
andmainMenu
respectively. This represents the minimal API needed to let users take control of the menu bar (arguably, one might be able to make do with only one or the other).This may or may not have to interact with #1583 in some way, but I haven't thought too much about it.
The text was updated successfully, but these errors were encountered: