Ensure only one app instance (#1742)

* force only one app instance

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* fix

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen committed 2020-12-15 08:46:55 +02:00
1 parent 9494933e4a
commit 0c85918642
1 file changed
+10
+10
View File
@@ -45,6 +45,16 @@ 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", () => {
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();