From 515d2fabeaaee2aeb62eb68ae7b6cad65c1aa076 Mon Sep 17 00:00:00 2001 From: dongyccc Date: Mon, 4 May 2026 02:29:29 +0800 Subject: [PATCH] fix: bring window to front when opening file via Finder on macOS The `open-file` event handler sent file data to the renderer via IPC but never called focus()/show()/restore() on the window. This caused double-clicking a .md file in Finder to load the file content silently without bringing the app window to the foreground. Fixed by adding window activation calls in sendFileToRenderer's sendFile closure, aligning with the existing second-instance handler behavior. --- src/main/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/index.ts b/src/main/index.ts index ab443e2..a5a447b 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -172,6 +172,9 @@ function sendFileToRenderer(filePath: string) { const sendFile = () => { const targetWin = getAvailableWindow(); if (targetWin) { + if (targetWin.isMinimized()) targetWin.restore(); + if (!targetWin.isVisible()) targetWin.show(); + targetWin.focus(); targetWin.webContents.send("open-file-at-launch", { filePath: result.filePath, content: result.content,