diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index 1416238a..00f0da6e 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -1634,6 +1634,7 @@ export function registerIpcHandlers( if (process.platform !== 'darwin' || !includeWindows) { const windowSources = electronSources .filter((source) => source.id.startsWith('window:')) + .filter((source) => hasUsableSourceThumbnail(source.thumbnail)) .filter((source) => { const normalizedName = normalizeDesktopSourceName(source.name) if (!normalizedName) { @@ -1657,7 +1658,7 @@ export function registerIpcHandlers( id: source.id, name: source.name, display_id: source.display_id, - thumbnail: hasUsableSourceThumbnail(source.thumbnail) ? source.thumbnail!.toDataURL() : null, + thumbnail: source.thumbnail ? source.thumbnail.toDataURL() : null, appIcon: source.appIcon ? source.appIcon.toDataURL() : null, })) @@ -1704,14 +1705,13 @@ export function registerIpcHandlers( id: source.id, name: source.name, display_id: source.display_id ?? electronWindowSource?.display_id ?? '', - thumbnail: hasUsableSourceThumbnail(electronWindowSource?.thumbnail) - ? electronWindowSource!.thumbnail.toDataURL() - : null, + thumbnail: electronWindowSource?.thumbnail ? electronWindowSource.thumbnail.toDataURL() : null, appIcon: source.appIcon ?? (electronWindowSource?.appIcon ? electronWindowSource.appIcon.toDataURL() : null), appName: source.appName, windowTitle: source.windowTitle, } }) + .filter((source) => Boolean(source.thumbnail)) return [...screenSources, ...mergedWindowSources] } catch (error) { @@ -1719,6 +1719,7 @@ export function registerIpcHandlers( const windowSources = electronSources .filter((source) => source.id.startsWith('window:')) + .filter((source) => hasUsableSourceThumbnail(source.thumbnail)) .filter((source) => { const normalizedName = normalizeDesktopSourceName(source.name) if (!normalizedName) { @@ -1742,7 +1743,7 @@ export function registerIpcHandlers( id: source.id, name: source.name, display_id: source.display_id, - thumbnail: hasUsableSourceThumbnail(source.thumbnail) ? source.thumbnail!.toDataURL() : null, + thumbnail: source.thumbnail ? source.thumbnail.toDataURL() : null, appIcon: source.appIcon ? source.appIcon.toDataURL() : null, })) diff --git a/src/components/launch/SourceSelector.tsx b/src/components/launch/SourceSelector.tsx index 9d7b4037..9b98e329 100644 --- a/src/components/launch/SourceSelector.tsx +++ b/src/components/launch/SourceSelector.tsx @@ -153,18 +153,11 @@ export function SourceSelector() { >
- {source.thumbnail ? ( - {source.name} - ) : ( -
-
-
{t('sourceSelector.screens')}
-
- )} + {source.name} {selectedSource?.id === source.id && (