diff --git a/popup.js b/popup.js index 42ce1e8..47a271e 100644 --- a/popup.js +++ b/popup.js @@ -287,7 +287,18 @@ function initDictation() { function stopRecording() { if (!isRecording) return; isRecording = false; - chrome.runtime.sendMessage({ type: 'STOP_RECORDING_FROM_POPUP' }); + + chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { + const activeTab = tabs[0]; + if (activeTab && activeTab.id) { + chrome.tabs.sendMessage(activeTab.id, { type: 'STOP_RECORDING_FROM_POPUP' }, () => { + if (chrome.runtime.lastError) { + console.warn('Could not send STOP message to tab:', chrome.runtime.lastError.message); + } + }); + } + }); + micBtn.style.background = 'linear-gradient(135deg, var(--accent), #9b5de5)'; micBtn.innerHTML = '🎤';