no single instance on mas or snap

This commit is contained in:
Kyle Spearrin 2018-02-26 22:03:02 -05:00
parent bb040a87d8
commit d5650f1f8d
1 changed files with 14 additions and 12 deletions

View File

@ -3,7 +3,7 @@ import * as path from 'path';
import * as url from 'url';
import { Main } from '../main';
import { isDev } from '../scripts/utils';
import { isDev, isMacAppStore, isSnapStore } from '../scripts/utils';
const WindowEventHandlingDelay = 100;
const Keys = {
@ -21,19 +21,21 @@ export class WindowMain {
init(): Promise<any> {
return new Promise((resolve, reject) => {
try {
const shouldQuit = app.makeSingleInstance((args, dir) => {
// Someone tried to run a second instance, we should focus our window.
if (this.win != null) {
if (this.win.isMinimized()) {
this.win.restore();
if (!isMacAppStore() && !isSnapStore()) {
const shouldQuit = app.makeSingleInstance((args, dir) => {
// Someone tried to run a second instance, we should focus our window.
if (this.win != null) {
if (this.win.isMinimized()) {
this.win.restore();
}
this.win.focus();
}
this.win.focus();
}
});
});
if (shouldQuit) {
app.quit();
return;
if (shouldQuit) {
app.quit();
return;
}
}
// This method will be called when Electron has finished