From 7900f7fc7d97bf82147891d987038ae05fc2051f Mon Sep 17 00:00:00 2001 From: Kh4f Date: Sat, 11 Jan 2025 04:38:21 +0300 Subject: [PATCH] fix: #14 taskbar icon doesn't open minimized Obsidian --- main.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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],