Notepad++ open in new instance because I use multiple desktops
-
I need notepad++ t open in a separate instance each time I click the taskbar icon
I use multiple desktops in Windows 11, and currently if I click Notepad++ from a desktop, it jumps to the desktop where it is already open…
I need to have Notepad++ opened and separate on each desktop as I used it for different projects on different desktops…
-
Notepad++ doesn’t have that feature, though you could read the FAQ to see where feature requests go.
Alternatives / workarounds:
- Always Open New Instance option: might be too far in the multi-instance direction, but it would accomplish your goal
- use Open Session in New Instance option, and a separate session file for each of your projects
- have shortcuts on your desktop with the
-multiInst
option, and use that to start your new instance on each desktop - use Move To New Instance and then move that instance to the right desktop
References:
-
I’m sure there are several open issue requests for multiple desktop support.
Please seek them out and add your thoughts to one or more of them, rather than creating a new (basically duplicate) issue. -
One silly solution would be to drag a tab out off the notepad++ window, and then drag it to other desktop. That way you have two different notepad++ instances in different desktops
-
I agree, would be an excellent feature. I have the same workflow: multiple Win10 desktops, have NP++ open in lots of them, opening new text files throws me over there.
But changing NP++ behavior to open new instances each time would not work for me either, as I have scripts that I run which open mutliple files that I do want grouped together in one instance of NP++.
An easy solution to me would be a command line switch that forces the opening of a file into a new NP++ instance. Then I could chose which files to start a new one.
-
@ElectroLund said in Notepad++ open in new instance because I use multiple desktops:
An easy solution to me would be a command line switch that forces the opening of a file into a new NP++ instance. Then I could chose which files to start a new one.
you mean like the already-existing
-multiInst
option, which does exactly that?(Though if you do use
-multiInst
, I recommend also using-nosession
, otherwise it will open your whole existing session plus the new file(s) in the new instance)so if you use
notepad++ -nosession -multiInst a.txt b.txt c.txt
, it will open those three files to a single new instance, separate from any notepad++ instance already running.I believe this accomplishes your goal (though maybe not the original poster’s goal)
-
@PeterJones Something I have thought about on and and off but never put down on paper to see if there are logic flaws is a mechanism for people to define instances using a keyword that’s on the command line.
Let’s say I have three projects,
apple
,banana
, andstrawberry
.If I run
Notepad++.exe -instance apple
then Notepad++ will look to see if there is already a copy of Notepad++.exe running that was started using -instanceapple
and if so passes the command line off to that running instance.This would allow for moving instances to different desktops or monitors.
I have not thought through the session.xml file but suspect the safe course would be for Notepad++ to create and maintain a session-apple.xml file.
If the config.xml file is also per-instance then you can park the instance on a desktop or monitor and that will get saved to config-apple.xml.
Instances would be much like running several portable copies but with the benefit of being able to define which instance I want to open a file in when using the command line.
-
what you describe seems to me what is already somewhat possible with the openSession parameter, using it like:
notepad++.exe -multiInst -openSession apple.xml
then managing those instances as sessions (apple.xml, banana.xml, strawberry.xml)
Righ now the problem is that, independently of the opened session, when you close notepad++, session.xml file is updated (and only this session).
So if you have multiple instances, then each one will update session.xml upon closing.
This disregard of openSession I never fully understood, as to me it should behave much like you just described. And although I understand it’s not completely useless the way it works now, it could be much more.
In this regard, this -instance parameter you speak of could be a alias (combined flag) for
-multiInst -openSession
with the opened session being “saved”. I assume the monitor it was last used with can also be saved. -
If the config.xml file is also per-instance then you can park the instance on a desktop or monitor and that will get saved to config-apple.xml.
Even better: in the multi-instance settings, there could be an “embed config in non-default session file” checkbox, and if that’s checked, then when you are dealing with a non-
sessions.xml
session, it could store that session’s configuration in the same file as the rest of the session; that way, the configuration is tightly coupled to the session itself (and it would solve the problem of having to separately track analternate-config.xml
location). Not that I think such a feature request would be implemented, but I think it’s a good idea. ;-)This disregard of openSession I never fully understood, as to me it should behave much like you just described
I concur. Has anyone ever asked for (specifically) not touching
sessions.xml
when-openSession
/File > Load Session… is active? -
@notdodgeball said in Notepad++ open in new instance because I use multiple desktops:
This disregard of openSession I never fully understood, as to me it should behave much like you just described.
I regularly use, or perhaps abuse,
-openSession
. A whie back I created a batch file, nplist.bat, that extracts file paths from a text file and generates asession.xml
file. It then runs Notepad++.exe with-openSession
. While I could have just run Notepad++.exe and passed the file names directly to it. I created nplist.bat because I wanted something that allowed me to open thousands of files at once. I did not think thousands of files would fit on the command line and was not comfortable with starting Notepad++.exe thousands of times and having those pass the file name on to the running copy of Notepad++.exe.Notepad++ must already have some sort of inter-process communication (IPC) that allows a newly loaded copy of Notepad++.exe to tell the main running instance of Notepad+exe to come to the foreground and to open one or more files.
That means I should be able to create an run-npp.exe that implements the
-instance
logic I proposed earlier. The easiest way to define and separate instances of Notepad++ would be to use portable copies. I’d put them in- c:\npp\apple\Notepad++.exe
- c:\npp\banana\Notepad++.exe
- c:\npp\strawberry\Notepad++.exe
This allows each instance of Notepad++ to live in its own world. This assumes that whatever IPC Notepad++ uses is something that allows for multiple copies of the .exe to run at the same time and for an external app to talk to them. If, for example, Notepad++ is using a named pipe with a fixed name then only one copy can own the pipe.
What want is the ability to tell an already running instance of Notepad++.exe to open a file. For example, I want to open fruit.txt in Notepad++ and want to use the
banana
instance of Notepad++.exe to view or work with this file.