mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-06 20:10:12 +02:00
fix(linux): remove unnecessary desktopCapturer call from display media handler
The setDisplayMediaRequestHandler was calling desktopCapturer.getSources()
to provide a video source that the renderer never uses (it requests
video: false and only consumes audio tracks). On Wayland, this created a
new xdg-desktop-portal ScreenCast session on every launch, showing an
unavoidable screen share dialog because Electron does not persist
PipeWire restore tokens across desktopCapturer sessions.
Simplified the handler to return only { audio: 'loopback' }, which
captures system audio via PipeWire/PulseAudio monitor source without
any portal interaction.
This commit is contained in:
+1
-14
@@ -5,7 +5,6 @@ import {
|
|||||||
app,
|
app,
|
||||||
BrowserWindow,
|
BrowserWindow,
|
||||||
BrowserWindowConstructorOptions,
|
BrowserWindowConstructorOptions,
|
||||||
desktopCapturer,
|
|
||||||
globalShortcut,
|
globalShortcut,
|
||||||
ipcMain,
|
ipcMain,
|
||||||
Menu,
|
Menu,
|
||||||
@@ -734,19 +733,7 @@ async function createWindow(first = true): Promise<void> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.webContents.session.setDisplayMediaRequestHandler((_request, callback) => {
|
mainWindow.webContents.session.setDisplayMediaRequestHandler((_request, callback) => {
|
||||||
desktopCapturer
|
callback({ audio: 'loopback' });
|
||||||
.getSources({ types: ['screen'] })
|
|
||||||
.then((sources) => {
|
|
||||||
if (sources.length > 0) {
|
|
||||||
callback({ audio: 'loopback', video: sources[0] });
|
|
||||||
} else {
|
|
||||||
callback({});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
log.warn('desktopCapturer.getSources failed', err);
|
|
||||||
callback({});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!disableAutoUpdates() && store.get('disable_auto_updates') !== true) {
|
if (!disableAutoUpdates() && store.get('disable_auto_updates') !== true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user