Ensure app is single-instance
Remove some comments. // FREEBIE
This commit is contained in:
parent
f4df38735c
commit
b176bd756c
1 changed files with 14 additions and 3 deletions
17
main.js
17
main.js
|
@ -1,9 +1,6 @@
|
|||
const electron = require('electron')
|
||||
// Module to control application life.
|
||||
const app = electron.app
|
||||
// Module to create native browser window.
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
|
||||
const path = require('path')
|
||||
const url = require('url')
|
||||
const autoUpdater = require('electron-updater').autoUpdater
|
||||
|
@ -11,6 +8,20 @@ const autoUpdaterInterval = 60 * 60 * 1000;
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue