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

add fallback paste for ghostty

grohith3274b1c0c8c5097
diff --git a/Sources/Fluid/Services/TypingService.swift b/Sources/Fluid/Services/TypingService.swift
index 259c9a05..c7c8342d 100644
--- a/Sources/Fluid/Services/TypingService.swift
+++ b/Sources/Fluid/Services/TypingService.swift
@@ -54,6 +54,7 @@ final class TypingService {
private static let pasteboardSessionSemaphore = DispatchSemaphore(value: 1)
private static let pasteboardRestoreQueue = DispatchQueue(label: "TypingService.PasteboardRestore", qos: .utility)
private static var focusSnapshot: FocusSnapshot?
+ private static let ghosttyBundleIdentifier = "com.mitchellh.ghostty"
private var textInsertionMode: SettingsStore.TextInsertionMode {
SettingsStore.shared.textInsertionMode
@@ -224,6 +225,16 @@ final class TypingService {
return Self.isCurrentlyFocusedElement(element, expectedPID: pid)
}
+ private func isGhosttyTarget(preferredTargetPID: pid_t?) -> Bool {
+ guard let preferredTargetPID, preferredTargetPID > 0,
+ let app = NSRunningApplication(processIdentifier: preferredTargetPID)
+ else {
+ return false
+ }
+
+ return app.bundleIdentifier == Self.ghosttyBundleIdentifier
+ }
+
/// Best-effort: activates the app with the given PID, unless it's Fluid itself.
@discardableResult
static func activateApp(pid: pid_t) -> Bool {
@@ -341,6 +352,15 @@ final class TypingService {
self.log("[TypingService] insertTextInstantly called with \(text.count) characters")
self.log("[TypingService] Attempting to type text: \"\(text.prefix(50))\(text.count > 50 ? "..." : "")\"")
+ if self.textInsertionMode == .standard, self.isGhosttyTarget(preferredTargetPID: preferredTargetPID) {
+ self.log("[TypingService] Ghostty target detected in standard mode; forcing Reliable Paste path")
+ if self.tryReliablePasteInsertion(text, preferredTargetPID: preferredTargetPID) {
+ self.log("[TypingService] SUCCESS: Ghostty Reliable Paste path completed")
+ return
+ }
+ self.log("[TypingService] Ghostty Reliable Paste path fell through to direct-typing fallbacks")
+ }
+
if self.textInsertionMode == .reliablePaste {
self.log("[TypingService] Reliable Paste mode enabled")
if self.tryReliablePasteInsertion(text, preferredTargetPID: preferredTargetPID) {