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,6 +21,7 @@ export class WindowMain {
init(): Promise<any> {
return new Promise((resolve, reject) => {
try {
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) {
@ -35,6 +36,7 @@ export class WindowMain {
app.quit();
return;
}
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.