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