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(macos): cancel bare-Fn push-to-talk when Fn is used as a navigation modifier (#826)
Gabriel Steinadb2bb31e77b
diff --git a/main.js b/main.jsindex b6d43ebfa..92d739eee 100644--- a/main.js+++ b/main.js@@ -1144,6 +1144,27 @@ async function startApp() {windowManager.handleMacPushModifierUp("fn");});+ // Another key was pressed while Fn was held — user is using Fn as a+ // navigation modifier (Fn+Arrow → Home, Fn+Backspace → Forward Delete, etc.).+ // Cancel any bare-Fn push-to-talk in progress instead of transcribing noise.+ // Only the bare-Fn path uses globeKeyDownTime/globeKeyIsRecording, so compound+ // Fn-hotkey push-to-talk and tap mode are untouched.+ globeKeyManager.on("globe-interrupted", () => {+ if (globeKeyDownTime === 0 && !globeKeyIsRecording) {+ return;+ }+ const wasRecording = globeKeyIsRecording;+ debugLogger?.debug("[Globe] Fn+key interrupted push-to-talk", { wasRecording });+ globeKeyDownTime = 0;+ globeKeyIsRecording = false;+ globeLastStopTime = Date.now();+ if (wasRecording) {+ windowManager.sendCancelDictation();+ } else {+ windowManager.hideDictationPanel();+ }+ });+globeKeyManager.on("modifier-up", (modifier) => {if (windowManager?.handleMacPushModifierUp) {windowManager.handleMacPushModifierUp(modifier);diff --git a/resources/macos-globe-listener.swift b/resources/macos-globe-listener.swiftindex 7b32a6f26..c2992183d 100644--- a/resources/macos-globe-listener.swift+++ b/resources/macos-globe-listener.swift@@ -2,6 +2,7 @@ import Cocoaimport Darwinvar fnIsDown = false+var fnInterrupted = falsevar lastModifierFlags: NSEvent.ModifierFlags = []let suppressedMouseButtons = Set(@@ -97,9 +98,11 @@ guard let monitor = NSEvent.addGlobalMonitorForEvents(matching: .flagsChanged, hif containsFn && !fnIsDown {fnIsDown = true+ fnInterrupted = falseemit("FN_DOWN")} else if !containsFn && fnIsDown {fnIsDown = false+ fnInterrupted = falseemit("FN_UP")}@@ -126,10 +129,22 @@ guard let monitor = NSEvent.addGlobalMonitorForEvents(matching: .flagsChanged, hexit(1)}+// Detect another key pressed while Fn is held (e.g. Fn+Arrow → Home) so the+// JS side can cancel an in-progress bare-Fn push-to-talk instead of transcribing noise.+let keyMonitor = NSEvent.addGlobalMonitorForEvents(matching: .keyDown) { _ in+ if fnIsDown && !fnInterrupted {+ fnInterrupted = true+ emit("FN_INTERRUPTED")+ }+}+let signalSource = DispatchSource.makeSignalSource(signal: SIGTERM, queue: .main)signal(SIGTERM, SIG_IGN)signalSource.setEventHandler {NSEvent.removeMonitor(monitor)+ if let keyMonitor {+ NSEvent.removeMonitor(keyMonitor)+ }if let mouseEventTap {CGEvent.tapEnable(tap: mouseEventTap, enable: false)}diff --git a/src/helpers/globeKeyManager.js b/src/helpers/globeKeyManager.jsindex 871e32cc2..013993e4f 100644--- a/src/helpers/globeKeyManager.js+++ b/src/helpers/globeKeyManager.js@@ -123,6 +123,8 @@ class GlobeKeyManager extends EventEmitter {this.emit("globe-down");} else if (line === "FN_UP") {this.emit("globe-up");+ } else if (line === "FN_INTERRUPTED") {+ this.emit("globe-interrupted");} else if (line.startsWith("RIGHT_MOD_DOWN:")) {const modifier = line.replace("RIGHT_MOD_DOWN:", "").trim();if (modifier) {diff --git a/src/helpers/windowManager.js b/src/helpers/windowManager.jsindex 7f01ce897..a78b3bf2e 100644--- a/src/helpers/windowManager.js+++ b/src/helpers/windowManager.js@@ -494,6 +494,17 @@ class WindowManager {}}+ sendCancelDictation() {+ if (this.hotkeyManager.isInListeningMode()) {+ return;+ }+ if (this.mainWindow && !this.mainWindow.isDestroyed()) {+ this.mainWindow.webContents.send("cancel-hotkey-pressed");+ this._isDictatingToggle = false;+ this.meetingDetectionEngine?.setUserRecording(false);+ }+ }+getActivationMode() {return this._cachedActivationMode;}