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(typing): paste when focus is a window or app

altic-deva1a65772488f
diff --git a/Fluid.xcodeproj/project.pbxproj b/Fluid.xcodeproj/project.pbxproj
index 3814f5be..2b0b95ed 100644
--- a/Fluid.xcodeproj/project.pbxproj
+++ b/Fluid.xcodeproj/project.pbxproj
@@ -13,6 +13,7 @@
7C5AF14C2F15041600DE21B0 /* MediaRemoteAdapter in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 7C5AF14A2F15041600DE21B0 /* MediaRemoteAdapter */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7C9A71022F58B00000FB7CAF /* TranscribeCpp in Frameworks */ = {isa = PBXBuildFile; productRef = 7C9A71012F58B00000FB7CAF /* TranscribeCpp */; };
7C91B0012F42AA0100C0DEF0 /* HotkeyShortcutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C91B0022F42AA0100C0DEF0 /* HotkeyShortcutTests.swift */; };
+ 7C91B0A12F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C91B0A22F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift */; };
C0DE89000000000000000002 /* SettingsNavigationStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0DE89000000000000000001 /* SettingsNavigationStateTests.swift */; };
7CDB0A2D2F3C4D5600FB7CAD /* DictationE2ETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CDB0A292F3C4D5600FB7CAD /* DictationE2ETests.swift */; };
B52000000000000000000002 /* PrivateAIDictationTokenBudgetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B52000000000000000000001 /* PrivateAIDictationTokenBudgetTests.swift */; };
@@ -90,6 +91,7 @@
FEED67600000000000000001 /* PasteDeliveryCoordinatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteDeliveryCoordinatorTests.swift; sourceTree = "<group>"; };
7C078D8F2E3B339200FB7CAC /* FluidVoice Debug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "FluidVoice Debug.app"; sourceTree = BUILT_PRODUCTS_DIR; };
7C91B0022F42AA0100C0DEF0 /* HotkeyShortcutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HotkeyShortcutTests.swift; sourceTree = "<group>"; };
+ 7C91B0A22F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeliveryTargetAssessmentTests.swift; sourceTree = "<group>"; };
C0DE89000000000000000001 /* SettingsNavigationStateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsNavigationStateTests.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>"; };
@@ -169,6 +171,7 @@
7CDB0A292F3C4D5600FB7CAD /* DictationE2ETests.swift */,
CD1C7A0000000000000000B1 /* CustomDictionaryManualEntryTests.swift */,
7C91B0022F42AA0100C0DEF0 /* HotkeyShortcutTests.swift */,
+ 7C91B0A22F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift */,
C0DE89000000000000000001 /* SettingsNavigationStateTests.swift */,
343B29013F4441D6A797D12D /* LLMClientRequestBodyTests.swift */,
980330F3CE464336ADCE3E23 /* TemperatureSupportTests.swift */,
@@ -354,6 +357,7 @@
B52000000000000000000002 /* PrivateAIDictationTokenBudgetTests.swift in Sources */,
CD1C7A0000000000000000B2 /* CustomDictionaryManualEntryTests.swift in Sources */,
7C91B0012F42AA0100C0DEF0 /* HotkeyShortcutTests.swift in Sources */,
+ 7C91B0A12F42AA0100C0DEF0 /* DeliveryTargetAssessmentTests.swift in Sources */,
C0DE89000000000000000002 /* SettingsNavigationStateTests.swift in Sources */,
86CAA2D4EF18433096185602 /* LLMClientRequestBodyTests.swift in Sources */,
272BFB5CB271489892CAE50C /* TemperatureSupportTests.swift in Sources */,
diff --git a/Sources/Fluid/Services/DeliveryTargetAssessment.swift b/Sources/Fluid/Services/DeliveryTargetAssessment.swift
index 1d547412..03270de7 100644
--- a/Sources/Fluid/Services/DeliveryTargetAssessment.swift
+++ b/Sources/Fluid/Services/DeliveryTargetAssessment.swift
@@ -22,16 +22,17 @@ enum DeliveryTargetAssessment: Equatable {
}
}
- /// Roles that never accept typed text. Containers such as AXGroup and
- /// AXWebArea are deliberately absent: web editors report those. Table
- /// roles are absent too: a selected spreadsheet cell reports AXCell or
- /// AXTable and does accept pasted text.
+ /// Roles that never accept typed text. Containers are deliberately absent:
+ /// AXGroup and AXWebArea are what web editors report, a selected spreadsheet
+ /// cell reports AXCell or AXTable, and apps that draw their own UI
+ /// (GPU terminals, remote desktops, VMs, games) report AXWindow, AXSheet or
+ /// AXApplication while still accepting Cmd+V.
private static let nonEditableRoles: Set<String> = [
"AXButton", "AXCheckBox", "AXRadioButton", "AXPopUpButton", "AXMenuButton",
"AXMenuItem", "AXMenu", "AXMenuBar", "AXMenuBarItem",
"AXStaticText", "AXImage", "AXLink", "AXDisclosureTriangle",
"AXScrollBar", "AXSlider", "AXIncrementor", "AXTabGroup", "AXToolbar",
- "AXSplitter", "AXWindow", "AXSheet", "AXDrawer", "AXApplication", "AXDockItem",
+ "AXSplitter", "AXDockItem",
]
private static let editableRoles: Set<String> = [
@@ -56,12 +57,14 @@ enum DeliveryTargetAssessment: Equatable {
let role = roleRef as? String
else { return .unknown(reason: "role_unreadable") }
- if self.editableRoles.contains(role) { return .editable(role: role) }
-
var valueSettable = DarwinBoolean(false)
let settableResult = AXUIElementIsAttributeSettable(element, kAXValueAttribute as CFString, &valueSettable)
- if settableResult == .success, valueSettable.boolValue { return .editable(role: role) }
+ return self.classify(role: role, valueSettable: settableResult == .success && valueSettable.boolValue)
+ }
+ /// Pure role decision, kept separate from the AX queries so it can be tested.
+ nonisolated static func classify(role: String, valueSettable: Bool) -> DeliveryTargetAssessment {
+ if self.editableRoles.contains(role) || valueSettable { return .editable(role: role) }
guard self.nonEditableRoles.contains(role) else { return .unknown(reason: "role_\(role)") }
return .notEditable(role: role)
}
diff --git a/Tests/FluidDictationIntegrationTests/DeliveryTargetAssessmentTests.swift b/Tests/FluidDictationIntegrationTests/DeliveryTargetAssessmentTests.swift
new file mode 100644
index 00000000..1617ad69
--- /dev/null
+++ b/Tests/FluidDictationIntegrationTests/DeliveryTargetAssessmentTests.swift
@@ -0,0 +1,28 @@
+@testable import FluidVoice_Debug
+import XCTest
+
+final class DeliveryTargetAssessmentTests: XCTestCase {
+ func testTextRolesAreEditable() {
+ for role in ["AXTextField", "AXTextArea", "AXComboBox", "AXSecureTextField"] {
+ XCTAssertEqual(DeliveryTargetAssessment.classify(role: role, valueSettable: false), .editable(role: role))
+ }
+ }
+
+ func testSettableValueWinsOverRole() {
+ XCTAssertEqual(DeliveryTargetAssessment.classify(role: "AXStaticText", valueSettable: true), .editable(role: "AXStaticText"))
+ }
+
+ func testControlsAndStaticContentAreRefused() {
+ for role in ["AXButton", "AXStaticText", "AXImage", "AXMenuItem", "AXSlider"] {
+ XCTAssertTrue(DeliveryTargetAssessment.classify(role: role, valueSettable: false).isCertainlyNotEditable, role)
+ }
+ }
+
+ func testContainersStayUnknownSoPasteProceeds() {
+ // Apps that draw their own UI report the window or application as the
+ // focused element and still accept Cmd+V.
+ for role in ["AXWindow", "AXSheet", "AXDrawer", "AXApplication", "AXGroup", "AXWebArea", "AXCell", "AXUnknown"] {
+ XCTAssertEqual(DeliveryTargetAssessment.classify(role: role, valueSettable: false), .unknown(reason: "role_\(role)"), role)
+ }
+ }
+}