diff --git a/main.js b/main.js index 7f7c461..a04b8e8 100644 --- a/main.js +++ b/main.js @@ -42,6 +42,17 @@ const obsidian = require("obsidian"), { nativeImage, BrowserWindow } = require("electron").remote, { getCurrentWindow, globalShortcut } = require("electron").remote; +app.on("second-instance", (e) => { + const win2 = BrowserWindow.getAllWindows()[0]; + // prevents "flashing" (quick open->close Obsidian start window) + win2.setOpacity(0.0); + win2.once("ready-to-show", () => { + win2.close(); + }); + getCurrentWindow().show(); + getCurrentWindow().focus(); +}); + const vaultWindows = new Set(), maximizedWindows = new Set(), getWindows = () => [...vaultWindows],