mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
force only one app instance
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
d143b234b7
commit
54bc54f1a1
@ -26,6 +26,7 @@ import { InstalledExtension, extensionDiscovery } from "../extensions/extension-
|
|||||||
import type { LensExtensionId } from "../extensions/lens-extension";
|
import type { LensExtensionId } from "../extensions/lens-extension";
|
||||||
import { installDeveloperTools } from "./developer-tools";
|
import { installDeveloperTools } from "./developer-tools";
|
||||||
import { filesystemProvisionerStore } from "./extension-filesystem";
|
import { filesystemProvisionerStore } from "./extension-filesystem";
|
||||||
|
import { exitApp } from "./exit-app";
|
||||||
|
|
||||||
const workingDir = path.join(app.getPath("appData"), appName);
|
const workingDir = path.join(app.getPath("appData"), appName);
|
||||||
let proxyPort: number;
|
let proxyPort: number;
|
||||||
@ -45,6 +46,18 @@ if (app.commandLine.getSwitchValue("proxy-server") !== "") {
|
|||||||
process.env.HTTPS_PROXY = app.commandLine.getSwitchValue("proxy-server");
|
process.env.HTTPS_PROXY = app.commandLine.getSwitchValue("proxy-server");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const instanceLock = app.requestSingleInstanceLock();
|
||||||
|
|
||||||
|
if (!instanceLock) {
|
||||||
|
app.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on("second-instance", () => {
|
||||||
|
if (windowManager) {
|
||||||
|
windowManager.ensureMainWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
app.on("ready", async () => {
|
app.on("ready", async () => {
|
||||||
logger.info(`🚀 Starting Lens from "${workingDir}"`);
|
logger.info(`🚀 Starting Lens from "${workingDir}"`);
|
||||||
await shellSync();
|
await shellSync();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user