Sublime Forum

Combine Windows?

#1

Hello, is there a way to combine all windows into one? I think it would be great to be able to combine all project windows into one with tabs to switch from window to window, is this possible?

macOS Sierra 10.12.2

2 Likes

API Suggestions
#2

Currently, when you’re in full screen and for instance open preferences, this opens in a new tab. I like being able to “Merge All Windows” in most other apps, and it would be useful here too.

0 Likes

#3

You mean like this bellow?

0 Likes

#4

No, like this:

0 Likes

#5

this opens in a new tab

You mean new window, don’t you?

Preferences are displayed in a new window to achieve a 2 column side-by-side layout without interfering with your current window’s layout. Preferences can’t know how to display well if your current layout contains more than 2 view’s and they must not change your layout.

Moreover the Preferences window can be understood as some kind of standalone preferences dialog box. So merging makes no sense here.

0 Likes

#6

No, if you use the default theme macOS will merge the windows into tabs if you’re in full screen (at least that’s the default setting).

0 Likes

#7

I opened a feature request to allow this on the Core issue tracker:

  1. Core$1794 API to set/change/move views between different windows

After that API addition, you can create the following package/plugin to create the command gather_all_windows_here:

import sublime
import sublime_plugin


class GatherAllWindowsHereCommand( sublime_plugin.TextCommand ):

    def run( self, edit ):
        windows        = sublime.windows()
        current_window = sublime.active_window()
        windows.remove( current_window )

        for window in windows:

                for view in window.views()
                    current_window.attach_view( view.id() )
0 Likes

#8

I think there is a misunderstanding here, perhaps because not everyone is familiar with the way macOS Sierra deals with with windows and tabs.

If I’m right, @addons_zz and @deathaxe propose a feature where all tabs from multiple windows are merged into a single window:

As @deathaxe notes this is problematic with preferences. What would you do with the layout of the panes in both windows? What happens with the tree? Lots of problems for seemingly little profit.

However, I believe the OP @Awatatah is referring to improved support for merging multiple windows via Sierra’s native window management. This behaviour already occurs if you do something that would open a new window (e.g. opening preferences), if you’re in full screen mode, or have selected “Always” in this system setting:

What happens is this:

The default setting is to have this behaviour only when full screen. Also, it requires a normal title bar so it doesn’t work with the Adaptive theme. Pretty much all applications support this behaviour already. All Sublime is missing right now is

  • A menu entry for “Merge All Windows” as in my example using Terminal. As I understand it, supporting this requires hardly any effort. Right now, the new merging behaviour is sometimes triggered automatically, but users can’t do it when they want to. Sublime should acknowledge this feature of Sierra and make the relevant options available to users, there seems to be no reason not to (other than not having the time to look into it of course).

  • Commands to go from one tab to another. The normal keybindings switch document-tabs inside a Sublime window. If the commands are supported users should be able to set their own keybindings if they like. Right now, the menu commands “Show Previous Tab” and “Show Next Tab” are not available. It should be quite easy to add them along with “Merge All Windows”, since Sierra takes care of the implementation and window management.

@wbond If I’m right you’re on a Mac… any plans to fine tune the window merging behaviour for Sierra?

4 Likes

#9

Thanks for explaining. You are correct. Now reading the OP first post again if fits perfectly on your description:

I think it would be great to be able to combine all project windows into one with tabs to switch from window to window, is this possible?

0 Likes

#10

Very correct. :wink: Much thank’s for clarification.

This is indeed a very nice way to handle multiple windows of an application which I would like to see as a Windows/Linux user, too, some day. Having the ability to manage multiple windows with independent content and layout by a second level of tabs could avoid switching back to OS GUI to switch between project’s. Switching between windows can be a bit annoying sometimes if you have many windows open.

1 Like

#11

Yes, it’s very elegant. MacOS seems more and more focused on making sure you’re comfortable at an effective resolution of 1280x800 (i.e. their 12" and 13" laptops). It’s been a while since I felt the need to ramp up the scaling.

1 Like

#12

Necromancing a thread here. So there’s been no update on making the Multi-Window into Multi Tabs aside from the Sublime Text Buffer Tabs already?

0 Likes

#13

This feature should already be supported on recent (dev) builds.

0 Likes

#14

How so? I don’t see any changes related to this in recent builds?

0 Likes

#15

Is it not? I don’t have a Mac so this is solely based on what I read on the issue tracker and similar.

0 Likes

#16

If you’re talking about what I think you are, at some level this does indeed exist and has since 2017. I don’t know if it uses the specific menu option to gather windows together though. See the thread linked below.

It’s specifically mentioned by Will in that thread that this doesn’t work when you use the Adaptive theme because that theme uses a full window content area which is incompatible, so if you’re not seeing this that might be one reason for it. Another might be that you need to change the Dock setting for Prefer tabs when opening documents.

[Edit] : This sort of thing is currently possible, but there is no menu item under Window to combine existing windows into one. However I don’t know if that’s supposed to just be native because iTerm doesn’t have it either.

2 Likes

#17

Another might be that you need to change the Dock setting for Prefer tabs when opening documents.

Yeah, well duh. That’s not how you support macOS tabs. You need to expose this behavior via the Window menu, so the user can select it when he wants it. Now you’re globally forcing the behavior for all applications. Perhaps that’s what you want, but that’s not the default and not preferable in most situations.

There also should be a Merge All Windows entry in the Windows menu. That other applications also haven’t got with the program yet is irrelevant, the menu entry should be added.

Also, the keybinding @wbond mentions in that thread doesn’t work.

Also, this bug still exists that will leave ST in an unusable state if you close a tab the wrong way.

So, no, this behavior isn’t supported. It’s something all applications in macOS got for free, what @OdatNurd is describing probably also works in ST2. What’s missing from ST3 is that it exposes the behavior properly and doesn’t break when you use it.

I’m using the Adaptive theme because I got pretty tired of running into that bug by accident and having to restart ST. And it looks better :slight_smile:

0 Likes

#18

Well, I did say “at some level this does indeed exist”, I didn’t say it was perfect. :wink:

It seems somewhat odd to me MacOS provides the ability to put multiple windows in one automatically but doesn’t also provide the menu item automatically too, though. I would have thought that if a global system setting can merge windows without the application needing any custom code, it should be able to happen at any point (with the assumption that the application handles events properly).

In any case I only became aware of this when various people on Stack Overflow started asking how to stop Sublime from doing it (the answer being to flip the state of the above setting), which would tend to prove that the inverse of your case is also true and there are people that want this facility in general and just not for Sublime.

So I would agree that if Sublime wants to be a good MacOS citizen it should probably include this functionality.

0 Likes

#19

macOS tends require developers to do something, sometimes as small as adding a menu item, to fully enable a new feature. I think it tends to strike a good balance between enforcing standards and giving developers the flexibility they need. :man_shrugging:t3:

That bug is the worst thing though. If the functionality was there but hidden and slightly half baked, that’d be ok. Right now it’s broken in a way that will leave ST in an unusable state if you look at it wrong.

0 Likes

#20

What about not being on a Mac? Linux or Windows? Combining all Windows as a single “window” with multiple tabs under each window tab.

0 Likes