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

fixed small isuses with notch - modified thinking animation and other bug fixes

altic-dev306a6cc29346
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 9ed03e8f..e82f829b 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -517,7 +517,7 @@ struct ContentView: View {
}
NavigationLink(value: SidebarItem.rewriteMode) {
- Label("Rewrite Mode", systemImage: "pencil.and.outline")
+ Label("Write Mode", systemImage: "pencil.and.outline")
.font(.system(size: 15, weight: .medium))
}
@@ -2296,7 +2296,14 @@ struct ContentView: View {
if shouldUseAI {
DebugLogger.shared.debug("Routing transcription through AI post-processing", source: "ContentView")
+
+ // Show processing animation in notch
+ menuBarManager.setProcessing(true)
+
finalText = await processTextWithAI(transcribedText)
+
+ // Hide processing animation
+ menuBarManager.setProcessing(false)
} else {
finalText = transcribedText
}
@@ -2330,11 +2337,17 @@ struct ContentView: View {
let hasOriginalText = !rewriteModeService.originalText.isEmpty
DebugLogger.shared.info("Processing \(hasOriginalText ? "rewrite" : "write/improve") - instruction: '\(instruction)', originalText length: \(rewriteModeService.originalText.count)", source: "ContentView")
+ // Show processing animation
+ menuBarManager.setProcessing(true)
+
// Process the request - service handles both cases:
// - With originalText: rewrites existing text based on instruction
// - Without originalText: improves/refines the spoken text
await rewriteModeService.processRewriteRequest(instruction)
+ // Hide processing animation
+ menuBarManager.setProcessing(false)
+
// If rewrite was successful, type the result
if !rewriteModeService.rewrittenText.isEmpty {
DebugLogger.shared.info("Rewrite successful, typing result (chars: \(rewriteModeService.rewrittenText.count))", source: "ContentView")
@@ -2358,10 +2371,16 @@ struct ContentView: View {
private func processCommandWithVoice(_ command: String) async {
DebugLogger.shared.info("Processing voice command: '\(command)'", source: "ContentView")
+ // Show processing animation
+ menuBarManager.setProcessing(true)
+
// Process the command through CommandModeService
// This stores the conversation history and executes any terminal commands
await commandModeService.processUserCommand(command)
+ // Hide processing animation
+ menuBarManager.setProcessing(false)
+
DebugLogger.shared.info("Command processed, conversation stored in Command Mode", source: "ContentView")
}
diff --git a/Sources/Fluid/Services/MenuBarManager.swift b/Sources/Fluid/Services/MenuBarManager.swift
index 6a0908ca..c250d55d 100644
--- a/Sources/Fluid/Services/MenuBarManager.swift
+++ b/Sources/Fluid/Services/MenuBarManager.swift
@@ -140,6 +140,26 @@ final class MenuBarManager: ObservableObject {
NotchOverlayManager.shared.setMode(mode)
}
+ func setProcessing(_ processing: Bool) {
+ if processing {
+ // Cancel any pending hide - we want to keep the overlay visible for AI processing
+ pendingHideOperation?.cancel()
+ pendingHideOperation = nil
+ overlayVisible = true
+ } else {
+ // When processing ends, schedule the hide
+ overlayVisible = false
+ let hideItem = DispatchWorkItem { [weak self] in
+ guard let self = self, !self.overlayVisible else { return }
+ NotchOverlayManager.shared.hide()
+ self.pendingHideOperation = nil
+ }
+ pendingHideOperation = hideItem
+ DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100), execute: hideItem)
+ }
+ NotchOverlayManager.shared.setProcessing(processing)
+ }
+
private func setupMenuBarSafely() {
// Check if window server connection is available
guard NSApp.isActive || NSApp.isRunning else {
diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swift
index a88fd46c..8c91d1e9 100644
--- a/Sources/Fluid/Services/NotchOverlayManager.swift
+++ b/Sources/Fluid/Services/NotchOverlayManager.swift
@@ -25,6 +25,9 @@ final class NotchOverlayManager {
private var notch: DynamicNotch<NotchExpandedView, NotchCompactLeadingView, NotchCompactTrailingView>?
private var currentMode: OverlayMode = .dictation
+ // Store last audio publisher for re-showing during processing
+ private var lastAudioPublisher: AnyPublisher<CGFloat, Never>?
+
// State machine to prevent race conditions
private enum State {
case idle
@@ -79,6 +82,9 @@ final class NotchOverlayManager {
private func showInternal(audioLevelPublisher: AnyPublisher<CGFloat, Never>, mode: OverlayMode) {
guard state == .idle else { return }
+ // Store for potential re-show during processing
+ lastAudioPublisher = audioLevelPublisher
+
// Increment generation for this operation
generation &+= 1
let currentGeneration = generation
@@ -118,6 +124,9 @@ final class NotchOverlayManager {
pendingRetryTask?.cancel()
pendingRetryTask = nil
+ // Safety: reset processing state when hiding
+ NotchContentState.shared.setProcessing(false)
+
// Increment generation to invalidate any pending show tasks
generation &+= 1
let currentGeneration = generation
@@ -163,5 +172,18 @@ final class NotchOverlayManager {
func updateTranscriptionText(_ text: String) {
NotchContentState.shared.updateTranscription(text)
}
+
+ func setProcessing(_ processing: Bool) {
+ NotchContentState.shared.setProcessing(processing)
+
+ if processing {
+ // If notch isn't visible, re-show it for processing state
+ if state == .idle || state == .hiding {
+ // Use stored publisher or create empty one
+ let publisher = lastAudioPublisher ?? Empty<CGFloat, Never>().eraseToAnyPublisher()
+ show(audioLevelPublisher: publisher, mode: currentMode)
+ }
+ }
+ }
}
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index bf6f6d81..98b11e8e 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -448,16 +448,16 @@ struct SettingsView: View {
Divider()
.padding(.vertical, 2)
- // Rewrite Mode Shortcut
+ // Write Mode Shortcut
shortcutRow(
icon: "pencil.and.outline",
iconColor: .secondary,
- title: "Rewrite Mode",
- description: "Select text and speak how to rewrite",
+ title: "Write Mode",
+ description: "Select text and speak how to rewrite, or write new content",
shortcut: rewriteShortcut,
isRecording: isRecordingRewriteShortcut,
onChangePressed: {
- DebugLogger.shared.debug("Starting to record new rewrite shortcut", source: "SettingsView")
+ DebugLogger.shared.debug("Starting to record new write mode shortcut", source: "SettingsView")
isRecordingRewriteShortcut = true
}
)
diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swift
index bcac3297..66775d89 100644
--- a/Sources/Fluid/Views/NotchContentViews.swift
+++ b/Sources/Fluid/Views/NotchContentViews.swift
@@ -16,6 +16,7 @@ class NotchContentState: ObservableObject {
@Published var transcriptionText: String = ""
@Published var mode: OverlayMode = .dictation
+ @Published var isProcessing: Bool = false // AI processing state
// Cached transcription lines to avoid recomputing on every render
@Published private(set) var cachedLine1: String = ""
@@ -23,6 +24,11 @@ class NotchContentState: ObservableObject {
private init() {}
+ /// Set AI processing state
+ func setProcessing(_ processing: Bool) {
+ isProcessing = processing
+ }
+
/// Update transcription and recompute cached lines
func updateTranscription(_ text: String) {
guard text != transcriptionText else { return }
@@ -78,6 +84,38 @@ extension OverlayMode {
}
}
+// MARK: - Shimmer Text (Cursor-style thinking animation)
+
+struct ShimmerText: View {
+ let text: String
+ let color: Color
+
+ @State private var shimmerPhase: CGFloat = 0
+
+ var body: some View {
+ Text(text)
+ .font(.system(size: 9, weight: .medium))
+ .foregroundStyle(
+ LinearGradient(
+ colors: [
+ color.opacity(0.4),
+ color.opacity(0.4),
+ color.opacity(1.0),
+ color.opacity(0.4),
+ color.opacity(0.4)
+ ],
+ startPoint: UnitPoint(x: shimmerPhase - 0.3, y: 0.5),
+ endPoint: UnitPoint(x: shimmerPhase + 0.3, y: 0.5)
+ )
+ )
+ .onAppear {
+ withAnimation(.linear(duration: 1.2).repeatForever(autoreverses: false)) {
+ shimmerPhase = 1.3
+ }
+ }
+ }
+}
+
// MARK: - Expanded View (Main Content) - Minimal Design
struct NotchExpandedView: View {
@@ -91,12 +129,21 @@ struct NotchExpandedView: View {
private var modeLabel: String {
switch contentState.mode {
case .dictation: return "Dictate"
- case .rewrite: return "Rewrite"
+ case .rewrite: return "Write"
case .write: return "Write"
case .command: return "Command"
}
}
+ private var processingLabel: String {
+ switch contentState.mode {
+ case .dictation: return "Refining..."
+ case .rewrite: return "Thinking..."
+ case .write: return "Thinking..."
+ case .command: return "Working..."
+ }
+ }
+
private var hasTranscription: Bool {
!contentState.transcriptionText.isEmpty
}
@@ -105,18 +152,25 @@ struct NotchExpandedView: View {
VStack(spacing: 4) {
// Visualization + Mode label row
HStack(spacing: 6) {
- NotchWaveformView(audioPublisher: audioPublisher, color: modeColor)
- .frame(width: 80, height: 22)
+ NotchWaveformView(
+ audioPublisher: audioPublisher,
+ color: modeColor
+ )
+ .frame(width: 80, height: 22)
- // Mode label
- Text(modeLabel)
- .font(.system(size: 9, weight: .medium))
- .foregroundStyle(modeColor)
- .opacity(0.9)
+ // Mode label - shimmer effect when processing
+ if contentState.isProcessing {
+ ShimmerText(text: processingLabel, color: modeColor)
+ } else {
+ Text(modeLabel)
+ .font(.system(size: 9, weight: .medium))
+ .foregroundStyle(modeColor)
+ .opacity(0.9)
+ }
}
// Transcription preview (single line, minimal)
- if hasTranscription {
+ if hasTranscription && !contentState.isProcessing {
Text(contentState.cachedLine2)
.font(.system(size: 10, weight: .medium))
.foregroundStyle(.white.opacity(0.75))
@@ -131,6 +185,7 @@ struct NotchExpandedView: View {
.background(Color.black)
.animation(.spring(response: 0.25, dampingFraction: 0.8), value: hasTranscription)
.animation(.easeInOut(duration: 0.2), value: contentState.mode)
+ .animation(.easeInOut(duration: 0.25), value: contentState.isProcessing)
}
}
@@ -141,7 +196,11 @@ struct NotchWaveformView: View {
let color: Color
@StateObject private var data: AudioVisualizationData
+ @ObservedObject private var contentState = NotchContentState.shared
@State private var barHeights: [CGFloat] = Array(repeating: 3, count: 7)
+ @State private var glowPhase: CGFloat = 0 // 0 to 1, controls glow intensity
+ @State private var glowTimer: Timer? = nil
+ @State private var noiseThreshold: CGFloat = CGFloat(SettingsStore.shared.visualizerNoiseThreshold)
private let barCount = 7
private let barWidth: CGFloat = 3
@@ -149,7 +208,20 @@ struct NotchWaveformView: View {
private let minHeight: CGFloat = 3
private let maxHeight: CGFloat = 20
- init(audioPublisher: AnyPublisher<CGFloat, Never>, color: Color) {
+ // Computed glow values based on phase (sine wave for smooth pulsing)
+ private var currentGlowIntensity: CGFloat {
+ contentState.isProcessing ? 0.4 + 0.4 * sin(glowPhase * .pi * 2) : 0.4
+ }
+
+ private var currentGlowRadius: CGFloat {
+ contentState.isProcessing ? 2 + 4 * sin(glowPhase * .pi * 2) : 2
+ }
+
+ private var currentOuterGlowRadius: CGFloat {
+ contentState.isProcessing ? 6 * sin(glowPhase * .pi * 2) : 0
+ }
+
+ init(audioPublisher: AnyPublisher<CGFloat, Never>, color: Color, isProcessing: Bool = false) {
self.audioPublisher = audioPublisher
self.color = color
self._data = StateObject(wrappedValue: AudioVisualizationData(audioLevelPublisher: audioPublisher))
@@ -161,21 +233,78 @@ struct NotchWaveformView: View {
RoundedRectangle(cornerRadius: barWidth / 2)
.fill(color)
.frame(width: barWidth, height: barHeights[index])
- .shadow(color: color.opacity(0.4), radius: 2, x: 0, y: 0)
+ .shadow(color: color.opacity(currentGlowIntensity), radius: currentGlowRadius, x: 0, y: 0)
+ .shadow(color: color.opacity(currentGlowIntensity * 0.5), radius: currentOuterGlowRadius, x: 0, y: 0)
}
}
.onChange(of: data.audioLevel) { level in
- updateBars(level: level)
+ if !contentState.isProcessing {
+ updateBars(level: level)
+ }
+ }
+ .onChange(of: contentState.isProcessing) { processing in
+ if processing {
+ setStaticProcessingBars()
+ startGlowAnimation()
+ } else {
+ stopGlowAnimation()
+ }
}
.onAppear {
- // Initialize with idle animation
- updateBars(level: 0)
+ if contentState.isProcessing {
+ setStaticProcessingBars()
+ startGlowAnimation()
+ } else {
+ updateBars(level: 0)
+ }
+ }
+ .onDisappear {
+ stopGlowAnimation()
+ }
+ .onReceive(NotificationCenter.default.publisher(for: UserDefaults.didChangeNotification)) { _ in
+ // Update threshold when user changes sensitivity setting
+ let newThreshold = CGFloat(SettingsStore.shared.visualizerNoiseThreshold)
+ if newThreshold != noiseThreshold {
+ noiseThreshold = newThreshold
+ }
+ }
+ }
+
+ private func startGlowAnimation() {
+ stopGlowAnimation() // Clean up any existing timer
+ glowPhase = 0
+
+ // Timer-based animation for explicit control
+ glowTimer = Timer.scheduledTimer(withTimeInterval: 1.0 / 30.0, repeats: true) { _ in
+ withAnimation(.linear(duration: 1.0 / 30.0)) {
+ glowPhase += 1.0 / 30.0 / 1.5 // Complete cycle in 1.5 seconds
+ if glowPhase >= 1.0 {
+ glowPhase = 0
+ }
+ }
+ }
+ }
+
+ private func stopGlowAnimation() {
+ glowTimer?.invalidate()
+ glowTimer = nil
+ glowPhase = 0
+ }
+
+ private func setStaticProcessingBars() {
+ // Set bars to a nice static shape (taller in center)
+ withAnimation(.easeInOut(duration: 0.3)) {
+ for i in 0..<barCount {
+ let centerDistance = abs(CGFloat(i) - CGFloat(barCount - 1) / 2)
+ let centerFactor = 1.0 - (centerDistance / CGFloat(barCount / 2)) * 0.4
+ barHeights[i] = minHeight + (maxHeight - minHeight) * 0.5 * centerFactor
+ }
}
}
private func updateBars(level: CGFloat) {
let normalizedLevel = min(max(level, 0), 1)
- let isActive = normalizedLevel > 0.02
+ let isActive = normalizedLevel > noiseThreshold // Use user's sensitivity setting
withAnimation(.spring(response: 0.15, dampingFraction: 0.6)) {
for i in 0..<barCount {
@@ -183,12 +312,13 @@ struct NotchWaveformView: View {
let centerFactor = 1.0 - (centerDistance / CGFloat(barCount / 2)) * 0.4
if isActive {
+ // Scale audio level relative to threshold for smoother response
+ let adjustedLevel = (normalizedLevel - noiseThreshold) / (1.0 - noiseThreshold)
let randomVariation = CGFloat.random(in: 0.7...1.0)
- barHeights[i] = minHeight + (maxHeight - minHeight) * normalizedLevel * centerFactor * randomVariation
+ barHeights[i] = minHeight + (maxHeight - minHeight) * adjustedLevel * centerFactor * randomVariation
} else {
- // Subtle idle pulse
- let idleVariation = CGFloat.random(in: 0.8...1.2)
- barHeights[i] = minHeight * idleVariation
+ // Complete stillness when below threshold
+ barHeights[i] = minHeight
}
}
}
diff --git a/Sources/Fluid/Views/RewriteModeView.swift b/Sources/Fluid/Views/RewriteModeView.swift
index b3fd2b7e..b24491be 100644
--- a/Sources/Fluid/Views/RewriteModeView.swift
+++ b/Sources/Fluid/Views/RewriteModeView.swift
@@ -16,7 +16,7 @@ struct RewriteModeView: View {
Image(systemName: "pencil.and.outline")
.font(.title2)
.foregroundStyle(.blue)
- Text("Rewrite Mode")
+ Text("Write Mode")
.font(.title2)
.fontWeight(.bold)