Skip to content

Commit 64438e7

Browse files
committed
Fix custom protocol handling for Windows
1 parent 5ddf222 commit 64438e7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/electron/index.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,27 @@ function createMainWindow() {
7575
if (!singleInstance) {
7676
app.quit()
7777
} else {
78-
app.on('second-instance', () => {
78+
app.on('second-instance', (_event, argv) => {
7979
if (mainWindow) {
8080
if (!mainWindow.isVisible()) mainWindow.show()
8181
mainWindow.focus()
8282
}
83+
84+
if (!MAC) {
85+
let urlWithBoostNoteProtocol
86+
for (const arg of argv) {
87+
if (/^boostnote:\/\//.test(arg)) {
88+
urlWithBoostNoteProtocol = arg
89+
break
90+
}
91+
}
92+
if (urlWithBoostNoteProtocol != null && mainWindow != null) {
93+
mainWindow.webContents.send(
94+
'open-boostnote-url',
95+
urlWithBoostNoteProtocol
96+
)
97+
}
98+
}
8399
})
84100
}
85101

0 commit comments

Comments
 (0)