Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix: prevent stuck recording when push-to-talk key-up is missed
Alcahesta8259cd6ea25
diff --git a/main.js b/main.jsindex 81eef3fb0..f9d485443 100644--- a/main.js+++ b/main.js@@ -973,11 +973,15 @@ async function startApp() {});windowsKeyManager.on("key-up", () => {- if (!isLiveWindow(windowManager.mainWindow)) return;-- const activationMode = windowManager.getActivationMode();- if (activationMode === "push") {+ // Always process key-up to avoid stuck recording state, even if the+ // window is temporarily unavailable (minimized, busy with transcription).+ if (windowManager.winPushState?.active) {windowManager.handleWindowsPushKeyUp();+ } else if (isLiveWindow(windowManager.mainWindow)) {+ const activationMode = windowManager.getActivationMode();+ if (activationMode === "push") {+ windowManager.handleWindowsPushKeyUp();+ }}});diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex 0c6345ef9..81f7098d3 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -374,14 +374,23 @@ class WindowManager {}const MIN_HOLD_DURATION_MS = 150;+ const MAX_PUSH_DURATION_MS = 120_000;const downTime = Date.now();this.showDictationPanel();+ const safetyTimer = setTimeout(() => {+ if (this.winPushState?.active) {+ debugLogger.warn("[WindowManager] Push-to-talk safety timeout, force stopping");+ this.handleWindowsPushKeyUp();+ }+ }, MAX_PUSH_DURATION_MS);+this.winPushState = {active: true,downTime,isRecording: false,+ safetyTimer,};setTimeout(() => {@@ -402,6 +411,9 @@ class WindowManager {}const wasRecording = this.winPushState.isRecording;+ if (this.winPushState.safetyTimer) {+ clearTimeout(this.winPushState.safetyTimer);+ }this.winPushState = null;if (wasRecording) {@@ -412,6 +424,9 @@ class WindowManager {}resetWindowsPushState() {+ if (this.winPushState?.safetyTimer) {+ clearTimeout(this.winPushState.safetyTimer);+ }this.winPushState = null;}diff --git a/src/helpers/windowsKeyManager.js b/src/helpers/windowsKeyManager.jsindex 4528cab3f..ae6ebd4a5 100644--- a/src/helpers/windowsKeyManager.js+++ b/src/helpers/windowsKeyManager.js@@ -65,28 +65,29 @@ class WindowsKeyManager extends EventEmitter {return;}+ let lineBuffer = "";this.process.stdout.setEncoding("utf8");this.process.stdout.on("data", (chunk) => {- chunk- .split(/\r?\n/)- .map((line) => line.trim())- .filter(Boolean)- .forEach((line) => {- if (line === "READY") {- debugLogger.debug("[WindowsKeyManager] Listener ready", { key });- this.isReady = true;- this.emit("ready");- } else if (line === "KEY_DOWN") {- debugLogger.debug("[WindowsKeyManager] KEY_DOWN detected", { key });- this.emit("key-down", key);- } else if (line === "KEY_UP") {- debugLogger.debug("[WindowsKeyManager] KEY_UP detected", { key });- this.emit("key-up", key);- } else {- // Log unknown output at debug level (could be native binary's stderr info)- debugLogger.debug("[WindowsKeyManager] Unknown output", { line });- }- });+ lineBuffer += chunk;+ const lines = lineBuffer.split(/\r?\n/);+ lineBuffer = lines.pop(); // keep incomplete trailing data for next chunk+ for (const raw of lines) {+ const line = raw.trim();+ if (!line) continue;+ if (line === "READY") {+ debugLogger.debug("[WindowsKeyManager] Listener ready", { key });+ this.isReady = true;+ this.emit("ready");+ } else if (line === "KEY_DOWN") {+ debugLogger.debug("[WindowsKeyManager] KEY_DOWN detected", { key });+ this.emit("key-down", key);+ } else if (line === "KEY_UP") {+ debugLogger.debug("[WindowsKeyManager] KEY_UP detected", { key });+ this.emit("key-up", key);+ } else {+ debugLogger.debug("[WindowsKeyManager] Unknown output", { line });+ }+ }});this.process.stderr.setEncoding("utf8");