tauri icon indicating copy to clipboard operation
tauri copied to clipboard

feat(macos): add `automatic_tabbing` option, closes #3912

Open caesar opened this issue 3 years ago • 3 comments

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.

caesar avatar Oct 13 '22 10:10 caesar

Is it just the Windows/Linux user in me or is this something that should be off by default (or always)?

FabianLars avatar Oct 13 '22 12:10 FabianLars

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.

caesar avatar Oct 13 '22 12:10 caesar

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?

caesar avatar Oct 13 '22 14:10 caesar

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)];
  }

lucasfernog avatar Oct 17 '22 19:10 lucasfernog

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?

caesar avatar Oct 17 '22 21:10 caesar

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.

lucasfernog avatar Oct 17 '22 23:10 lucasfernog

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.

lucasfernog avatar Oct 18 '22 12:10 lucasfernog

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 😄

caesar avatar Oct 18 '22 20:10 caesar

Looks good! Thanks @lucasfernog.

caesar avatar Oct 18 '22 20:10 caesar