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: exclude temporary paste writes from clipboard manager history (#773)
postoso6ed758f6718e
diff --git a/Fluid.xcodeproj/project.pbxproj b/Fluid.xcodeproj/project.pbxprojindex d475db0e..c94ebcef 100644--- a/Fluid.xcodeproj/project.pbxproj+++ b/Fluid.xcodeproj/project.pbxproj@@ -20,6 +20,7 @@A62300000000000000000002 /* AudioBufferConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A62300000000000000000001 /* AudioBufferConverterTests.swift */; };C0DE63600000000000000002 /* AudioEngineRetirementDrainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE63600000000000000001 /* AudioEngineRetirementDrainTests.swift */; };DA7100020000000000000002 /* DirectAudioReliabilityTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA7100010000000000000001 /* DirectAudioReliabilityTests.swift */; };+ 7CFA1D0B2F500000C0DEF001 /* TypingServiceTransientPasteboardTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CFA1D0B2F500000C0DEF002 /* TypingServiceTransientPasteboardTests.swift */; };7CDB0A2F2F3C4D5600FB7CAD /* dictation_fixture.wav in Resources */ = {isa = PBXBuildFile; fileRef = 7CDB0A2B2F3C4D5600FB7CAD /* dictation_fixture.wav */; };7CDB0A302F3C4D5600FB7CAD /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CDB0A2C2F3C4D5600FB7CAD /* XCTest.framework */; };7CE006BD2E80EBE600DDCCD6 /* AppUpdater in Frameworks */ = {isa = PBXBuildFile; productRef = 7CE006BC2E80EBE600DDCCD6 /* AppUpdater */; };@@ -60,6 +61,7 @@7C91B0022F42AA0100C0DEF0 /* HotkeyShortcutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HotkeyShortcutTests.swift; sourceTree = "<group>"; };7CDB0A202F3C4D5600FB7CAD /* FluidDictationIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FluidDictationIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };7CDB0A292F3C4D5600FB7CAD /* DictationE2ETests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DictationE2ETests.swift; sourceTree = "<group>"; };+ 7CFA1D0B2F500000C0DEF002 /* TypingServiceTransientPasteboardTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypingServiceTransientPasteboardTests.swift; sourceTree = "<group>"; };7CDB0A2A2F3C4D5600FB7CAD /* AudioFixtureLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioFixtureLoader.swift; sourceTree = "<group>"; };7CDB0A2B2F3C4D5600FB7CAD /* dictation_fixture.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = dictation_fixture.wav; sourceTree = "<group>"; };7CDB0A2C2F3C4D5600FB7CAD /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };@@ -135,6 +137,7 @@A62300000000000000000001 /* AudioBufferConverterTests.swift */,C0DE63600000000000000001 /* AudioEngineRetirementDrainTests.swift */,DA7100010000000000000001 /* DirectAudioReliabilityTests.swift */,+ 7CFA1D0B2F500000C0DEF002 /* TypingServiceTransientPasteboardTests.swift */,);path = FluidDictationIntegrationTests;sourceTree = "<group>";@@ -295,6 +298,7 @@A62300000000000000000002 /* AudioBufferConverterTests.swift in Sources */,C0DE63600000000000000002 /* AudioEngineRetirementDrainTests.swift in Sources */,DA7100020000000000000002 /* DirectAudioReliabilityTests.swift in Sources */,+ 7CFA1D0B2F500000C0DEF001 /* TypingServiceTransientPasteboardTests.swift in Sources */,);runOnlyForDeploymentPostprocessing = 0;};diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex 8c91c842..e77b56ab 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -5068,7 +5068,7 @@ extension SettingsStore {case .standard:return "Fastest path. Inserts text without changing the clipboard, with paste fallback if direct insertion is unavailable."case .reliablePaste:- return "Compatibility path. Uses a temporary clipboard paste, so clipboard history apps may briefly record dictated text."+ return "Compatibility path. Uses a temporary clipboard paste and restores your previous clipboard after insertion."}}}diff --git a/Sources/Fluid/Services/TypingService.swift b/Sources/Fluid/Services/TypingService.swiftindex c88f557a..6cacc699 100644--- a/Sources/Fluid/Services/TypingService.swift+++ b/Sources/Fluid/Services/TypingService.swift@@ -621,6 +621,18 @@ final class TypingService {_ = pasteboard.writeObjects(restoredItems)}+ /// Builds the pasteboard item for a temporary paste write, tagged with the nspasteboard.org+ /// Transient and AutoGenerated marker types so clipboard managers exclude it from history.+ /// `ConcealedType` is deliberately not used: it signals sensitive/password content, which+ /// would be misleading for a dictation transcript.+ static func makeTransientPasteboardItem(_ text: String) -> NSPasteboardItem {+ let item = NSPasteboardItem()+ item.setString(text, forType: .string)+ item.setData(Data(), forType: NSPasteboard.PasteboardType("org.nspasteboard.TransientType"))+ item.setData(Data(), forType: NSPasteboard.PasteboardType("org.nspasteboard.AutoGeneratedType"))+ return item+ }+private func withTemporaryPasteboardString(_ text: String,restoreDelayMicros: useconds_t,@@ -638,7 +650,7 @@ final class TypingService {let snapshot = self.capturePasteboardSnapshot(pasteboard)pasteboard.clearContents()- guard pasteboard.setString(text, forType: .string) else {+ guard pasteboard.writeObjects([Self.makeTransientPasteboardItem(text)]) else {self.log("[TypingService] ERROR: Failed to set temporary clipboard string")self.restorePasteboardSnapshot(snapshot, to: pasteboard)return falsediff --git a/Tests/FluidDictationIntegrationTests/TypingServiceTransientPasteboardTests.swift b/Tests/FluidDictationIntegrationTests/TypingServiceTransientPasteboardTests.swiftnew file mode 100644index 00000000..32276672--- /dev/null+++ b/Tests/FluidDictationIntegrationTests/TypingServiceTransientPasteboardTests.swift@@ -0,0 +1,66 @@+import AppKit+@testable import FluidVoice_Debug+import XCTest++// The temporary clipboard write used to drive synthetic Cmd+V must be tagged so clipboard+// managers exclude it from history. It is restored immediately and is not user-copied content.+final class TypingServiceTransientPasteboardTests: XCTestCase {++ func testTransientPasteboardItem_carriesText() {+ let item = TypingService.makeTransientPasteboardItem("hello world")+ XCTAssertEqual(+ item.string(forType: .string),+ "hello world",+ "the plain string must survive so paste and clipboard restore behave unchanged"+ )+ }++ func testTransientPasteboardItem_isMarkedForClipboardManagers() {+ let item = TypingService.makeTransientPasteboardItem("hello world")+ let transientType = NSPasteboard.PasteboardType("org.nspasteboard.TransientType")+ let autoGeneratedType = NSPasteboard.PasteboardType("org.nspasteboard.AutoGeneratedType")+ let types = item.types.map(\.rawValue)+ XCTAssertTrue(+ types.contains(transientType.rawValue),+ "temporary write must be marked Transient so clipboard managers skip it"+ )+ XCTAssertTrue(+ types.contains(autoGeneratedType.rawValue),+ "temporary write must be marked AutoGenerated so clipboard managers skip it"+ )+ XCTAssertEqual(+ item.data(forType: transientType)?.count,+ 0+ )+ XCTAssertEqual(+ item.data(forType: autoGeneratedType)?.count,+ 0+ )+ }++ func testTransientMarkersSurvivePasteboardWrite() throws {+ let name = NSPasteboard.Name("com.fluidvoice.tests.transient.\(UUID().uuidString)")+ let pasteboard = NSPasteboard(name: name)+ defer { pasteboard.releaseGlobally() }++ pasteboard.clearContents()+ XCTAssertTrue(+ pasteboard.writeObjects([TypingService.makeTransientPasteboardItem("hello world")])+ )++ let item = try XCTUnwrap(pasteboard.pasteboardItems?.first)+ let types = item.types.map(\.rawValue)+ XCTAssertEqual(item.string(forType: .string), "hello world")+ XCTAssertTrue(types.contains("org.nspasteboard.TransientType"))+ XCTAssertTrue(types.contains("org.nspasteboard.AutoGeneratedType"))+ }++ func testTransientPasteboardItem_isNotMarkedConcealed() {+ let item = TypingService.makeTransientPasteboardItem("hello world")+ let types = item.types.map(\.rawValue)+ XCTAssertFalse(+ types.contains("org.nspasteboard.ConcealedType"),+ "ConcealedType signals sensitive content and must not be applied to a transcript"+ )+ }+}