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(app): respect focus on launch

altic-dev42148e7e78cc
diff --git a/Sources/Fluid/AppDelegate.swift b/Sources/Fluid/AppDelegate.swift
index d1f1e4cd..49e9a1ad 100644
--- a/Sources/Fluid/AppDelegate.swift
+++ b/Sources/Fluid/AppDelegate.swift
@@ -104,15 +104,24 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
private func forceFrontOnLaunch() {
// Login-item launches can take longer before SwiftUI's main window exists.
- // Keep retrying for a few seconds so the existing ContentView startup path runs.
+ // Keep retrying while FluidVoice is still foregrounded, but stop if the user switches away.
for delay in [0.0, 0.12, 0.35, 1.0, 2.0, 4.0] {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
guard let self else { return }
+ guard delay == 0.0 || self.shouldContinueLaunchForegroundRetry() else {
+ DebugLogger.shared.debug("Skipped launch-front retry because another app is active", source: "AppDelegate")
+ return
+ }
self.bringMainWindowToFront()
}
}
}
+ private func shouldContinueLaunchForegroundRetry() -> Bool {
+ if NSApp.isActive { return true }
+ return NSWorkspace.shared.frontmostApplication?.processIdentifier == ProcessInfo.processInfo.processIdentifier
+ }
+
private func bringMainWindowToFront() {
NSApp.activate(ignoringOtherApps: true)
diff --git a/Sources/Fluid/Models/HotkeyShortcut.swift b/Sources/Fluid/Models/HotkeyShortcut.swift
index bbe0574a..c6996041 100644
--- a/Sources/Fluid/Models/HotkeyShortcut.swift
+++ b/Sources/Fluid/Models/HotkeyShortcut.swift
@@ -21,7 +21,7 @@ struct HotkeyShortcut: Codable, Equatable {
if self.modifierFlags.contains(.option) { parts.append("⌥") }
if self.modifierFlags.contains(.control) { parts.append("⌃") }
if self.modifierFlags.contains(.shift) { parts.append("⇧") }
- parts.append(Self.keyCodeToString(keyCode) ?? "?")
+ parts.append(Self.keyCodeToString(self.keyCode) ?? "?")
if self.modifierFlags.isEmpty {
return parts.last ?? "Unknown"
@@ -50,7 +50,7 @@ struct HotkeyShortcut: Codable, Equatable {
case 124: return "Right"
case 125: return "Down"
case 126: return "Up"
- default: return characterForKeyCode(keyCode) ?? qwertyFallback[keyCode]
+ default: return self.characterForKeyCode(keyCode) ?? self.qwertyFallback[keyCode]
}
}