diff --git a/src/renderer/components/custom/control-panel/live-signal.tsx b/src/renderer/components/custom/control-panel/live-signal.tsx index 8436731b..c7b8fca4 100644 --- a/src/renderer/components/custom/control-panel/live-signal.tsx +++ b/src/renderer/components/custom/control-panel/live-signal.tsx @@ -31,16 +31,20 @@ export function LiveSignal() { const [stream, setStream] = useState(null); const [connected, setConnected] = useState(true); + // Socket up but no audio reaching it - another app took the microphone or speakers (#164). + const [audioLost, setAudioLost] = useState(false); useEffect(() => { if (!running) { setStream(null); setConnected(true); + setAudioLost(false); return; } const poll = () => { setStream(liveTranscriptionService.getMicStream()); setConnected(liveTranscriptionService.isConnected()); + setAudioLost(liveTranscriptionService.isCaptureStalled()); }; poll(); const id = window.setInterval(poll, POLL_MS); @@ -71,10 +75,15 @@ export function LiveSignal() { if (!running) return null; - const label = connected ? t.controlPanel.signal.listening : t.controlPanel.signal.reconnecting; - const hint = connected - ? t.controlPanel.signal.listeningHint - : t.controlPanel.signal.reconnectingHint; + const signal = t.controlPanel.signal; + // A dropped socket is reported first: it is what any audio fix would be waiting on. + const healthy = connected && !audioLost; + const label = !connected ? signal.reconnecting : audioLost ? signal.audioLost : signal.listening; + const hint = !connected + ? signal.reconnectingHint + : audioLost + ? signal.audioLostHint + : signal.listeningHint; return ( @@ -84,7 +93,7 @@ export function LiveSignal() { aria-label={`${label}. ${hint}`} className={cn( 'flex h-8 items-center gap-2 rounded-lg border px-2.5 text-xs font-medium', - connected + healthy ? 'border-border text-muted-foreground' : 'border-destructive/40 bg-destructive/10 text-destructive' )} @@ -93,16 +102,16 @@ export function LiveSignal() { aria-hidden="true" className={cn( 'h-2 w-2 shrink-0 rounded-full', - connected ? 'bg-emerald-500' : 'animate-pulse bg-destructive' + healthy ? 'bg-emerald-500' : 'animate-pulse bg-destructive' )} /> {/* The bar is full at the 840px minimum width, so "Listening" - the state nobody needs to read - is dropped there and the dot and meter carry it, with the tooltip and the aria-label holding the words. "Reconnecting" always shows: it is the one to notice. */} - + {label} - {connected && ( + {healthy && (