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
feat: add prompt switching and action chips to top notch overlay
Bezhan9c8b89d4e5af
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex 8a99a537..f33e4762 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -2142,7 +2142,11 @@ struct ContentView: View {}private func setActiveRecordingMode(_ mode: ActiveRecordingMode) {- if mode != .promptMode { self.promptModeOverrideText = nil; NotchContentState.shared.promptModeOverrideProfileName = nil }+ if mode != .promptMode {+ self.promptModeOverrideText = nil+ NotchContentState.shared.promptModeOverrideProfileName = nil+ NotchContentState.shared.promptModeOverrideProfileID = nil+ }self.activeRecordingMode = modeswitch mode {case .none, .dictate, .promptMode:@@ -2448,6 +2452,22 @@ struct ContentView: View {NotchContentState.shared.onOpenPreferencesRequested = {self.menuBarManager.openPreferencesFromUI()}+ NotchContentState.shared.onPromptModeProfileChangeRequested = { profile in+ if let p = profile {+ self.promptModeOverrideText = SettingsStore.combineBasePrompt(+ for: .dictate,+ with: SettingsStore.stripBasePrompt(for: .dictate, from: p.prompt)+ )+ NotchContentState.shared.promptModeOverrideProfileName = p.name+ NotchContentState.shared.promptModeOverrideProfileID = p.id+ SettingsStore.shared.promptModeSelectedPromptID = p.id+ } else {+ self.promptModeOverrideText = nil+ NotchContentState.shared.promptModeOverrideProfileName = nil+ NotchContentState.shared.promptModeOverrideProfileID = nil+ SettingsStore.shared.promptModeSelectedPromptID = nil+ }+ }guard self.hotkeyManager == nil else { return }@@ -2499,6 +2519,7 @@ struct ContentView: View {{self.promptModeOverrideText = SettingsStore.combineBasePrompt(for: .dictate, with: SettingsStore.stripBasePrompt(for: .dictate, from: profile.prompt))NotchContentState.shared.promptModeOverrideProfileName = profile.name+ NotchContentState.shared.promptModeOverrideProfileID = profile.id}self.setActiveRecordingMode(.promptMode)diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swiftindex 5f0c355d..68dabe99 100644--- a/Sources/Fluid/Services/NotchOverlayManager.swift+++ b/Sources/Fluid/Services/NotchOverlayManager.swift@@ -32,13 +32,13 @@ final class NotchOverlayManager {>?private var currentMode: OverlayMode = .dictation- // Store last audio publisher for re-showing during processing+ /// Store last audio publisher for re-showing during processingprivate var lastAudioPublisher: AnyPublisher<CGFloat, Never>?- // Current audio publisher (can be updated for expanded notch recording)+ /// Current audio publisher (can be updated for expanded notch recording)@Published private(set) var currentAudioPublisher: AnyPublisher<CGFloat, Never>?- // State machine to prevent race conditions+ /// State machine to prevent race conditionsprivate enum State {case idlecase showing@@ -49,10 +49,10 @@ final class NotchOverlayManager {private var state: State = .idleprivate var commandOutputState: State = .idle- // Track if expanded command output is showing+ /// Track if expanded command output is showingprivate(set) var isCommandOutputExpanded: Bool = false- // Track if bottom overlay is visible+ /// Track if bottom overlay is visibleprivate(set) var isBottomOverlayVisible: Bool = false// Callbacks for command output interaction@@ -70,7 +70,7 @@ final class NotchOverlayManager {private var generation: UInt64 = 0private var commandOutputGeneration: UInt64 = 0- // Track pending retry task for cancellation+ /// Track pending retry task for cancellationprivate var pendingRetryTask: Task<Void, Never>?// Escape key monitors for dismissing notchdiff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swiftindex ad266709..372e3cc5 100644--- a/Sources/Fluid/Views/NotchContentViews.swift+++ b/Sources/Fluid/Views/NotchContentViews.swift@@ -21,6 +21,10 @@ class NotchContentState: ObservableObject {@Published var promptPickerMode: SettingsStore.PromptMode = .dictate@Published var isProcessing: Bool = false // AI processing state@Published var promptModeOverrideProfileName: String? = nil // Name shown in overlay when prompt mode hotkey is active+ @Published var promptModeOverrideProfileID: String? = nil // ID of the active override profile (for checkmark in menu)++ /// Called when the user picks a different prompt from the overlay during prompt mode recording.+ var onPromptModeProfileChangeRequested: ((SettingsStore.DictationPromptProfile?) -> Void)?/// Icon of the target app (where text will be typed)@Published var targetAppIcon: NSImage?@@ -272,9 +276,12 @@ struct NotchExpandedView: View {@ObservedObject private var contentState = NotchContentState.shared@ObservedObject private var settings = SettingsStore.shared@ObservedObject private var activeAppMonitor = ActiveAppMonitor.shared+ @ObservedObject private var historyStore = TranscriptionHistoryStore.shared@Environment(\.theme) private var theme@State private var showPromptHoverMenu = false@State private var promptHoverWorkItem: DispatchWorkItem?+ @State private var showActionsMenu = false+ @State private var showModeMenu = falseprivate var modeColor: Color {self.contentState.mode.notchColor@@ -373,6 +380,119 @@ struct NotchExpandedView: View {180}+ private var hasHistory: Bool {+ !self.historyStore.entries.isEmpty+ }++ private var canReprocess: Bool {+ self.hasHistory && !self.contentState.isProcessing+ }++ private var actionsMenuContent: some View {+ VStack(alignment: .leading, spacing: 0) {+ Button(action: {+ self.showActionsMenu = false+ self.contentState.onReprocessLastRequested?()+ }) {+ HStack(spacing: 6) {+ Text("Reprocess Last")+ Spacer()+ Image(systemName: "arrow.clockwise")+ .font(.system(size: 9, weight: .semibold))+ }+ }+ .buttonStyle(.plain)+ .padding(.vertical, 4)+ .disabled(!self.canReprocess)+ .opacity(self.canReprocess ? 1 : 0.4)++ Button(action: {+ self.showActionsMenu = false+ self.contentState.onCopyLastRequested?()+ }) {+ HStack(spacing: 6) {+ Text("Copy Last")+ Spacer()+ Image(systemName: "doc.on.doc")+ .font(.system(size: 9, weight: .semibold))+ }+ }+ .buttonStyle(.plain)+ .padding(.vertical, 4)+ .disabled(!self.hasHistory)+ .opacity(self.hasHistory ? 1 : 0.4)++ Divider().padding(.vertical, 2)++ Button(action: {+ self.showActionsMenu = false+ self.contentState.onUndoLastAIRequested?()+ }) {+ HStack(spacing: 6) {+ Text("Undo AI")+ Spacer()+ Image(systemName: "arrow.uturn.backward")+ .font(.system(size: 9, weight: .semibold))+ }+ }+ .buttonStyle(.plain)+ .padding(.vertical, 4)+ .disabled(!self.hasHistory)+ .opacity(self.hasHistory ? 1 : 0.4)+ }+ .font(.system(size: 9, weight: .medium))+ .foregroundStyle(.white)+ .padding(.horizontal, 8)+ .padding(.vertical, 6)+ .background(Color.black)+ .cornerRadius(8)+ .overlay(+ RoundedRectangle(cornerRadius: 8)+ .stroke(Color.white.opacity(0.12), lineWidth: 1)+ )+ }++ private var normalizedMode: OverlayMode {+ switch self.contentState.mode {+ case .dictation: return .dictation+ case .edit, .write, .rewrite: return .edit+ case .command: return .command+ }+ }++ private var modeModeContent: some View {+ VStack(alignment: .leading, spacing: 0) {+ ForEach([OverlayMode.dictation, .edit], id: \.self) { mode in+ let isSelected = self.normalizedMode == mode+ Button(action: {+ self.showModeMenu = false+ self.contentState.onOverlayModeSwitchRequested?(mode)+ }) {+ HStack(spacing: 6) {+ Text(mode == .dictation ? "Dictate" : "Edit")+ Spacer()+ if isSelected {+ Image(systemName: "checkmark")+ .font(.system(size: 9, weight: .semibold))+ }+ }+ }+ .buttonStyle(.plain)+ .padding(.vertical, 4)+ }+ }+ .font(.system(size: 9, weight: .medium))+ .foregroundStyle(.white)+ .padding(.horizontal, 8)+ .padding(.vertical, 6)+ .background(Color.black)+ .cornerRadius(8)+ .overlay(+ RoundedRectangle(cornerRadius: 8)+ .stroke(Color.white.opacity(0.12), lineWidth: 1)+ )+ }+private func handlePromptHover(_ hovering: Bool) {guard self.isPromptSelectableMode, !self.contentState.isProcessing else {self.showPromptHoverMenu = false@@ -388,10 +508,16 @@ struct NotchExpandedView: View {private func promptMenuContent() -> some View {let promptMode = self.activePromptMode ?? .dictate+ // During prompt mode recording, selections update the live override instead of the global prompt.+ let isInPromptMode = self.contentState.promptModeOverrideProfileName != nilreturn VStack(alignment: .leading, spacing: 0) {Button(action: {- self.settings.setSelectedPromptID(nil, for: promptMode)+ if isInPromptMode {+ self.contentState.onPromptModeProfileChangeRequested?(nil)+ } else {+ self.settings.setSelectedPromptID(nil, for: promptMode)+ }let pid = NotchContentState.shared.recordingTargetPIDDispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {if let pid { _ = TypingService.activateApp(pid: pid) }@@ -401,7 +527,10 @@ struct NotchExpandedView: View {HStack {Text("Default")Spacer()- if self.settings.selectedPromptID(for: promptMode) == nil {+ let isSelected = isInPromptMode+ ? (self.contentState.promptModeOverrideProfileID == nil)+ : (self.settings.selectedPromptID(for: promptMode) == nil)+ if isSelected {Image(systemName: "checkmark").font(.system(size: 10, weight: .semibold))}@@ -416,7 +545,11 @@ struct NotchExpandedView: View {ForEach(self.settings.promptProfiles(for: promptMode)) { profile inButton(action: {- self.settings.setSelectedPromptID(profile.id, for: promptMode)+ if isInPromptMode {+ self.contentState.onPromptModeProfileChangeRequested?(profile)+ } else {+ self.settings.setSelectedPromptID(profile.id, for: promptMode)+ }let pid = NotchContentState.shared.recordingTargetPIDDispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {if let pid { _ = TypingService.activateApp(pid: pid) }@@ -426,7 +559,10 @@ struct NotchExpandedView: View {HStack {Text(profile.name.isEmpty ? "Untitled" : profile.name)Spacer()- if self.settings.selectedPromptID(for: promptMode) == profile.id {+ let isSelected = isInPromptMode+ ? (self.contentState.promptModeOverrideProfileID == profile.id)+ : (self.settings.selectedPromptID(for: promptMode) == profile.id)+ if isSelected {Image(systemName: "checkmark").font(.system(size: 10, weight: .semibold))}@@ -437,8 +573,10 @@ struct NotchExpandedView: View {}}}+ .font(.system(size: 9, weight: .medium)).padding(.horizontal, 8).padding(.vertical, 6)+ .foregroundStyle(.white).background(Color.black).cornerRadius(8).overlay(@@ -514,8 +652,11 @@ struct NotchExpandedView: View {.background(Color.white.opacity(0.00)).cornerRadius(6).opacity(self.isPromptSelectableMode ? 1.0 : 0.6)- .onHover { hovering in- self.handlePromptHover(hovering)+ .onTapGesture {+ guard self.isPromptSelectableMode, !self.contentState.isProcessing else { return }+ self.showActionsMenu = false+ self.showModeMenu = false+ self.showPromptHoverMenu.toggle()}if self.showPromptHoverMenu {@@ -529,6 +670,97 @@ struct NotchExpandedView: View {.transition(.opacity)}+ // Mode + AI + Actions chips row+ if !self.contentState.isProcessing {+ HStack(spacing: 6) {+ // Mode chip+ HStack(spacing: 4) {+ Text(self.normalizedMode == .dictation ? "Dictate" : "Edit")+ .font(.system(size: 9, weight: .semibold))+ .foregroundStyle(.white.opacity(0.75))+ Image(systemName: "chevron.up")+ .font(.system(size: 7, weight: .semibold))+ .foregroundStyle(.white.opacity(0.45))+ }+ .padding(.horizontal, 6)+ .padding(.vertical, 3)+ .background(Color.white.opacity(0.07))+ .cornerRadius(5)+ .onTapGesture {+ guard !self.contentState.isProcessing, self.normalizedMode != .command else { return }+ self.showPromptHoverMenu = false+ self.showActionsMenu = false+ self.showModeMenu.toggle()+ }++ // AI toggle chip+ let aiEnabled = self.settings.enableAIProcessing+ HStack(spacing: 4) {+ Text("AI:")+ .font(.system(size: 9, weight: .medium))+ .foregroundStyle(.white.opacity(0.5))+ Text(aiEnabled ? "On" : "Off")+ .font(.system(size: 9, weight: .semibold))+ .foregroundStyle(aiEnabled ? .white.opacity(0.82) : .white.opacity(0.55))+ Image(systemName: aiEnabled ? "brain.fill" : "brain")+ .font(.system(size: 8, weight: .semibold))+ .foregroundStyle(aiEnabled ? .white.opacity(0.65) : .white.opacity(0.4))+ }+ .padding(.horizontal, 6)+ .padding(.vertical, 3)+ .background(Color.white.opacity(0.07))+ .cornerRadius(5)+ .onTapGesture {+ guard !self.contentState.isProcessing else { return }+ self.showActionsMenu = false+ self.showPromptHoverMenu = false+ self.showModeMenu = false+ self.contentState.onToggleAIProcessingRequested?()+ }++ // Actions chip+ HStack(spacing: 4) {+ Text("Actions")+ .font(.system(size: 9, weight: .medium))+ .foregroundStyle(.white.opacity(self.hasHistory ? 0.75 : 0.35))+ Image(systemName: "chevron.up")+ .font(.system(size: 7, weight: .semibold))+ .foregroundStyle(.white.opacity(self.hasHistory ? 0.45 : 0.25))+ }+ .padding(.horizontal, 6)+ .padding(.vertical, 3)+ .background(Color.white.opacity(0.07))+ .cornerRadius(5)+ .opacity(self.hasHistory ? 1 : 0.6)+ .onTapGesture {+ guard self.hasHistory, !self.contentState.isProcessing else { return }+ self.showPromptHoverMenu = false+ self.showModeMenu = false+ self.showActionsMenu.toggle()+ }+ }+ // Menus float above as overlays — don't affect VStack height/width so no layout reflow+ .overlay(alignment: .bottomLeading) {+ if self.showModeMenu {+ self.modeModeContent+ .fixedSize()+ .offset(y: -4)+ .transition(.opacity)+ .zIndex(20)+ }+ }+ .overlay(alignment: .bottomTrailing) {+ if self.showActionsMenu {+ self.actionsMenuContent+ .fixedSize()+ .offset(y: -4)+ .transition(.opacity)+ .zIndex(20)+ }+ }+ .transition(.opacity)+ }+// Transcription preview (wrapped, fixed width)if self.hasTranscription && !self.contentState.isProcessing {let previewText = self.contentState.cachedPreviewText@@ -562,6 +794,7 @@ struct NotchExpandedView: View {}}}+ .frame(width: 216) // Fixed width prevents notch from resizing and causing edge artifacts.padding(.horizontal, 8).padding(.vertical, 6).background(Color.black) // Must be pure black to blend with macOS notch