Skip to content

Commit

Permalink
fix windows second instance bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayuki0x committed Feb 9, 2021
1 parent 8c7f9f9 commit d3b952a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ if (!singleLock) {
app.quit();
} else {
app.on("second-instance", (_event, argv) => {
log.info("Reached second-instance.");
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
console.log("Main window exists.");
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.show();
mainWindow.focus();
} else {
console.log("Main window does not exist.");
}

for (const arg of argv) {
console.log(arg);
if (arg.includes("vex://")) {
mainWindow?.webContents.send("open-url", { url: arg });
}
Expand Down

0 comments on commit d3b952a

Please sign in to comment.