diff --git a/src/components/launch/SourceSelector.tsx b/src/components/launch/SourceSelector.tsx index aad1bdec..0de404bb 100644 --- a/src/components/launch/SourceSelector.tsx +++ b/src/components/launch/SourceSelector.tsx @@ -52,6 +52,7 @@ function parseSourceMetadata(source: ProcessedDesktopSource) { export function SourceSelector() { const [sources, setSources] = useState([]); const [selectedSource, setSelectedSource] = useState(null); + const [activeTab, setActiveTab] = useState<'screens' | 'windows'>('screens'); const [loading, setLoading] = useState(true); useEffect(() => { @@ -92,6 +93,21 @@ export function SourceSelector() { const screenSources = sources.filter(s => s.id.startsWith('screen:')); const windowSources = sources.filter(s => s.id.startsWith('window:')); + useEffect(() => { + if (loading) { + return; + } + + if (screenSources.length === 0 && windowSources.length > 0) { + setActiveTab('windows'); + return; + } + + if (windowSources.length === 0 && screenSources.length > 0) { + setActiveTab('screens'); + } + }, [loading, screenSources.length, windowSources.length]); + const handleSourceSelect = (source: DesktopSource) => setSelectedSource(source); const handleShare = async () => { if (selectedSource) await window.electronAPI.selectSource(selectedSource); @@ -111,14 +127,21 @@ export function SourceSelector() { return (
- + setActiveTab(value as 'screens' | 'windows')}> - Screens - Windows + + Screens ({screenSources.length}) + + + Windows ({windowSources.length}) +
+ {screenSources.length === 0 && ( +
No screens available
+ )} {screenSources.map(source => (

Only visible (non-minimized) windows can be recorded.

+ {windowSources.length === 0 && ( +
No windows available
+ )} {windowSources.map(source => (