aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-04-29 13:38:19 +0200
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-04-29 07:57:25 -0500
commitf6d086bc3da5312c7eeb9fa6834312ede795d1dc (patch)
tree8553f94693750b39d28d648cc0f2e9ffcb954c8f /src/index.ts
parentUpdate submodules, browserslist data updates and linter fixes [skip ci] (diff)
downloadferdium-app-f6d086bc3da5312c7eeb9fa6834312ede795d1dc.tar.gz
ferdium-app-f6d086bc3da5312c7eeb9fa6834312ede795d1dc.tar.zst
ferdium-app-f6d086bc3da5312c7eeb9fa6834312ede795d1dc.zip
fix: desktopCapturer in electron 17+ (fixes #59)
Since electron 17, desktopCapturer is only available in the main process: https://www.electronjs.org/blog/electron-17-0#desktopcapturergetsources-in-the-renderer This patch adds a new IPC message from the service renderer to the main process so it can still invoke desktopCapturer.getSources Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts
index ef9d5bd72..59a90a3cb 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -7,6 +7,7 @@ import {
7 ipcMain, 7 ipcMain,
8 session, 8 session,
9 dialog, 9 dialog,
10 desktopCapturer,
10} from 'electron'; 11} from 'electron';
11 12
12import { emptyDirSync, ensureFileSync } from 'fs-extra'; 13import { emptyDirSync, ensureFileSync } from 'fs-extra';
@@ -632,6 +633,11 @@ ipcMain.on('set-spellchecker-locales', (_e, { locale, serviceId }) => {
632 serviceSession.setSpellCheckerLanguages(locales); 633 serviceSession.setSpellCheckerLanguages(locales);
633}); 634});
634 635
636
637ipcMain.handle('get-desktop-capturer-sources', () => desktopCapturer.getSources({
638 types: ['screen', 'window'],
639}));
640
635ipcMain.on('window.toolbar-double-clicked', () => { 641ipcMain.on('window.toolbar-double-clicked', () => {
636 mainWindow?.isMaximized() ? mainWindow.unmaximize() : mainWindow?.maximize(); 642 mainWindow?.isMaximized() ? mainWindow.unmaximize() : mainWindow?.maximize();
637}); 643});