Skip to content

Commit 7287f4b

Browse files
fix: opening external links in default browser (#1212)
1 parent b5c37dc commit 7287f4b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.changeset/lovely-bikes-brush.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@spotlightjs/spotlight": patch
3+
---
4+
5+
open external links in default browser

packages/spotlight/src/electron/main/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@ const createWindow = () => {
166166
win = null;
167167
});
168168

169+
// Open external links in the default browser
170+
win.webContents.setWindowOpenHandler(details => {
171+
shell.openExternal(details.url).catch(error => {
172+
Sentry.captureException(error);
173+
});
174+
return { action: "deny" };
175+
});
176+
169177
win.webContents.on("did-finish-load", () => {
170178
app.setBadgeCount(0);
171179
/**

0 commit comments

Comments
 (0)