|
|
@@ -81,6 +81,21 @@ function createWindow() {
|
|
|
require('./bg/events').init(app, contents);
|
|
|
}
|
|
|
|
|
|
+const should_quit = app.makeSingleInstance((commandLine, workingDirectory) => {
|
|
|
+ // Someone tried to run a second instance, we should focus our window.
|
|
|
+ if (mainWindow) {
|
|
|
+ if (mainWindow.isMinimized()) {
|
|
|
+ mainWindow.restore();
|
|
|
+ }
|
|
|
+ mainWindow.show();
|
|
|
+ // mainWindow.focus();
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+if (should_quit) {
|
|
|
+ app.quit();
|
|
|
+}
|
|
|
+
|
|
|
// This method will be called when Electron has finished
|
|
|
// initialization and is ready to create browser windows.
|
|
|
// Some APIs can only be used after this event occurs.
|