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
style: apply swiftformat to changed files
Bezhan9b75652c5050
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex 9eeae86a..5a69ec3e 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -35,9 +35,13 @@ final class SettingsStore: ObservableObject {case write // legacy persisted value (decoded as .edit)case rewrite // legacy persisted value (decoded as .edit)- var id: String { self.rawValue }+ var id: String {+ self.rawValue+ }- static var visiblePromptModes: [PromptMode] { [.dictate, .edit] }+ static var visiblePromptModes: [PromptMode] {+ [.dictate, .edit]+ }var normalized: PromptMode {switch self {@@ -723,12 +727,11 @@ final class SettingsStore: ObservableObject {}}- let fallback = self.defaultPromptResolution(+ return self.defaultPromptResolution(for: normalizedMode,source: .appBindingDefault,appBinding: binding)- return fallback}if let profile = self.selectedPromptProfile(for: normalizedMode) {@@ -1234,7 +1237,9 @@ final class SettingsStore: ObservableObject {case purple = "Purple"case orange = "Orange"- var id: String { self.rawValue }+ var id: String {+ self.rawValue+ }var hex: String {switch self {@@ -1254,7 +1259,9 @@ final class SettingsStore: ObservableObject {case fluidSfx3 = "fluid_sfx_3"case fluidSfx4 = "fluid_sfx_4"- var id: String { self.rawValue }+ var id: String {+ self.rawValue+ }var displayName: String {switch self {@@ -2375,8 +2382,8 @@ final class SettingsStore: ObservableObject {/// Unified speech recognition model selection./// Replaces the old TranscriptionProviderOption + WhisperModelSize dual-setting.enum SpeechModel: String, CaseIterable, Identifiable, Codable {- // Temporarily disabled in UI/runtime while Parakeet word boosting work is prioritized.- // Flip to `true` in a future round to re-enable Qwen without deleting implementation.+ /// Temporarily disabled in UI/runtime while Parakeet word boosting work is prioritized.+ /// Flip to `true` in a future round to re-enable Qwen without deleting implementation.static let qwenPreviewEnabled = false// MARK: - FluidAudio Models (Apple Silicon Only)@@ -2399,7 +2406,9 @@ final class SettingsStore: ObservableObject {case whisperLargeTurbo = "whisper-large-turbo" // temporarily disabled in UIcase whisperLarge = "whisper-large"- var id: String { rawValue }+ var id: String {+ rawValue+ }// MARK: - Display Properties@@ -2841,7 +2850,9 @@ final class SettingsStore: ObservableObject {case fluidAudiocase whisper- var id: String { rawValue }+ var id: String {+ rawValue+ }var displayName: String {switch self {@@ -2896,7 +2907,7 @@ final class SettingsStore: ObservableObject {// swiftlint:enable type_body_lengthprivate extension SettingsStore {- // Keys+ /// Keysenum Keys {static let enableAIProcessing = "EnableAIProcessing"static let enableDebugLogs = "EnableDebugLogs"@@ -2971,7 +2982,7 @@ private extension SettingsStore {static let fillerWords = "FillerWords"static let removeFillerWordsEnabled = "RemoveFillerWordsEnabled"- // GAAV Mode (removes capitalization and trailing punctuation)+ /// GAAV Mode (removes capitalization and trailing punctuation)static let gaavModeEnabled = "GAAVModeEnabled"// Custom Dictionary@@ -2982,7 +2993,7 @@ private extension SettingsStore {static let selectedTranscriptionProvider = "SelectedTranscriptionProvider"static let whisperModelSize = "WhisperModelSize"- // Unified Speech Model (replaces above two)+ /// Unified Speech Model (replaces above two)static let selectedSpeechModel = "SelectedSpeechModel"// Overlay Position@@ -2992,10 +3003,10 @@ private extension SettingsStore {static let overlaySize = "OverlaySize"static let transcriptionPreviewCharLimit = "TranscriptionPreviewCharLimit"- // Media Playback Control+ /// Media Playback Controlstatic let pauseMediaDuringTranscription = "PauseMediaDuringTranscription"- // Custom Dictation Prompt+ /// Custom Dictation Promptstatic let customDictationPrompt = "CustomDictationPrompt"// Dictation Prompt Profiles (multi-prompt system)@@ -3015,7 +3026,7 @@ private extension SettingsStore {static let defaultWritePromptOverride = "DefaultWritePromptOverride" // legacy fallback keystatic let defaultRewritePromptOverride = "DefaultRewritePromptOverride" // legacy fallback key- // Streak Settings+ /// Streak Settingsstatic let weekendsDontBreakStreak = "WeekendsDontBreakStreak"}}@@ -3025,7 +3036,9 @@ extension SettingsStore {case standardcase reliablePaste- var id: String { self.rawValue }+ var id: String {+ self.rawValue+ }var displayName: String {switch self {@@ -3082,7 +3095,9 @@ extension SettingsStore {case medium = "ggml-medium.bin"case large = "ggml-large-v3.bin"- var id: String { rawValue }+ var id: String {+ rawValue+ }var displayName: String {switch self {diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swiftindex ef4b0ee2..dc17af3f 100644--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift@@ -73,7 +73,7 @@ final class GlobalHotkeyManager: NSObject {set { self.state.withLock { self.state.isRewriteKeyPressed = newValue } }}- // Modifier-only shortcut tracking: detect if another key was pressed during modifier hold+ /// Modifier-only shortcut tracking: detect if another key was pressed during modifier holdprivate nonisolated var modifierOnlyKeyDown: Bool {get { self.state.withLock { self.state.modifierOnlyKeyDown } }set { self.state.withLock { self.state.modifierOnlyKeyDown = newValue } }@@ -84,7 +84,7 @@ final class GlobalHotkeyManager: NSObject {set { self.state.withLock { self.state.otherKeyPressedDuringModifier = newValue } }}- // Reserved for future tap-vs-hold timing detection (e.g., quick tap to toggle vs long hold)+ /// Reserved for future tap-vs-hold timing detection (e.g., quick tap to toggle vs long hold)private nonisolated var modifierPressStartTime: Date? {get { self.state.withLock { self.state.modifierPressStartTime } }set { self.state.withLock { self.state.modifierPressStartTime = newValue } }@@ -95,13 +95,13 @@ final class GlobalHotkeyManager: NSObject {set { self.state.withLock { self.state.pendingHoldModeStart = newValue } }}- // Tracks which mode's pending start is active (for cancellation on key combos)+ /// Tracks which mode's pending start is active (for cancellation on key combos)private nonisolated var pendingHoldModeType: HotkeyHoldModeType? {get { self.state.withLock { self.state.pendingHoldModeType } }set { self.state.withLock { self.state.pendingHoldModeType = newValue } }}- // Busy flag to prevent race conditions during stop processing+ /// Busy flag to prevent race conditions during stop processingprivate var isProcessingStop = falseprivate var isInitialized = falsediff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swiftindex 8cebf2a2..124d25fe 100644--- a/Sources/Fluid/UI/SettingsView.swift+++ b/Sources/Fluid/UI/SettingsView.swift@@ -11,7 +11,10 @@ import SwiftUIstruct SettingsView: View {@EnvironmentObject var appServices: AppServices- private var asr: ASRService { self.appServices.asr }+ private var asr: ASRService {+ self.appServices.asr+ }+@Environment(\.theme) private var theme@ObservedObject private var settings = SettingsStore.shared@Binding var appear: Bool@@ -452,11 +455,13 @@ struct SettingsView: View {.frame(width: 8, height: 8)VStack(alignment: .leading, spacing: 2) {- Text(self.asr.micStatus == .authorized ? "Microphone access granted" :- self.asr.micStatus == .denied ? "Microphone access denied" :- "Microphone access not determined")- .font(.body)- .foregroundStyle(self.asr.micStatus == .authorized ? .primary : self.theme.palette.warning)+ Text(+ self.asr.micStatus == .authorized ? "Microphone access granted" :+ self.asr.micStatus == .denied ? "Microphone access denied" :+ "Microphone access not determined"+ )+ .font(.body)+ .foregroundStyle(self.asr.micStatus == .authorized ? .primary : self.theme.palette.warning)if self.asr.micStatus != .authorized {Text("Microphone access is required for voice recording")@@ -1397,7 +1402,6 @@ struct SettingsView: View {// MARK: - Helper Views- @ViewBuilderprivate func settingsToggleRow(title: String,description: String,@@ -1430,7 +1434,6 @@ struct SettingsView: View {}}- @ViewBuilderprivate func optionToggleRow(title: String,description: String,@@ -1454,7 +1457,6 @@ struct SettingsView: View {}}- @ViewBuilderprivate func instructionsBox(title: String,steps: [String],@@ -1540,17 +1542,23 @@ struct SettingsView: View {.foregroundStyle(.orange).padding(.horizontal, 8).padding(.vertical, 4)- .background(RoundedRectangle(cornerRadius: 5, style: .continuous)- .fill(.orange.opacity(0.2)))+ .background(+ RoundedRectangle(cornerRadius: 5, style: .continuous)+ .fill(.orange.opacity(0.2))+ )} else {Text(shortcut.displayString).font(.caption.monospaced().weight(.medium)).padding(.horizontal, 8).padding(.vertical, 4)- .background(RoundedRectangle(cornerRadius: 5, style: .continuous)- .fill(.quaternary.opacity(0.5))- .overlay(RoundedRectangle(cornerRadius: 5, style: .continuous)- .stroke(.primary.opacity(0.15), lineWidth: 1)))+ .background(+ RoundedRectangle(cornerRadius: 5, style: .continuous)+ .fill(.quaternary.opacity(0.5))+ .overlay(+ RoundedRectangle(cornerRadius: 5, style: .continuous)+ .stroke(.primary.opacity(0.15), lineWidth: 1)+ )+ )}Button("Change") {@@ -1594,8 +1602,10 @@ struct FillerWordsEditor: View {}.padding(.horizontal, 8).padding(.vertical, 4)- .background(RoundedRectangle(cornerRadius: 6, style: .continuous)- .fill(.quaternary))+ .background(+ RoundedRectangle(cornerRadius: 6, style: .continuous)+ .fill(.quaternary)+ )}}diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swiftindex 7dcf8657..09598d99 100644--- a/Sources/Fluid/Views/BottomOverlayView.swift+++ b/Sources/Fluid/Views/BottomOverlayView.swift@@ -1384,7 +1384,6 @@ private struct BottomOverlayActionsMenuView: View {)}- @ViewBuilderprivate func actionRow(title: String,icon: String,@@ -1715,8 +1714,8 @@ struct BottomOverlayView: View {"Working...",]- // ContentView writes transient status strings into transcriptionText while processing- // (e.g. "Transcribing...", "Refining..."). Prefer that when present.+ /// ContentView writes transient status strings into transcriptionText while processing+ /// (e.g. "Transcribing...", "Refining..."). Prefer that when present.private var processingStatusText: String {let t = self.contentState.transcriptionText.trimmingCharacters(in: .whitespacesAndNewlines)return t.isEmpty ? self.processingLabel : t@@ -2518,11 +2517,25 @@ struct BottomWaveformView: View {@State private var barHeights: [CGFloat] = Array(repeating: 6, count: 11)@State private var noiseThreshold: CGFloat = .init(SettingsStore.shared.visualizerNoiseThreshold)- private var barCount: Int { self.layout.barCount }- private var barWidth: CGFloat { self.layout.barWidth }- private var barSpacing: CGFloat { self.layout.barSpacing }- private var minHeight: CGFloat { self.layout.minBarHeight }- private var maxHeight: CGFloat { self.layout.maxBarHeight }+ private var barCount: Int {+ self.layout.barCount+ }++ private var barWidth: CGFloat {+ self.layout.barWidth+ }++ private var barSpacing: CGFloat {+ self.layout.barSpacing+ }++ private var minHeight: CGFloat {+ self.layout.minBarHeight+ }++ private var maxHeight: CGFloat {+ self.layout.maxBarHeight+ }private var currentGlowIntensity: CGFloat {self.contentState.isProcessing ? 0.0 : 0.5diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swiftindex 5d6338dd..d3c4d535 100644--- a/Sources/Fluid/Views/NotchContentViews.swift+++ b/Sources/Fluid/Views/NotchContentViews.swift@@ -13,7 +13,7 @@ import SwiftUI@MainActorclass NotchContentState: ObservableObject {static let shared = NotchContentState()- // Keep overlay state bounded even during very long recordings.+ /// Keep overlay state bounded even during very long recordings.private static let maxStoredTranscriptionCharacters = SettingsStore.transcriptionPreviewCharLimitRange.upperBound@Published var transcriptionText: String = ""@@ -22,14 +22,14 @@ class NotchContentState: ObservableObject {@Published var isProcessing: Bool = false // AI processing state@Published var promptModeOverrideProfileName: String? = nil // Name shown in overlay when prompt mode hotkey is active- // Icon of the target app (where text will be typed)+ /// Icon of the target app (where text will be typed)@Published var targetAppIcon: NSImage?/// The PID of the app we should restore focus to after interacting with overlays./// Captured at recording start to keep the target stable for the session.@Published var recordingTargetPID: pid_t? = nil- // Cached transcription preview text to avoid recomputing on every render+ /// Cached transcription preview text to avoid recomputing on every render@Published private(set) var cachedPreviewText: String = ""// MARK: - Expanded Command Output State@@ -46,7 +46,7 @@ class NotchContentState: ObservableObject {@Published var recentChats: [ChatSession] = []@Published var currentChatTitle: String = "New Chat"- // Command output message model+ /// Command output message modelstruct CommandOutputMessage: Identifiable, Equatable {let id = UUID()let role: Role@@ -60,7 +60,7 @@ class NotchContentState: ObservableObject {}}- // Callback for submitting follow-up commands from the notch+ /// Callback for submitting follow-up commands from the notchvar onSubmitFollowUp: ((String) async -> Void)?private var cancellables = Set<AnyCancellable>()@@ -296,8 +296,8 @@ struct NotchExpandedView: View {}}- // ContentView writes transient status strings into transcriptionText while processing- // (e.g. "Transcribing...", "Refining..."). Prefer that when present.+ /// ContentView writes transient status strings into transcriptionText while processing+ /// (e.g. "Transcribing...", "Refining..."). Prefer that when present.private var processingStatusText: String {let t = self.contentState.transcriptionText.trimmingCharacters(in: .whitespacesAndNewlines)return t.isEmpty ? self.processingLabel : t@@ -307,7 +307,7 @@ struct NotchExpandedView: View {!self.contentState.transcriptionText.isEmpty}- // Check if there's command history that can be expanded+ /// Check if there's command history that can be expandedprivate var canExpandCommandHistory: Bool {self.contentState.mode == .command && !self.contentState.commandConversationHistory.isEmpty}@@ -753,7 +753,7 @@ struct NotchCommandOutputExpandedView: View {70}- // Dynamic height based on content (max half screen)+ /// Dynamic height based on content (max half screen)private var dynamicHeight: CGFloat {let baseHeight: CGFloat = 120 // Minimum heightlet contentHeight = self.estimateContentHeight()