Sublime Forum

ST opens an extra window when opening document

#1

Hello,

I have ST build 4113 on Mac OS 11.5.2. When I open a new document by clicking on it, or a project with subl ., ST always opens a new blank editor window together with it. How do I fix this so only the relevant project / doc is gets opened?

Thanks.

0 Likes

#2

Is ST already open when you do this? Normally ST will restore previously open windows if you quit the application; see the "hot_exit" setting.

0 Likes

#3

Nope, when the app is already open it will only open the doc that’s clicked or the project that’s opened. When the app isn’t open it will open a blank new window and bring it into foreground / focus (with the above in the background).

Also, it does not restore anything from the previous session.

0 Likes

#4

Sorry I’m not following. Can you specify the exact behaviour you’re seeing and what you expect to happen instead?

0 Likes

#5

When I open a doc D or a project P, ST also opens a blank (empty) new window W ALONGSIDE with D or P. So instead of just having one open window (D or P), I end up with TWO open windows: D or P and W.

What I expect to happen instead: for ST to open D or P without also opening W.

Hope that makes sense.

0 Likes

#6

Is the Sublime Text application running already when this happens? Note that an application may be running even without any windows open.

0 Likes

#7

No, this happens only when the ST application is NOT running. When it’s already running only the clicked doc (or a project opened with subl . ) gets opened.

0 Likes

#8

What executable is subl linked to?

0 Likes

#9

Not sure about that. When I was installing ST on this machine, I used this (am using bash):

echo 'export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"' >> ~/.bash_profile

(as per these instructions: https://www.sublimetext.com/docs/command_line.html#mac)

The current output of echo $PATH is this:

/Users/me/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin
0 Likes

#10

You can find out by running ls -al $(which subl).

0 Likes

#11

Thanx! The output is:

May 15  2020 /usr/local/bin/subl -> /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl
0 Likes

#12

Does the "create_window_at_startup" change anything?

0 Likes

#13

I’ve set "create_window_at_startup": false, and now the subl . command only opens the current project directory. However when I click open a Markdown file on my Desktop it still opens a new window alongside with the file. In both cases, I exit the ST application beforehand.

0 Likes

#14

I have the same issue on Windows 10 and 11. When opening Sublime only everything is fine. If I open a document with sublime it opens additional empty windows in the background (in most cases 2 extra windows).

Update:
No behaviour change with
“create_window_at_startup”: false

0 Likes

#15

I’m noticing similar behavior on both WIndows 10/11 and Linux. If I run subl ., I get two windows; however, if I open a single document, then I get only one window.
Adding "create_window_at_startup": false to my settings makes no difference.

I began noticing this behavior after an update within the last couple of weeks. Unfortunately, I can’t be any more specific than that. Currently, I’m on build 4116 on both Windows & Linux.

0 Likes

#16

I hate to do a simple +1 on this, but +1. I believe it started happening for me somewhere around build 4114 (on Arch Linux, subl linked directly to the executable in /opt/). My window-related preferences:

"hot_exit": "disabled",
"remember_full_screen": false,
"remember_workspace": false,
"remember_layout": false,
"remember_open_files": false,
"open_files_in_new_window": "always",
"close_windows_when_empty": true,
"create_window_at_startup": false,
0 Likes

#17

We’ve got a fix for this in the works.

0 Likes

#18

Just to make an update, the latest build (4121) partially solves this issue. The extra window doesn’t pop up when a project is opened with subl . — but DOES pop up when a file is clicked open or opened with CMD+O (on Mac OS).

0 Likes

#19

I’m not sure if this is the bug described here or a new bug:

This is on a MacBook Pro/Intel with Catalina.

Since Build 4121 when I open a file by double-click in Finder, Sublime Text opens a new window/workspace with the file clicked, so far so good.

There is only this window in this workspace, the window with the opened file.

When I click on the red close icon top left, the window/workspace disappears.

But when I close the window with Command-W or click on the “x” on the file tab, then the file closes, but a new “Untitled” file shows, which wasn’t there before.

I have to close this “Untitled” file again to get rid of the window/workspace.

BTW Sublime Text was running before, it is always running on my machine :wink:

0 Likes

#20

I’m unable to reproduce that. Opening a file using cmd+o simply opens the file in the current window, no additional windows are opened. Does it happen in safe mode?

0 Likes