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): stop raising every window of the target app when restoring focus after dictation
Yurii Chukhlib81ac1c3b407f
diff --git a/Sources/Fluid/Services/TypingService.swift b/Sources/Fluid/Services/TypingService.swiftindex 6cacc699..b3315b7a 100644--- a/Sources/Fluid/Services/TypingService.swift+++ b/Sources/Fluid/Services/TypingService.swift@@ -255,6 +255,13 @@ final class TypingService {return nil}+ /// Activation options used to restore focus to the external target app after dictation.+ /// `.activateAllWindows` is intentionally omitted: raising every window of a multi-window+ /// app (e.g. WebStorm) destroys the user's window layout on each dictation (issue #748).+ static let focusRestoreActivationOptions: NSApplication.ActivationOptions = [+ .activateIgnoringOtherApps,+ ]+/// Best-effort: activates the app with the given PID, unless it's Fluid itself.@discardableResultstatic func activateApp(pid: pid_t) -> Bool {@@ -269,7 +276,7 @@ final class TypingService {return false}- return app.activate(options: [.activateAllWindows, .activateIgnoringOtherApps])+ return app.activate(options: Self.focusRestoreActivationOptions)}// MARK: - Public APIdiff --git a/Tests/FluidDictationIntegrationTests/TypingServiceTransientPasteboardTests.swift b/Tests/FluidDictationIntegrationTests/TypingServiceTransientPasteboardTests.swiftindex 32276672..aeedc61e 100644--- a/Tests/FluidDictationIntegrationTests/TypingServiceTransientPasteboardTests.swift+++ b/Tests/FluidDictationIntegrationTests/TypingServiceTransientPasteboardTests.swift@@ -63,4 +63,20 @@ final class TypingServiceTransientPasteboardTests: XCTestCase {"ConcealedType signals sensitive content and must not be applied to a transcript")}++ func testFocusRestoreDoesNotRaiseAllWindowsOfTargetApp() {+ // Issue #748: restoring focus after dictation must NOT raise every window of the+ // target app. `.activateAllWindows` brings forward all windows of the process and+ // destroys a multi-window layout (e.g. WebStorm) on every dictation.+ let options = TypingService.focusRestoreActivationOptions++ XCTAssertTrue(+ options.contains(.activateIgnoringOtherApps),+ "focus restore must still activate the target app and bring it forward"+ )+ XCTAssertFalse(+ options.contains(.activateAllWindows),+ "Restoring focus must not raise every window of the target app (issue #748)"+ )+ }}