-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add query and mutation controls for the traffic light window buttons #27
Comments
macos_window_utils provides the When the full-size content view is enabled, it uses While there is currently no way to freely position the traffic light buttons, you can manipulate their position by changing the window’s toolbar style. (So, when building your own custom app bar, be sure to simply choose a toolbar style with the correct size.) Personally, I am not aware of any API that allows you to change the position of the window buttons freely. It’s possible that applications that do move them either do it by like this or simply by hiding the “real” traffic light buttons and implementing their own versions of them. I assume Opera GX, for example, does the latter. |
I'm not sure how to use the toolbar style to achieve the goal I mentioned. I start with: WindowManipulator.makeTitlebarTransparent();
WindowManipulator.hideTitle();
WindowManipulator.enableFullSizeContentView(); The above configuration is needed so that I can display tabs at the top of the window, instead of showing the window title. Then, I tried every toolbar style, and none of them cause the traffic lights to move at all. WindowManipulator.setToolbarStyle(toolbarStyle: /** I tried every value here **/); |
Be sure to call |
Ok, using I see now that the docs for I also found the term |
I admit that the names aren’t very intuitive, but the reason for this is that I modeled them loosely after the way in which you add to or modify toolbars of an NSWindow in Swift. In Swift, you’d first create an NSToolbar object, then add it to the window, and then set its style. I suppose having the toolbar be added or removed automatically based on an argument to |
Adding an |
I’ve been thinking about adding a way to add native buttons to the toolbar to fix that. So far I haven’t really dedicated any time to researching this approach, though. |
Having native buttons might work for simple apps but as soon as you need custom behaviors or style you are back to wanting full control from the Flutter side. The approach outlined in the linked issue is the only way to achieve this I have found so far. |
True. I’ll look into your code and see if it can be integrated well into macos_window_utils when I have time to do so. |
Alright, version 1.3.0 resolves this. |
Every Mac desktop window has three little window control buttons, often called "traffic lights".
These buttons have a default appearance, but their location can be changed by the developer.
The traffic lights create at least a couple of issues for UI developers.
First, content needs to avoid the traffic lights. If I'm building a custom app bar, or allowing my content to flow to the top of the window, how do I know where those traffic lights are? This requires an ability to query the current size and location of the traffic lights, from the platform.
Second, if I'm building a custom app bar, it's conventional that the traffic light buttons should appear vertically centered in that app bar. Therefore, I'd like to be able to tell the platform where to put the traffic lights.
I recommend approaching this problem as pass-through control of the platform. I don't recommend trying to hide information, or simplify behavior. The platform has an API for these details - making that API available through this package via Dart is the most versatile option available. Simplified behaviors and widgets can be added on top in macos_ui.
The text was updated successfully, but these errors were encountered: