Sublime Forum

4109 always opens a new windows after build?

#1

I’m using win10. After updating to 4109 today, there is always a new window opened every time when I build my latex. This drives me insane.

0 Likes

New upgrade creates a new instance after each build
LaTeXTools command is opening a new window of Sublime Text editor
New window opens with every LaTeX build
#2

Can you clarify how you’re building your latex?

0 Likes

#3

I use the old latexing package, because I never have any issue with it. It was fine all the time until I upgraded to 4109. I think latexing overrides the default build system.

startup, version: 4109 windows x64 channel: dev
executable: /C/xxxxxxx/sublime_text/sublime_text.exe

First, I compile a latex file using the latexing built-in system. Then, a pdf document pops up. After that, a new empty file (with no file extension) pops up, and the cursor moves to this new file. The number of the files increase with the number of compiling times.

0 Likes

#4

Looks like it’s using the Sublime Text executable to focus back on the Sublime Text window. This is fundamentally incompatible with how applications on Windows function, as they’re expected to open a new window when executed. It should be using the command line executable instead. The "keep_focus" setting for latexing can be used to work around this bug.

1 Like

#5

Thanks for your reply. It seems like this setting does not work for this bug. Also, I’m using a portable version.

DPI mode: per-monitor v2
startup, version: 4109 windows x64 channel: dev
executable: /C/xx/softwares/sublime_text/sublime_text.exe
application: /C/xx/softwares/sublime_text
working dir: /C/Users/xx/AppData/Local/Temp
packages path: /C/xx/softwares/sublime_text/Data/Packages
state path: /C/xx/softwares/sublime_text/Data/Local
zip path: /C/xx/softwares/sublime_text/Packages
zip path: /C/xx/softwares/sublime_text/Data/Installed Packages

Now, as a workaround, I downgraded to 4106 while I luckily have a backup.

0 Likes

#6

Make sure you’re setting the setting in the latexing package’s setting (not the global ones), and that you’re setting "keep_focus": true.

0 Likes

#7

Thanks. I did it. I put it in the latexing user settings, but it wouldn’t help.
The weird thing is that everything works properly when I switch back to 4106. So, I’m not sure if 4109 changed how the compile system works.

0 Likes

#8

4109 fixes Sublime Text not acting like other Windows applications. When you click on the taskbar or run it from the windows menu it’s supposed to open a new window. This was fixed in 4109, hence changing the behavior with your plugin.

0 Likes

#9

ok. thanks. I guess I need to find some other workarounds since this change will be permanent.:sweat_smile: Also, we can wait to see if other users have similar issues when using other compilation systems.

0 Likes

#10

I suggest filing an issue with latexing to get them to use the command line tool instead of the main application executable to fix this issue.

0 Likes

#11

For those who may have the same issue, "keep_focus": false solves the problem.

ps: this is not a perfect solution.

0 Likes

Prevent opening a new tab when we launch ST4
#12

I had the same problem with LatexTools. Setting keep_focus = false in the user settings seems to do the job as well!

1 Like

#13

why not perfect? I find it works well after setting it to be “false”. Will there be some unpleasant new problems caused by the setting?

0 Likes

#14

Because it loses focus, which is not what I want. When you compile a latex file, you will have to click the source file to gain the focus and type again.

0 Likes

#15

With the proviso that I’m not a LaTeX person and thus don’t use this package, I’ve looked at the source for the package and it seems to me that the reason why this is happening is because this package (and one other one that is functionally identical) try to invoke subl to give focus, and if that fails they drop back to using the executable that was used to start Sublime.

subl with no arguments will focus the window, but sublime_text will create a new one if it’s invoked. Thus turning off the setting stops it from doing the wrong thing, at the expense of the focus not being in Sublime.

I’ve not tested it, but if you add the location that Sublime Text is installed to to the path, as is described in the documentation on setting up for the command line such that using subl from a command prompt doesn’t display an error, it seems like both packages should go back to functioning properly until someone fixes them to not do the incorrect thing.

Remember that when you alter the environment as you have to do when adjusting the PATH, you need to restart applications that were already running before you made the change in order for them to get the update; this includes the command prompt, if you happened to already have it open.

1 Like

LaTeX: Sublime opens several files
#16

For those of you who wants the keep_focus function, try this. It worked for me.
As @OdatNurd figured out for us, if we can set the program to use “subl.exe” when keep_focus-ing, it won’t open a new window(Thanks @OdatNurd!).
We can do that by using the “sublime_executable” option. It’s one of the platform settings, so you can add something like this in your settings file(if you’re on Windows):

"windows": {
// Command to invoke Sublime Text. Used if the keep_focus toggle is true.
// If blank, "subl.exe" or "sublime_text.exe" will be used.
"sublime_executable": "C:\\your\\full\\sublime\\directory\\subl.exe",
},

and Of course, you should set the “keep_focus” setting to true:

"keep_focus": true,

4 Likes

#17

Thank you, smilety! It worked for me as well.

0 Likes

#18

Thanks. This works. But there is a small issue. Before Sublime Text gets the focus again, there is a black cmd window that pops out and closed again. If this can be solved, that would be perfect.

0 Likes

#19

It worked perfectly! Thanks!

0 Likes