Workaround Linux Wayland screenshare bug
This commit is contained in:
parent
944a70abe7
commit
d7da7fdca0
3 changed files with 29 additions and 8 deletions
17
app/main.ts
17
app/main.ts
|
@ -2630,13 +2630,16 @@ ipc.handle('show-save-dialog', async (_event, { defaultPath }) => {
|
||||||
return { canceled: false, filePath: finalFilePath };
|
return { canceled: false, filePath: finalFilePath };
|
||||||
});
|
});
|
||||||
|
|
||||||
ipc.handle('getScreenCaptureSources', async () => {
|
ipc.handle(
|
||||||
return desktopCapturer.getSources({
|
'getScreenCaptureSources',
|
||||||
fetchWindowIcons: true,
|
async (_event, types: Array<'screen' | 'window'> = ['screen', 'window']) => {
|
||||||
thumbnailSize: { height: 102, width: 184 },
|
return desktopCapturer.getSources({
|
||||||
types: ['window', 'screen'],
|
fetchWindowIcons: true,
|
||||||
});
|
thumbnailSize: { height: 102, width: 184 },
|
||||||
});
|
types,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
ipc.handle('executeMenuRole', async ({ sender }, untypedRole) => {
|
ipc.handle('executeMenuRole', async ({ sender }, untypedRole) => {
|
||||||
const role = untypedRole as MenuItemConstructorOptions['role'];
|
const role = untypedRole as MenuItemConstructorOptions['role'];
|
||||||
|
|
|
@ -95,6 +95,7 @@ import {
|
||||||
import { callingMessageToProto } from '../util/callingMessageToProto';
|
import { callingMessageToProto } from '../util/callingMessageToProto';
|
||||||
import { getSendOptions } from '../util/getSendOptions';
|
import { getSendOptions } from '../util/getSendOptions';
|
||||||
import { requestMicrophonePermissions } from '../util/requestMicrophonePermissions';
|
import { requestMicrophonePermissions } from '../util/requestMicrophonePermissions';
|
||||||
|
import OS from '../util/os/osMain';
|
||||||
import { SignalService as Proto } from '../protobuf';
|
import { SignalService as Proto } from '../protobuf';
|
||||||
import dataInterface from '../sql/Client';
|
import dataInterface from '../sql/Client';
|
||||||
import {
|
import {
|
||||||
|
@ -1329,8 +1330,20 @@ export class CallingClass {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPresentingSources(): Promise<Array<PresentableSource>> {
|
async getPresentingSources(): Promise<Array<PresentableSource>> {
|
||||||
|
// There's a Linux Wayland Electron bug where requesting desktopCapturer.
|
||||||
|
// getSources() with types as ['screen', 'window'] (the default) pops 2
|
||||||
|
// OS permissions dialogs in an unusable state (Dialog 1 for Share Window
|
||||||
|
// is the foreground and ignores input; Dialog 2 for Share Screen is background
|
||||||
|
// and requires input. As a workaround, request both sources sequentially.
|
||||||
|
// https://github.com/signalapp/Signal-Desktop/issues/5350#issuecomment-1688614149
|
||||||
const sources: ReadonlyArray<DesktopCapturerSource> =
|
const sources: ReadonlyArray<DesktopCapturerSource> =
|
||||||
await ipcRenderer.invoke('getScreenCaptureSources');
|
OS.isLinux() && OS.isWaylandEnabled()
|
||||||
|
? (
|
||||||
|
await ipcRenderer.invoke('getScreenCaptureSources', ['screen'])
|
||||||
|
).concat(
|
||||||
|
await ipcRenderer.invoke('getScreenCaptureSources', ['window'])
|
||||||
|
)
|
||||||
|
: await ipcRenderer.invoke('getScreenCaptureSources');
|
||||||
|
|
||||||
const presentableSources: Array<PresentableSource> = [];
|
const presentableSources: Array<PresentableSource> = [];
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,14 @@ function getLinuxName(): string | undefined {
|
||||||
return match[1];
|
return match[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isWaylandEnabled(): boolean {
|
||||||
|
return Boolean(process.env.WAYLAND_DISPLAY);
|
||||||
|
}
|
||||||
|
|
||||||
const OS = {
|
const OS = {
|
||||||
...getOSFunctions(os.release()),
|
...getOSFunctions(os.release()),
|
||||||
getLinuxName,
|
getLinuxName,
|
||||||
|
isWaylandEnabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default OS;
|
export default OS;
|
||||||
|
|
Loading…
Reference in a new issue