fix: #14 taskbar icon doesn't open minimized Obsidian

This commit is contained in:
Kh4f 2025-01-11 04:38:21 +03:00
parent cc0baa3226
commit 7900f7fc7d

11
main.js
View File

@ -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],