Skip to content

Commit 515d2fa

Browse files
committed
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.
1 parent 7d083a6 commit 515d2fa

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/main/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ function sendFileToRenderer(filePath: string) {
172172
const sendFile = () => {
173173
const targetWin = getAvailableWindow();
174174
if (targetWin) {
175+
if (targetWin.isMinimized()) targetWin.restore();
176+
if (!targetWin.isVisible()) targetWin.show();
177+
targetWin.focus();
175178
targetWin.webContents.send("open-file-at-launch", {
176179
filePath: result.filePath,
177180
content: result.content,

0 commit comments

Comments
 (0)