Skip to content

Commit

Permalink
[PB-556] fix: workaround open external url in linux (internxt#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanVicens committed Jul 12, 2023
1 parent 3bfd1b4 commit fe034fb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/platform/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { ipcMain, shell } from 'electron';
import { exec } from 'child_process';

ipcMain.handle('get-platform', () => {
return process.platform;
});

ipcMain.handle('open-url', (_, url: string) => {

if (process.platform === 'linux') {
// shell.openExternal is not working as intended on the current verions of electron
// this is only a workaround to fix it
return new Promise<void>((resolve, reject) => {
exec(`xdg-open ${url} &`, (error) => {
if (error) reject(error);

resolve();
});
});

}


return shell.openExternal(url);
});

0 comments on commit fe034fb

Please sign in to comment.