Skip to content

Commit 7a843ca

Browse files
committed
force external links to always open in the terminal
1 parent 2cea955 commit 7a843ca

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/main/ipcMain.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// eslint-disable-line no-console
2-
import { BrowserWindow, ipcMain, Notification, dialog } from 'electron';
2+
import { BrowserWindow, ipcMain, Notification, dialog, shell } from 'electron';
33
import initWebSocket from './webSocket';
44
import { handleClipBoardActivity } from './utils';
55

@@ -131,6 +131,11 @@ export const initIpcMain = app => {
131131
const clip_board_value = handleClipBoardActivity('paste');
132132
window.webContents.send('pasted-from-clipboard', clip_board_value);
133133
});
134+
135+
ipcMain.on('open-external-link', (_, link) => {
136+
shell.openExternal(link);
137+
});
138+
134139
// eslint-disable-next-line no-console
135140
console.log('all ipc inited and waiting for connection');
136141
};

src/main/window.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BrowserWindow } from 'electron';
1+
import { BrowserWindow, shell } from 'electron';
22
import { getWindowPosition } from './config';
33
import { updateWindowInfo, openDevTools } from './ipcMain'; // eslint-disable-line no-unused-vars
44
import { require, isDev, getAssetPath, resolveHtmlPath } from './utils';
@@ -66,10 +66,10 @@ export const createWindow = async () => {
6666
window.loadURL(resolveHtmlPath('index.html'));
6767

6868
// Open urls in the user's browser
69-
// window.webContents.setWindowOpenHandler((edata) => {
70-
// shell.openExternal(edata.url);
71-
// return { action: 'deny' };
72-
// });
69+
window.webContents.setWindowOpenHandler(({ url }) => {
70+
shell.openExternal(url);
71+
return { action: 'deny' };
72+
});
7373

7474
return window;
7575
};

0 commit comments

Comments
 (0)