Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

fix: make Paste Last Transcription usable and reliable (runtime fixes)

Tom5fc1ad78260b
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index c5723ed2..6021711b 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -2528,6 +2528,13 @@ struct ContentView: View {
}
Task { @MainActor in
+ // The hotkey fires on key-down while its own modifier keys (e.g. ⌘⌃) are still
+ // physically held. Synthesizing text in that state makes the target app treat the
+ // characters as keyboard shortcuts and drop them, so wait for the modifiers to be
+ // released before inserting. (Dictation never hits this because by the time it types,
+ // no keys are held.)
+ await Self.waitForHotkeyModifiersReleased(timeout: 0.6)
+
let typingTarget = self.resolveTypingTargetPID()
guard typingTarget.pid != nil else {
DebugLogger.shared.info("Actions: Paste skipped - no external target field available", source: "ContentView")
@@ -2541,6 +2548,20 @@ struct ContentView: View {
}
}
+ /// Polls until the keyboard modifier keys are released (or the timeout elapses). Used before
+ /// synthesizing a paste so the inserted characters aren't swallowed as modifier+key shortcuts.
+ private static func waitForHotkeyModifiersReleased(timeout: TimeInterval) async {
+ let relevant: CGEventFlags = [.maskCommand, .maskControl, .maskAlternate, .maskShift, .maskSecondaryFn]
+ let start = Date()
+ while Date().timeIntervalSince(start) < timeout {
+ let flags = CGEventSource.flagsState(.combinedSessionState)
+ if flags.isDisjoint(with: relevant) {
+ return
+ }
+ try? await Task.sleep(nanoseconds: 15_000_000) // 15ms
+ }
+ }
+
private func undoLastAIProcessingFromHistory() {
guard let last = TranscriptionHistoryStore.shared.entries.first else {
DebugLogger.shared.info("Actions: Undo AI requested but history is empty", source: "ContentView")
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index b65b02ad..aab5624d 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -2285,7 +2285,7 @@ struct SettingsView: View {
Color.clear
.frame(width: 20)
- if isRecording && enabledValue {
+ if isRecording {
self.shortcutCapturePill()
} else {
self.shortcutDisplayPill(shortcut?.displayString ?? "Not set")