question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple instances open multiple instances

See original GitHub issue

I’m trying to implement an app that allows multiple instance to open. Each window is the same app pointing to index.html. I’m using App.on(“open”) to open new instances like the spec:

nw.App.on("open", function(args)
{
	nw.Window.open("index.html", { new_instance: true });
});

This causes each instance to listen for the open event. Instead of getting just 1 new window, each instance opens it’s own new window, leading to “Window Madness”.

I imagine most apps make the “main window” special, and be the only listener, but that doesn’t work. If the user closes the first window, the application will no longer open new instances.

Is this a bug, or a feature oversight? How can I get my application to open just 1 new window when they already have 3 or 4 instances already open?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
theakman2commented, May 11, 2019

I was also facing this problem. I got around it by:

  1. Changing the main field in the package.json from my index.html file to a new main.js file:
{
  ...
  "main": "main.js"
  ...
}
  1. Adding the following code to the main.js file:
function openApp() {
	nw.Window.open('index.html');
}

nw.App.on('open', openApp);
openApp();
  1. Removing all App ‘open’ event listeners from the index.html file.
0reactions
fusionstreamcommented, Aug 9, 2020

Just a note that the above doesn’t quite work as expected. This is visible when using adding a tray icon. Only one tray icon will be visible. There are other issues such as the inability to open more instances after closing the 2nd opened instance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Run Multiple Versions of the Same Program on Windows
Now, hold Shift while you right-click on the icon of the program. This will open a context menu with more options than usual....
Read more >
How to Run Multiple Instances of a Windows Program - Hongkiat
To open another window of a program, simply launch it again. An easier way to do this is to press and hold the...
Read more >
Windows 11 opening multiple instances of same application
How do I force Win 11 to open only 1 instance of an app when I select it's icon from the toolbar or...
Read more >
Is it possible to open multiple instances of the application at ...
It is not possible to open "multiple instances" of Connexion Client 3.x / Running multiple Connexion windows at the same time.
Read more >
How to Run Multiple Instances of a Windows Program
How to Run Multiple Instances of a Windows Program · 1. Just Relaunch the Program · 2. Launch Using Run Box in Windows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found