Skip to content

Adds the ability to disable allows_automatic_window_tabbing on macOS. #2933

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

karolisr
Copy link

@karolisr karolisr commented May 5, 2025

macOS intrusively adds certain global menu items if a certain menu item is present and if the underlying feature of the AppKit is enabled. For example, if a View global menu item is present and the allowsAutomaticWindowTabbing value is set to true, the Show/Hide Tab Bar item is added to the View submenu (see images). By default, allowsAutomaticWindowTabbing is set to true. This makes any application with a View menu item the ability to show/hide potentially useless tab bar. See attached images that show the described menu item and the tab bar in the window.

This PR exposes this setting in settings::Settings (core/src/settings.rs) and applies it in iced_winit::run function.

tab_bar_visible tab_bar_hidden

@dtzxporter
Copy link
Contributor

This belongs in platform specific settings:

core/src/window/settings/macos.rs

@karolisr
Copy link
Author

karolisr commented May 6, 2025

Hmm, I think/thought this was an application-wide setting for allowing tabbing in windows (although it is under NSWindow in Apple's API). If this is indeed a per-window setting, it is a method of winit::platform::macos::ActiveEventLoopExtMacOS as opposed to winit::platform::macos::WindowAttributesExtMacOS where other settings in core/src/window/settings/macos.rs live. The only place in iced where we have a reference to winit::event_loop::ActiveEventLoop is in winit/src/lib.rs. I am not quite familiar with iced enough to immediately understand where the call to the ActiveEventLoop::set_allows_automatic_window_tabbing(&self, enabled: bool) method should be placed as it does not appear to operate on a specific window instance, but on application windows as a whole.

P.S. To clarify, the tab-bar can be shown/hidden per window, the tabbing itself is a property of the application. Thus set_allows_automatic_window_tabbing should apply to the entire application. Is there a place for platform-specific application settings in iced?

@airstrike
Copy link
Contributor

See https://docs.iced.rs/iced/window/struct.Settings.html#structfield.platform_specific

Which is what @dtzxporter was referring to in his previous comment

Also thanks for your work on this and menu bars in general. As a user, I truly appreciate it.

@karolisr
Copy link
Author

karolisr commented May 7, 2025

See https://docs.iced.rs/iced/window/struct.Settings.html#structfield.platform_specific

Which is what @dtzxporter was referring to in his previous comment

Also thanks for your work on this and menu bars in general. As a user, I truly appreciate it.

Thanks, I think you may have missed my point, the link and the @dtzxporter comment references window specific settings, which I am aware of. This is not a window specific setting, it is an application-wide setting.

@pml68
Copy link
Contributor

pml68 commented May 7, 2025

This is not a window specific setting, it is an application-wide setting.

In this case you'd ideally create a PlatformSpecific struct in a similar fashion to core/src/window/settings/* and add a corresponding platform_specific field to core::Settings, instead of adding a field that only exists on one platform to the struct directly.

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

Successfully merging this pull request may close these issues.

4 participants