tauri
tauri copied to clipboard
feat(macos): add `automatic_tabbing` option, closes #3912
What kind of change does this PR introduce?
- [ ] Bugfix
- [x] Feature
- [ ] Docs
- [ ] New Binding issue #___
- [ ] Code style update
- [ ] Refactor
- [ ] Build-related changes
- [ ] Other, please describe:
Does this PR introduce a breaking change?
- [ ] Yes, and the changes were approved in issue #___
- [x] No
Checklist
- [x] When resolving issues, they are referenced in the PR's title (e.g
fix: remove a typo, closes #___, #___) - [x] A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
- [ ] I have added a convincing reason for adding this feature, if necessary
Other information
Closes #3912 Uses the new API introduced in Tao in https://github.com/tauri-apps/tao/pull/586.
Is it just the Windows/Linux user in me or is this something that should be off by default (or always)?
I'd love it to be off by default but that's not default behaviour on macOS… Should we override it by default? I don't know. 🤔
Edit: for reference, default behaviour on macOS (ie, when this is on) is to follow the preference set by the user. The default system preference is for "automatic tabbing" to be enabled in fullscreen mode only.
Just a thought – if it's off by default that will technically be a breaking change, so even if we do want that, maybe best to add it as-is for v1.2 and then change the default in v2.0?
electron actually uses tabbingIdentifier and disables tabbing if the window is transparent or if it doesn't have decorations.
if (tabbingIdentifier.empty() || transparent() || !has_frame()) {
[window_ setTabbingMode:NSWindowTabbingModeDisallowed];
} else {
[window_ setTabbingIdentifier:base::SysUTF8ToNSString(tabbingIdentifier)];
}
This also closes #2804
Ah, I was sure there was another issue, but I failed to find it, thanks.
electron actually uses tabbingIdentifier
I did try that it it didn't seem to have any effect, but I might have done something wrong. Might be worth playing with it again.
and disables tabbing if the window is transparent or if it doesn't have decorations.
That seems sensible. Though I must say I'm quite drawn to the idea of disabling it by default, and providing an option to enable. What do you think?
I can also play with the tabbingIdentifier later - I expect it to define groups of windows that can be tabbed together. I like the idea of disabling it by default, and it's what electron does.
I've opened a PR to add tabbing identifier support on tao. I couldn't understand how it works when changing the identifier at runtime, but the builder with_tabbing_identifier method works fine. I think we should include it here and work similar to electron, they have that nice logic for it.
Wouldn't keeping both options make most sense, since both exist on macOS? I don't think they quite do the same thing.
At the very least, if a tabbing identifier isn't set, we should set NSWindowTabbingModeDisallowed like in the Electron code you shared above. Otherwise, unless a unique tabbing identifier is set for each window, windows will still be grouped into tabs.
Edit: Apologies, now I look properly, I see that's effectively what you've done. Seems good, but I'll go over it properly now 😄
Looks good! Thanks @lucasfernog.