diff --git a/src/main/screenShare.ts b/src/main/screenShare.ts index f17bb7e..41ee02c 100644 --- a/src/main/screenShare.ts +++ b/src/main/screenShare.ts @@ -10,6 +10,9 @@ import { IpcEvents } from "shared/IpcEvents"; import { handle } from "./utils/ipcWrappers"; +const isWayland = + process.platform === "linux" && (process.env.XDG_SESSION_TYPE === "wayland" || !!process.env.WAYLAND_DISPLAY); + export function registerScreenShareHandler() { handle(IpcEvents.CAPTURER_GET_LARGE_THUMBNAIL, async (_, id: string) => { const sources = await desktopCapturer.getSources({ @@ -23,19 +26,22 @@ export function registerScreenShareHandler() { }); session.defaultSession.setDisplayMediaRequestHandler(async (request, callback) => { - const sources = await desktopCapturer.getSources({ - types: ["window", "screen"], - thumbnailSize: { - width: 176, - height: 99 - } - }).catch(() => null); - + const sources = await desktopCapturer + .getSources({ + types: ["window", "screen"], + thumbnailSize: isWayland + ? { + width: 1920, + height: 1080 + } + : { + width: 176, + height: 99 + } + }) + .catch(() => null); + if (sources === null) return callback({}); - - const isWayland = - process.platform === "linux" && - (process.env.XDG_SESSION_TYPE === "wayland" || !!process.env.WAYLAND_DISPLAY); const data = sources.map(({ id, name, thumbnail }) => ({ id, diff --git a/src/renderer/components/ScreenSharePicker.tsx b/src/renderer/components/ScreenSharePicker.tsx index dcb895d..fc0cd0c 100644 --- a/src/renderer/components/ScreenSharePicker.tsx +++ b/src/renderer/components/ScreenSharePicker.tsx @@ -116,19 +116,24 @@ function ScreenPicker({ screens, chooseScreen }: { screens: Source[]; chooseScre ); } -export function StreamSettings({ +function StreamSettings({ source, settings, - setSettings + setSettings, + skipPicker }: { source: Source; settings: StreamSettings; setSettings: Dispatch>; + skipPicker: boolean; }) { - const [thumb] = useAwaiter(() => VesktopNative.capturer.getLargeThumbnail(source.id), { - fallbackValue: source.url, - deps: [source.id] - }); + const [thumb] = useAwaiter( + () => (skipPicker ? Promise.resolve(source.url) : VesktopNative.capturer.getLargeThumbnail(source.id)), + { + fallbackValue: source.url, + deps: [source.id] + } + ); return (
@@ -269,6 +274,7 @@ function ModalComponent({ source={screens.find(s => s.id === selected)!} settings={settings} setSettings={setSettings} + skipPicker={skipPicker} /> )}