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 authored and GitHub committed 2020-12-13 19:11:37 +02:00
1 parent da6c114b68
commit 2a7fc87134
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");
}
const instanceLock = app.requestSingleInstanceLock();
if (!instanceLock) {
app.exit();
}
app.on("second-instance", () => {
windowManager?.ensureMainWindow();
});
app.on("ready", async () => {
logger.info(`🚀 Starting Lens from "${workingDir}"`);
await shellSync();