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
Optimized notch design architecture
altic-devc11b9de7d876
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex b6ff8c17..0a791cc2 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -296,27 +296,34 @@ struct ContentView: View {// Set up notch click callback for expanding command conversationNotchOverlayManager.shared.onNotchClicked = {+ guard NotchOverlayManager.shared.canHandleNotchCommandTap else { return }// When notch is clicked in command mode, show expanded conversation- if !NotchContentState.shared.commandConversationHistory.isEmpty {+ if NotchOverlayManager.shared.canShowExpandedCommandOutput,+ !NotchContentState.shared.commandConversationHistory.isEmpty+ {NotchOverlayManager.shared.showExpandedCommandOutput()}}// Set up command mode callbacks for notchNotchOverlayManager.shared.onCommandFollowUp = { [weak commandModeService] text in+ guard NotchOverlayManager.shared.allowsCommandNotchActions else { return }await commandModeService?.processFollowUpCommand(text)}// Chat management callbacksNotchOverlayManager.shared.onNewChat = { [weak commandModeService] in+ guard NotchOverlayManager.shared.allowsCommandNotchActions else { return }commandModeService?.createNewChat()}NotchOverlayManager.shared.onSwitchChat = { [weak commandModeService] chatID in+ guard NotchOverlayManager.shared.allowsCommandNotchActions else { return }commandModeService?.switchToChat(id: chatID)}NotchOverlayManager.shared.onClearChat = { [weak commandModeService] in+ guard NotchOverlayManager.shared.allowsCommandNotchActions else { return }commandModeService?.deleteCurrentChat()}diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex f4deb986..c9c28b41 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -1332,6 +1332,13 @@ final class SettingsStore: ObservableObject {}}+ /// Internal presentation modes for the top notch overlay.+ /// This is intentionally separate from bottom overlay sizing.+ enum NotchPresentationMode: String, CaseIterable, Codable {+ case standard+ case minimal+ }+/// Where the recording overlay appears (default: bottom)var overlayPosition: OverlayPosition {get {@@ -1348,6 +1355,22 @@ final class SettingsStore: ObservableObject {}}+ /// Internal-only top notch presentation mode. No public settings UI yet.+ var notchPresentationMode: NotchPresentationMode {+ get {+ guard let raw = self.defaults.string(forKey: Keys.notchPresentationMode),+ let mode = NotchPresentationMode(rawValue: raw)+ else {+ return .standard+ }+ return mode+ }+ set {+ objectWillChange.send()+ self.defaults.set(newValue.rawValue, forKey: Keys.notchPresentationMode)+ }+ }+/// Vertical offset for the bottom overlay (distance from bottom of screen/dock)var overlayBottomOffset: Double {get {@@ -3581,6 +3604,7 @@ private extension SettingsStore {// Overlay Positionstatic let overlayPosition = "OverlayPosition"+ static let notchPresentationMode = "NotchPresentationMode"static let overlayBottomOffset = "OverlayBottomOffset"static let overlayBottomOffsetMigratedTo50 = "OverlayBottomOffsetMigratedTo50"static let overlaySize = "OverlaySize"diff --git a/Sources/Fluid/Services/CommandModeService.swift b/Sources/Fluid/Services/CommandModeService.swiftindex be5d5dcb..785656e5 100644--- a/Sources/Fluid/Services/CommandModeService.swift+++ b/Sources/Fluid/Services/CommandModeService.swift@@ -33,6 +33,10 @@ final class CommandModeService: ObservableObject {self.loadCurrentChatFromStore()}+ private var shouldSyncCommandNotchState: Bool {+ self.enableNotchOutput && NotchOverlayManager.shared.shouldSyncCommandConversationToNotch+ }+private func loadCurrentChatFromStore() {if let session = chatStore.currentSession {self.currentChatID = session.id@@ -278,6 +282,11 @@ final class CommandModeService: ObservableObject {/// Sync conversation history to NotchContentStateprivate func syncToNotchState() {+ guard self.shouldSyncCommandNotchState else {+ NotchContentState.shared.clearCommandOutput()+ return+ }+NotchContentState.shared.clearCommandOutput()for msg in self.conversationHistory {@@ -308,7 +317,7 @@ final class CommandModeService: ObservableObject {self.saveCurrentChat()// Push to notch- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.addCommandMessage(role: .user, content: text)NotchContentState.shared.setCommandProcessing(true)}@@ -322,14 +331,18 @@ final class CommandModeService: ObservableObject {// Add to both historiesself.conversationHistory.append(Message(role: .user, content: text))- NotchContentState.shared.addCommandMessage(role: .user, content: text)+ if self.shouldSyncCommandNotchState {+ NotchContentState.shared.addCommandMessage(role: .user, content: text)+ }// Auto-save after adding user messageself.saveCurrentChat()self.isProcessing = trueself.didRequireConfirmationThisRun = false- NotchContentState.shared.setCommandProcessing(true)+ if self.shouldSyncCommandNotchState {+ NotchContentState.shared.setCommandProcessing(true)+ }await self.processNextTurn()}@@ -374,7 +387,7 @@ final class CommandModeService: ObservableObject {self.captureCommandRunCompleted(success: false)// Push to notch- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.addCommandMessage(role: .assistant, content: errorMsg)NotchContentState.shared.setCommandProcessing(false)self.showExpandedNotchIfNeeded()@@ -386,7 +399,7 @@ final class CommandModeService: ObservableObject {self.currentStep = .thinking("Analyzing...")// Push status to notch- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.addCommandMessage(role: .status, content: "Thinking...")}@@ -414,7 +427,7 @@ final class CommandModeService: ObservableObject {))// Push step to notch- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {let statusText = tc.purpose ?? self.stepDescription(for: stepType)NotchContentState.shared.addCommandMessage(role: .status, content: statusText)}@@ -432,7 +445,7 @@ final class CommandModeService: ObservableObject {self.currentStep = nil// Push confirmation needed to notch- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.addCommandMessage(role: .status, content: "⚠️ Confirmation needed in Command Mode window")NotchContentState.shared.setCommandProcessing(false)}@@ -464,7 +477,7 @@ final class CommandModeService: ObservableObject {self.captureCommandRunCompleted(success: isFinal)// Push final response to notch and show expanded view- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.updateCommandStreamingText("") // Clear streamingNotchContentState.shared.addCommandMessage(role: .assistant, content: response.content)NotchContentState.shared.setCommandProcessing(false)@@ -488,7 +501,7 @@ final class CommandModeService: ObservableObject {self.captureCommandRunCompleted(success: false)// Push error to notch- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.addCommandMessage(role: .assistant, content: errorMsg)NotchContentState.shared.setCommandProcessing(false)self.showExpandedNotchIfNeeded()@@ -530,7 +543,8 @@ final class CommandModeService: ObservableObject {/// Show expanded notch output if there's content to displayprivate func showExpandedNotchIfNeeded() {- guard self.enableNotchOutput else { return }+ guard self.shouldSyncCommandNotchState else { return }+ guard NotchOverlayManager.shared.canShowExpandedCommandOutput else { return }guard !NotchContentState.shared.commandConversationHistory.isEmpty else { return }// Show the expanded notch@@ -912,7 +926,7 @@ final class CommandModeService: ObservableObject {self.streamingText = fullContent// Push to notch for real-time display- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.updateCommandStreamingText(fullContent)}}@@ -928,7 +942,7 @@ final class CommandModeService: ObservableObject {let fullContent = self.streamingBuffer.joined()if !fullContent.isEmpty {self.streamingText = fullContent- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.updateCommandStreamingText(fullContent)}}@@ -945,7 +959,7 @@ final class CommandModeService: ObservableObject {self.thinkingBuffer = [] // Clear thinking buffer// Clear notch streaming text as well- if self.enableNotchOutput {+ if self.shouldSyncCommandNotchState {NotchContentState.shared.updateCommandStreamingText("")}diff --git a/Sources/Fluid/Services/MenuBarManager.swift b/Sources/Fluid/Services/MenuBarManager.swiftindex f1771905..6d215ef3 100644--- a/Sources/Fluid/Services/MenuBarManager.swift+++ b/Sources/Fluid/Services/MenuBarManager.swift@@ -87,9 +87,7 @@ final class MenuBarManager: NSObject, ObservableObject, NSMenuDelegate {.receive(on: DispatchQueue.main).sink { [weak self] newText inguard self != nil else { return }- // CRITICAL FIX: Check if streaming preview is enabled before updating notch- // The "Show Live Preview" toggle in Preferences should control this behavior- if SettingsStore.shared.enableStreamingPreview {+ if NotchOverlayManager.shared.shouldShowOrTrackLivePreviewText {NotchOverlayManager.shared.updateTranscriptionText(newText)}}@@ -119,7 +117,7 @@ final class MenuBarManager: NSObject, ObservableObject, NSMenuDelegate {if NotchOverlayManager.shared.isCommandOutputExpanded {// Only keep expanded notch if this is a command mode recording (follow-up)// For other modes (dictation, rewrite), close it and show regular notch- if self.currentOverlayMode == .command {+ if self.currentOverlayMode == .command, NotchOverlayManager.shared.supportsCommandNotchUI {// Enable recording visualization in the expanded notchNotchContentState.shared.setRecordingInExpandedMode(true)@@ -143,7 +141,10 @@ final class MenuBarManager: NSObject, ObservableObject, NSMenuDelegate {// Double-check expanded notch isn't showing (could have changed during delay)// But only block if we're in command mode- if NotchOverlayManager.shared.isCommandOutputExpanded && self.currentOverlayMode == .command {+ if NotchOverlayManager.shared.isCommandOutputExpanded,+ self.currentOverlayMode == .command,+ NotchOverlayManager.shared.supportsCommandNotchUI+ {self.pendingShowOperation = nilreturn}diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swiftindex 939cf5f1..dca549bc 100644--- a/Sources/Fluid/Services/NotchOverlayManager.swift+++ b/Sources/Fluid/Services/NotchOverlayManager.swift@@ -24,6 +24,16 @@ enum OverlayMode: String {final class NotchOverlayManager {static let shared = NotchOverlayManager()+ struct NotchPresentationPolicy: Equatable {+ let usesCompactPresentation: Bool+ let showsPromptSelector: Bool+ let showsStreamingPreview: Bool+ let showsModeLabel: Bool+ let allowsCommandExpansion: Bool+ let allowsCommandActions: Bool+ let allowsExpandedCommandOutput: Bool+ }+private var notch: DynamicNotch<NotchExpandedView, NotchCompactLeadingView, NotchCompactTrailingView>?private var commandOutputNotch: DynamicNotch<NotchCommandOutputExpandedView,@@ -78,7 +88,11 @@ final class NotchOverlayManager {private var globalEscapeMonitor: Any?private var localEscapeMonitor: Any?+ private(set) var currentNotchPresentationMode: SettingsStore.NotchPresentationMode = .standard+ private(set) var currentNotchPresentationPolicy = NotchPresentationPolicy.standard+private init() {+ self.refreshNotchPresentationPolicy()self.setupEscapeKeyMonitors()}@@ -113,6 +127,8 @@ final class NotchOverlayManager {}func show(audioLevelPublisher: AnyPublisher<CGFloat, Never>, mode: OverlayMode) {+ self.refreshNotchPresentationPolicy()+// Don't show regular notch if expanded command output is visibleif self.isCommandOutputExpanded {// Just store the publisher for later use@@ -187,6 +203,8 @@ final class NotchOverlayManager {/// Show notch overlay (original behavior)private func showNotchOverlay(audioLevelPublisher: AnyPublisher<CGFloat, Never>, mode: OverlayMode) {+ self.refreshNotchPresentationPolicy()+// Hide bottom overlay if it was visibleif self.isBottomOverlayVisible {BottomOverlayWindowController.shared.hide()@@ -219,9 +237,13 @@ final class NotchOverlayManager {self.notch = newNotch- // Show in expanded state+ // Resolve presentation from policy so future notch modes don't require call-site changes.Task { [weak self] in- await newNotch.expand()+ if self?.currentNotchPresentationPolicy.usesCompactPresentation == true {+ await newNotch.compact()+ } else {+ await newNotch.expand()+ }// Only update state if we're still the active generationguard let self = self, self.generation == currentGeneration else { return }self.state = .visible@@ -281,6 +303,8 @@ final class NotchOverlayManager {}func setMode(_ mode: OverlayMode) {+ self.refreshNotchPresentationPolicy()+// Always update NotchContentState to ensure UI stays in sync// (can get out of sync during show/hide transitions)let normalized = self.normalizedOverlayMode(mode)@@ -302,6 +326,12 @@ final class NotchOverlayManager {}func updateTranscriptionText(_ text: String) {+ guard self.shouldShowOrTrackLivePreviewText else {+ if !NotchContentState.shared.transcriptionText.isEmpty {+ NotchContentState.shared.updateTranscription("")+ }+ return+ }NotchContentState.shared.updateTranscription(text)}@@ -333,6 +363,8 @@ final class NotchOverlayManager {/// Show expanded command output notchfunc showExpandedCommandOutput() {+ guard self.canShowExpandedCommandOutput else { return }+// Hide regular notch first if visibleif self.notch != nil {self.hide()@@ -346,6 +378,7 @@ final class NotchOverlayManager {}private func showExpandedCommandOutputInternal() async {+ guard self.canShowExpandedCommandOutput else { return }guard self.commandOutputState == .idle else { return }self.commandOutputGeneration &+= 1@@ -373,25 +406,29 @@ final class NotchOverlayManager {}},onSubmit: { [weak self] text in- await self?.onCommandFollowUp?(text)+ guard let self, self.allowsCommandNotchActions else { return }+ await self.onCommandFollowUp?(text)},onNewChat: { [weak self] inTask { @MainActor in- self?.onNewChat?()+ guard let self, self.allowsCommandNotchActions else { return }+ self.onNewChat?()// Refresh recent chats in notch stateNotchContentState.shared.refreshRecentChats()}},onSwitchChat: { [weak self] chatID inTask { @MainActor in- self?.onSwitchChat?(chatID)+ guard let self, self.allowsCommandNotchActions else { return }+ self.onSwitchChat?(chatID)// Refresh recent chats in notch stateNotchContentState.shared.refreshRecentChats()}},onClearChat: { [weak self] inTask { @MainActor in- self?.onClearChat?()+ guard let self, self.allowsCommandNotchActions else { return }+ self.onClearChat?()}})@@ -463,12 +500,59 @@ final class NotchOverlayManager {func toggleExpandedCommandOutput() {if self.isCommandOutputExpanded {self.hideExpandedCommandOutput()- } else if NotchContentState.shared.commandConversationHistory.isEmpty == false {+ } else if self.canShowExpandedCommandOutput,+ NotchContentState.shared.commandConversationHistory.isEmpty == false+ {// Only show if there's history to showself.showExpandedCommandOutput()}}+ var canShowExpandedCommandOutput: Bool {+ self.refreshNotchPresentationPolicy()+ return self.currentNotchPresentationPolicy.allowsExpandedCommandOutput+ }++ var canHandleNotchCommandTap: Bool {+ self.refreshNotchPresentationPolicy()+ return self.currentNotchPresentationPolicy.allowsCommandExpansion &&+ self.currentNotchPresentationPolicy.allowsCommandActions+ }++ var allowsCommandNotchActions: Bool {+ self.refreshNotchPresentationPolicy()+ return self.currentNotchPresentationPolicy.allowsCommandActions+ }++ var supportsCommandNotchUI: Bool {+ self.refreshNotchPresentationPolicy()+ return self.currentNotchPresentationPolicy.allowsCommandExpansion ||+ self.currentNotchPresentationPolicy.allowsExpandedCommandOutput ||+ self.currentNotchPresentationPolicy.allowsCommandActions+ }++ var shouldShowOrTrackLivePreviewText: Bool {+ guard SettingsStore.shared.enableStreamingPreview else { return false }+ if SettingsStore.shared.overlayPosition == .bottom {+ return true+ }++ self.refreshNotchPresentationPolicy()+ return self.currentNotchPresentationPolicy.showsStreamingPreview+ }++ var shouldSyncCommandConversationToNotch: Bool {+ guard self.enableNotchFeatures else { return false }++ self.refreshNotchPresentationPolicy()+ return self.currentNotchPresentationPolicy.allowsExpandedCommandOutput ||+ self.currentNotchPresentationPolicy.allowsCommandActions+ }++ private var enableNotchFeatures: Bool {+ SettingsStore.shared.overlayPosition == .top || self.supportsCommandNotchUI+ }+/// Check if any notch (regular or expanded) is visiblevar isAnyNotchVisible: Bool {return self.state == .visible || self.state == .showing || self.isCommandOutputExpanded@@ -479,4 +563,41 @@ final class NotchOverlayManager {self.lastAudioPublisher = publisherself.currentAudioPublisher = publisher}++ private func refreshNotchPresentationPolicy() {+ let mode = SettingsStore.shared.notchPresentationMode+ self.currentNotchPresentationMode = mode+ self.currentNotchPresentationPolicy = .forMode(mode)+ }+}++private extension NotchOverlayManager.NotchPresentationPolicy {+ static let standard = Self(+ usesCompactPresentation: false,+ showsPromptSelector: true,+ showsStreamingPreview: true,+ showsModeLabel: true,+ allowsCommandExpansion: true,+ allowsCommandActions: true,+ allowsExpandedCommandOutput: true+ )++ static let minimal = Self(+ usesCompactPresentation: true,+ showsPromptSelector: false,+ showsStreamingPreview: false,+ showsModeLabel: true,+ allowsCommandExpansion: false,+ allowsCommandActions: false,+ allowsExpandedCommandOutput: false+ )++ static func forMode(_ mode: SettingsStore.NotchPresentationMode) -> Self {+ switch mode {+ case .standard:+ return .standard+ case .minimal:+ return .minimal+ }+ }}diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swiftindex a5a8e76d..5ca5ae60 100644--- a/Sources/Fluid/Views/NotchContentViews.swift+++ b/Sources/Fluid/Views/NotchContentViews.swift@@ -286,6 +286,10 @@ struct NotchExpandedView: View {self.contentState.mode.notchColor}+ private var presentationPolicy: NotchOverlayManager.NotchPresentationPolicy {+ NotchOverlayManager.shared.currentNotchPresentationPolicy+ }+private var modeLabel: String {switch self.contentState.mode {case .dictation: return "Dictate"@@ -315,7 +319,10 @@ struct NotchExpandedView: View {/// Check if there's command history that can be expandedprivate var canExpandCommandHistory: Bool {- self.contentState.mode == .command && !self.contentState.commandConversationHistory.isEmpty+ self.presentationPolicy.allowsCommandExpansion &&+ self.presentationPolicy.allowsCommandActions &&+ self.contentState.mode == .command &&+ !self.contentState.commandConversationHistory.isEmpty}private var normalizedOverlayMode: OverlayMode {@@ -532,21 +539,23 @@ struct NotchExpandedView: View {.frame(width: 80, height: 22)// Mode label - shimmer effect when processing- if self.contentState.isProcessing {- ShimmerText(text: self.processingStatusText, color: self.modeColor)- } else {- Text(self.modeLabel)- .font(.system(size: 9, weight: .medium))- .foregroundStyle(self.modeColor)- .opacity(0.9)- .onHover { hovering in- self.handlePromptHover(hovering)- }+ if self.presentationPolicy.showsModeLabel {+ if self.contentState.isProcessing {+ ShimmerText(text: self.processingStatusText, color: self.modeColor)+ } else {+ Text(self.modeLabel)+ .font(.system(size: 9, weight: .medium))+ .foregroundStyle(self.modeColor)+ .opacity(0.9)+ .onHover { hovering in+ self.handlePromptHover(hovering)+ }+ }}}// Prompt selector- if !self.contentState.isProcessing {+ if self.presentationPolicy.showsPromptSelector && !self.contentState.isProcessing {ZStack(alignment: .top) {HStack(spacing: 6) {Text("AI Prompt:")@@ -593,7 +602,7 @@ struct NotchExpandedView: View {}// Transcription preview (wrapped, fixed width)- if self.hasTranscription && !self.contentState.isProcessing {+ if self.presentationPolicy.showsStreamingPreview && self.hasTranscription && !self.contentState.isProcessing {let previewText = self.contentState.cachedPreviewTextif !previewText.isEmpty {ScrollViewReader { proxy in@@ -632,7 +641,7 @@ struct NotchExpandedView: View {.contentShape(Rectangle()) // Make entire area tappable.onTapGesture {// If in command mode with history, clicking expands the conversation- if self.canExpandCommandHistory {+ if self.canExpandCommandHistory && NotchOverlayManager.shared.canHandleNotchCommandTap {NotchOverlayManager.shared.onNotchClicked?()}}