Allow multi-instance in development
This commit is contained in:
parent
0c9cca08ba
commit
c1fa33327d
1 changed files with 16 additions and 14 deletions
30
main.js
30
main.js
|
@ -12,23 +12,25 @@ const shell = electron.shell;
|
|||
|
||||
app.setAppUserModelId('org.whispersystems.signal-desktop')
|
||||
|
||||
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
|
||||
// Someone tried to run a second instance, we should focus our window
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (shouldQuit) {
|
||||
app.quit();
|
||||
return;
|
||||
}
|
||||
|
||||
const package_json = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf-8'))
|
||||
const environment = package_json.environment || process.env.NODE_ENV || 'development';
|
||||
|
||||
if (environment === 'production') {
|
||||
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
|
||||
// Someone tried to run a second instance, we should focus our window
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (shouldQuit) {
|
||||
app.quit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Set environment vars to configure node-config before requiring it
|
||||
process.env.NODE_ENV = environment;
|
||||
process.env.NODE_CONFIG_DIR = path.join(__dirname, 'config');
|
||||
|
|
Loading…
Add table
Reference in a new issue