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

added compact mode for notch mode and UI updates

altic-devbd1040b57694
diff --git a/Fluid.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Fluid.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index 9c4cd8b0..f36740c2 100644
--- a/Fluid.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/Fluid.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -16,7 +16,7 @@
"location" : "https://github.com/altic-dev/DynamicNotchKit.git",
"state" : {
"branch" : "main",
- "revision" : "cd0b3e52d537db115ad3a9d89601f20e0bee8d27"
+ "revision" : "2dfd6f5c2ff38e34fa1f9d67e3a6f949699a34d6"
}
},
{
diff --git a/Package.resolved b/Package.resolved
index 1e2aa041..5d72a513 100644
--- a/Package.resolved
+++ b/Package.resolved
@@ -15,7 +15,7 @@
"location" : "https://github.com/altic-dev/DynamicNotchKit.git",
"state" : {
"branch" : "main",
- "revision" : "cd0b3e52d537db115ad3a9d89601f20e0bee8d27"
+ "revision" : "2dfd6f5c2ff38e34fa1f9d67e3a6f949699a34d6"
}
},
{
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 0a791cc2..a1c6acf9 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -1719,12 +1719,12 @@ struct ContentView: View {
self.clearActiveRecordingMode()
- // Show "Transcribing..." state before calling stop() to keep overlay visible.
+ // Show "Transcribing" state before calling stop() to keep overlay visible.
// The asr.stop() call performs the final transcription which can take a moment
// (especially for slower models like Whisper Medium/Large).
DebugLogger.shared.debug("Showing transcription processing state", source: "ContentView")
self.menuBarManager.setProcessing(true)
- NotchOverlayManager.shared.updateTranscriptionText("Transcribing...")
+ NotchOverlayManager.shared.updateTranscriptionText("Transcribing")
// Give SwiftUI a chance to render the processing state before we do heavier work
// (ASR finalization + optional AI post-processing).
@@ -1814,7 +1814,7 @@ struct ContentView: View {
let postProcessingStart = Date()
// Update overlay text to show we're now refining (processing already true)
- NotchOverlayManager.shared.updateTranscriptionText("Refining...")
+ NotchOverlayManager.shared.updateTranscriptionText("Refining")
// Ensure the status label becomes visible immediately.
await Task.yield()
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index c9c28b41..c9e36727 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -1337,6 +1337,15 @@ final class SettingsStore: ObservableObject {
enum NotchPresentationMode: String, CaseIterable, Codable {
case standard
case minimal
+
+ var displayName: String {
+ switch self {
+ case .standard:
+ return "Standard Notch"
+ case .minimal:
+ return "Compact"
+ }
+ }
}
/// Where the recording overlay appears (default: bottom)
diff --git a/Sources/Fluid/Services/MenuBarManager.swift b/Sources/Fluid/Services/MenuBarManager.swift
index 6d215ef3..0563987b 100644
--- a/Sources/Fluid/Services/MenuBarManager.swift
+++ b/Sources/Fluid/Services/MenuBarManager.swift
@@ -44,6 +44,8 @@ final class MenuBarManager: NSObject, ObservableObject, NSMenuDelegate {
// Track pending overlay operations to prevent spam
private var pendingShowOperation: DispatchWorkItem?
private var pendingHideOperation: DispatchWorkItem?
+ private var pendingProcessingShowOperation: DispatchWorkItem?
+ private let processingVisualDelay: DispatchTimeInterval = .milliseconds(100)
// Subscription for forwarding audio levels to expanded command notch
private var expandedModeAudioSubscription: AnyCancellable?
@@ -212,11 +214,22 @@ final class MenuBarManager: NSObject, ObservableObject, NSMenuDelegate {
self.isProcessingActive = processing
if processing {
+ self.pendingProcessingShowOperation?.cancel()
// Cancel any pending hide - we want to keep the overlay visible for AI processing
self.pendingHideOperation?.cancel()
self.pendingHideOperation = nil
self.overlayVisible = true
+
+ let showItem = DispatchWorkItem { [weak self] in
+ guard let self = self, self.isProcessingActive else { return }
+ NotchOverlayManager.shared.setProcessing(true)
+ self.pendingProcessingShowOperation = nil
+ }
+ self.pendingProcessingShowOperation = showItem
+ DispatchQueue.main.asyncAfter(deadline: .now() + self.processingVisualDelay, execute: showItem)
} else {
+ self.pendingProcessingShowOperation?.cancel()
+ self.pendingProcessingShowOperation = nil
// When processing ends, schedule the hide (unless expanded output is showing)
self.overlayVisible = false
@@ -241,8 +254,9 @@ final class MenuBarManager: NSObject, ObservableObject, NSMenuDelegate {
}
self.pendingHideOperation = hideItem
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(100), execute: hideItem)
+ NotchOverlayManager.shared.setProcessing(false)
+ return
}
- NotchOverlayManager.shared.setProcessing(processing)
}
private func setupMenuBarSafely() {
diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swift
index dca549bc..a7a1772b 100644
--- a/Sources/Fluid/Services/NotchOverlayManager.swift
+++ b/Sources/Fluid/Services/NotchOverlayManager.swift
@@ -34,11 +34,12 @@ final class NotchOverlayManager {
let allowsExpandedCommandOutput: Bool
}
- private var notch: DynamicNotch<NotchExpandedView, NotchCompactLeadingView, NotchCompactTrailingView>?
+ private var notch: DynamicNotch<NotchExpandedView, NotchCompactLeadingView, NotchCompactTrailingView, NotchCompactBottomView>?
private var commandOutputNotch: DynamicNotch<
NotchCommandOutputExpandedView,
NotchCompactLeadingView,
- NotchCompactTrailingView
+ NotchCompactTrailingView,
+ EmptyView
>?
private var currentMode: OverlayMode = .dictation
@@ -90,6 +91,7 @@ final class NotchOverlayManager {
private(set) var currentNotchPresentationMode: SettingsStore.NotchPresentationMode = .standard
private(set) var currentNotchPresentationPolicy = NotchPresentationPolicy.standard
+ private(set) var currentScreenSupportsCompactPresentation = false
private init() {
self.refreshNotchPresentationPolicy()
@@ -203,7 +205,9 @@ final class NotchOverlayManager {
/// Show notch overlay (original behavior)
private func showNotchOverlay(audioLevelPublisher: AnyPublisher<CGFloat, Never>, mode: OverlayMode) {
- self.refreshNotchPresentationPolicy()
+ let targetScreen = self.preferredPresentationScreen()
+ self.refreshNotchPresentationPolicy(for: targetScreen)
+ self.currentAudioPublisher = audioLevelPublisher
// Hide bottom overlay if it was visible
if self.isBottomOverlayVisible {
@@ -225,24 +229,27 @@ final class NotchOverlayManager {
// Create notch with SwiftUI views
let newNotch = DynamicNotch(
- hoverBehavior: [.keepVisible, .hapticFeedback],
+ hoverBehavior: [.keepVisible],
style: .auto
) {
NotchExpandedView(audioPublisher: audioLevelPublisher)
} compactLeading: {
NotchCompactLeadingView()
} compactTrailing: {
- NotchCompactTrailingView()
+ NotchCompactTrailingView(audioPublisher: audioLevelPublisher)
+ } compactBottom: {
+ NotchCompactBottomView()
}
self.notch = newNotch
+ let shouldUseCompactPresentation = self.currentNotchPresentationPolicy.usesCompactPresentation
// Resolve presentation from policy so future notch modes don't require call-site changes.
Task { [weak self] in
- if self?.currentNotchPresentationPolicy.usesCompactPresentation == true {
- await newNotch.compact()
+ if shouldUseCompactPresentation {
+ await newNotch.compact(on: targetScreen)
} else {
- await newNotch.expand()
+ await newNotch.expand(on: targetScreen)
}
// Only update state if we're still the active generation
guard let self = self, self.generation == currentGeneration else { return }
@@ -435,7 +442,9 @@ final class NotchOverlayManager {
} compactLeading: {
NotchCompactLeadingView()
} compactTrailing: {
- NotchCompactTrailingView()
+ NotchCompactTrailingView(audioPublisher: publisher)
+ } compactBottom: {
+ EmptyView()
}
self.commandOutputNotch = newNotch
@@ -564,10 +573,27 @@ final class NotchOverlayManager {
self.currentAudioPublisher = publisher
}
- private func refreshNotchPresentationPolicy() {
+ private func preferredPresentationScreen() -> NSScreen {
+ let mouseLocation = NSEvent.mouseLocation
+ if let screenUnderMouse = NSScreen.screens.first(where: { NSMouseInRect(mouseLocation, $0.frame, false) }) {
+ return screenUnderMouse
+ }
+ return NSScreen.main ?? NSScreen.screens[0]
+ }
+
+ private func supportsCompactPresentation(on screen: NSScreen) -> Bool {
+ screen.auxiliaryTopLeftArea?.width != nil && screen.auxiliaryTopRightArea?.width != nil
+ }
+
+ private func refreshNotchPresentationPolicy(for screen: NSScreen? = nil) {
let mode = SettingsStore.shared.notchPresentationMode
self.currentNotchPresentationMode = mode
- self.currentNotchPresentationPolicy = .forMode(mode)
+ let resolvedScreen = screen ?? self.preferredPresentationScreen()
+ self.currentScreenSupportsCompactPresentation = self.supportsCompactPresentation(on: resolvedScreen)
+ self.currentNotchPresentationPolicy = .forMode(
+ mode,
+ supportsCompactPresentation: self.currentScreenSupportsCompactPresentation
+ )
}
}
@@ -585,19 +611,19 @@ private extension NotchOverlayManager.NotchPresentationPolicy {
static let minimal = Self(
usesCompactPresentation: true,
showsPromptSelector: false,
- showsStreamingPreview: false,
+ showsStreamingPreview: true,
showsModeLabel: true,
allowsCommandExpansion: false,
allowsCommandActions: false,
allowsExpandedCommandOutput: false
)
- static func forMode(_ mode: SettingsStore.NotchPresentationMode) -> Self {
+ static func forMode(_ mode: SettingsStore.NotchPresentationMode, supportsCompactPresentation: Bool) -> Self {
switch mode {
case .standard:
return .standard
case .minimal:
- return .minimal
+ return supportsCompactPresentation ? .minimal : .standard
}
}
}
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index 22d09f88..7837e470 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -1209,22 +1209,24 @@ struct SettingsView: View {
}
}
- // Bottom overlay specific settings (only show when bottom is selected)
- if self.settings.overlayPosition == .bottom {
- Divider().padding(.vertical, 4)
+ Divider().padding(.vertical, 4)
- // Overlay Size
- HStack {
- VStack(alignment: .leading, spacing: 2) {
- Text("Overlay Size")
- .font(.body)
- Text("How large the recording indicator appears")
- .font(.subheadline)
- .foregroundStyle(.secondary)
- }
+ HStack {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(self.settings.overlayPosition == .bottom ? "Overlay Size" : "Notch Style")
+ .font(.body)
+ Text(
+ self.settings.overlayPosition == .bottom
+ ? "How large the recording indicator appears"
+ : "Choose the regular notch or the compact layout"
+ )
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
+ }
- Spacer()
+ Spacer()
+ if self.settings.overlayPosition == .bottom {
Picker("", selection: self.$settings.overlaySize) {
ForEach(SettingsStore.OverlaySize.allCases, id: \.self) { size in
Text(size.displayName).tag(size)
@@ -1232,7 +1234,38 @@ struct SettingsView: View {
}
.pickerStyle(.menu)
.frame(width: 170, alignment: .trailing)
+ } else {
+ Picker("", selection: self.$settings.notchPresentationMode) {
+ ForEach(SettingsStore.NotchPresentationMode.allCases, id: \.self) { mode in
+ Text(mode.displayName).tag(mode)
+ }
+ }
+ .pickerStyle(.menu)
+ .frame(width: 170, alignment: .trailing)
}
+ }
+
+ HStack {
+ VStack(alignment: .leading, spacing: 2) {
+ Text("Live Preview")
+ .font(.body)
+ Text("Show transcription text in the overlay while you speak")
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
+ }
+
+ Spacer()
+
+ Toggle("", isOn: self.$enableStreamingPreview)
+ .labelsHidden()
+ .onChange(of: self.enableStreamingPreview) { _, newValue in
+ SettingsStore.shared.enableStreamingPreview = newValue
+ }
+ }
+
+ // Bottom overlay specific settings (only show when bottom is selected)
+ if self.settings.overlayPosition == .bottom {
+ Divider().padding(.vertical, 4)
// Bottom Offset
HStack {
diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swift
index a95d9b17..74f14213 100644
--- a/Sources/Fluid/Views/NotchContentViews.swift
+++ b/Sources/Fluid/Views/NotchContentViews.swift
@@ -279,8 +279,12 @@ struct NotchExpandedView: View {
@ObservedObject private var settings = SettingsStore.shared
@ObservedObject private var activeAppMonitor = ActiveAppMonitor.shared
@Environment(\.theme) private var theme
+ @State private var isHoveringPromptChip = false
+ @State private var isHoveringPromptMenu = false
+ @State private var hoveredPromptMenuRowID: String?
@State private var showPromptHoverMenu = false
- @State private var promptHoverWorkItem: DispatchWorkItem?
+ @State private var promptHoverGeneration: UInt64 = 0
+ @State private var promptSelectorLeading: CGFloat = 0
private var modeColor: Color {
self.contentState.mode.notchColor
@@ -290,23 +294,19 @@ struct NotchExpandedView: View {
NotchOverlayManager.shared.currentNotchPresentationPolicy
}
- private var modeLabel: String {
- switch self.contentState.mode {
- case .dictation: return "Dictate"
- case .edit, .rewrite, .write: return "Edit"
- case .command: return "Command"
- }
- }
-
private var processingLabel: String {
switch self.contentState.mode {
- case .dictation: return "Refining"
+ case .dictation: return "Transcribing"
case .edit, .rewrite, .write: return "Thinking"
case .command: return "Working"
}
}
private static let transientOverlayStatusTexts: Set<String> = [
+ "Transcribing",
+ "Refining",
+ "Thinking",
+ "Working",
"Transcribing...",
"Refining...",
"Thinking...",
@@ -322,7 +322,13 @@ struct NotchExpandedView: View {
}
private var hasTranscription: Bool {
- !self.contentState.transcriptionText.isEmpty
+ !self.visiblePreviewText.isEmpty
+ }
+
+ private var visiblePreviewText: String {
+ let previewText = self.contentState.cachedPreviewText.trimmingCharacters(in: .whitespacesAndNewlines)
+ guard !Self.transientOverlayStatusTexts.contains(previewText) else { return "" }
+ return previewText
}
/// Check if there's command history that can be expanded
@@ -407,202 +413,311 @@ struct NotchExpandedView: View {
180
}
- private var statusLabelWidth: CGFloat {
- 74
+ private var promptSelectorFixedWidth: CGFloat {
+ 102
+ }
+
+ private var promptMenuWidth: CGFloat {
+ self.promptSelectorFixedWidth
}
+ private var promptMenuRowVerticalPadding: CGFloat {
+ 4
+ }
+
+ private static let notchContentCoordinateSpace = "NotchExpandedContent"
+
private var notchContentWidth: CGFloat {
216
}
- private func handlePromptHover(_ hovering: Bool) {
+ @ViewBuilder
+ private var appIconView: some View {
+ if let appIcon = self.contentState.targetAppIcon ?? self.activeAppMonitor.activeAppIcon {
+ Image(nsImage: appIcon)
+ .resizable()
+ .aspectRatio(contentMode: .fit)
+ .frame(width: 16, height: 16)
+ .clipShape(RoundedRectangle(cornerRadius: 3))
+ }
+ }
+
+ private func updatePromptMenuVisibility() {
guard self.isPromptSelectableMode, !self.contentState.isProcessing else {
- self.showPromptHoverMenu = false
+ self.dismissPromptHoverMenu()
return
}
- self.promptHoverWorkItem?.cancel()
- let task = DispatchWorkItem {
- self.showPromptHoverMenu = hovering
+
+ let shouldShow = self.isHoveringPromptChip || self.isHoveringPromptMenu
+ self.promptHoverGeneration &+= 1
+ let generation = self.promptHoverGeneration
+ let delay = shouldShow ? 0.03 : 0.28
+ DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
+ guard generation == self.promptHoverGeneration else { return }
+ self.showPromptHoverMenu = shouldShow
+ }
+ }
+
+ private func dismissPromptHoverMenu() {
+ self.promptHoverGeneration &+= 1
+ self.isHoveringPromptChip = false
+ self.isHoveringPromptMenu = false
+ self.hoveredPromptMenuRowID = nil
+ self.showPromptHoverMenu = false
+ }
+
+ private func handlePromptChipHover(_ hovering: Bool) {
+ self.isHoveringPromptChip = hovering
+ self.updatePromptMenuVisibility()
+ }
+
+ private func handlePromptMenuHover(_ hovering: Bool) {
+ self.isHoveringPromptMenu = hovering
+ self.updatePromptMenuVisibility()
+ }
+
+ private func restoreRecordingTargetFocus() {
+ let pid = NotchContentState.shared.recordingTargetPID
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
+ if let pid { _ = TypingService.activateApp(pid: pid) }
+ }
+ }
+
+ private func promptMenuRowBackground(isSelected: Bool, rowID: String) -> some View {
+ let isHovered = self.hoveredPromptMenuRowID == rowID
+ let fillColor: Color
+ if isSelected {
+ fillColor = Color.white.opacity(0.18)
+ } else if isHovered {
+ fillColor = Color.white.opacity(0.10)
+ } else {
+ fillColor = .clear
+ }
+
+ let strokeColor: Color
+ if isSelected {
+ strokeColor = Color.white.opacity(0.24)
+ } else if isHovered {
+ strokeColor = Color.white.opacity(0.14)
+ } else {
+ strokeColor = .clear
+ }
+
+ return RoundedRectangle(cornerRadius: 7)
+ .fill(fillColor)
+ .overlay(
+ RoundedRectangle(cornerRadius: 7)
+ .stroke(strokeColor, lineWidth: 1)
+ )
+ }
+
+ @ViewBuilder
+ private func promptMenuRow(
+ _ title: String,
+ rowID: String,
+ isSelected: Bool,
+ action: @escaping () -> Void
+ ) -> some View {
+ Button(action: action) {
+ Text(title)
+ .font(.system(size: 9, weight: isSelected ? .semibold : .medium))
+ .foregroundStyle(.white.opacity(isSelected ? 0.96 : 0.84))
+ .lineLimit(1)
+ .truncationMode(.tail)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, 6)
+ .padding(.vertical, self.promptMenuRowVerticalPadding)
+ .background(self.promptMenuRowBackground(isSelected: isSelected, rowID: rowID))
+ }
+ .buttonStyle(.plain)
+ .onHover { hovering in
+ self.hoveredPromptMenuRowID = hovering ? rowID : nil
}
- self.promptHoverWorkItem = task
- DispatchQueue.main.asyncAfter(deadline: .now() + (hovering ? 0.05 : 0.15), execute: task)
}
private func promptMenuContent() -> some View {
let promptMode = self.activePromptMode ?? .dictate
let activeDictationSlot = self.activeDictationShortcutSlot
+ return VStack(alignment: .leading, spacing: 2) {
+ let defaultSelected = promptMode.normalized == .dictate
+ ? (self.settings.dictationPromptSelection(for: activeDictationSlot) == .default)
+ : (self.settings.selectedPromptID(for: promptMode) == nil)
- return VStack(alignment: .leading, spacing: 0) {
if promptMode.normalized == .dictate {
- Button(action: {
+ self.promptMenuRow(
+ "Off",
+ rowID: "off",
+ isSelected: self.settings.dictationPromptSelection(for: activeDictationSlot) == .off
+ ) {
self.contentState.onDictationPromptSelectionRequested?(.off)
- let pid = NotchContentState.shared.recordingTargetPID
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
- if let pid { _ = TypingService.activateApp(pid: pid) }
- }
- self.showPromptHoverMenu = false
- }) {
- HStack {
- Text("Off")
- Spacer()
- let isSelected = self.settings.dictationPromptSelection(for: activeDictationSlot) == .off
- if isSelected {
- Image(systemName: "checkmark")
- .font(.system(size: 10, weight: .semibold))
- }
- }
+ self.restoreRecordingTargetFocus()
+ self.dismissPromptHoverMenu()
}
- .buttonStyle(.plain)
- .padding(.vertical, 4)
-
- Divider()
- .padding(.vertical, 4)
}
- Button(action: {
+ self.promptMenuRow("Default", rowID: "default", isSelected: defaultSelected) {
if promptMode.normalized == .dictate {
self.contentState.onDictationPromptSelectionRequested?(.default)
} else {
self.settings.setSelectedPromptID(nil, for: promptMode)
}
- let pid = NotchContentState.shared.recordingTargetPID
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
- if let pid { _ = TypingService.activateApp(pid: pid) }
- }
- self.showPromptHoverMenu = false
- }) {
- HStack {
- Text("Default")
- Spacer()
- let isSelected = promptMode.normalized == .dictate
- ? (self.settings.dictationPromptSelection(for: activeDictationSlot) == .default)
- : (self.settings.selectedPromptID(for: promptMode) == nil)
- if isSelected {
- Image(systemName: "checkmark")
- .font(.system(size: 10, weight: .semibold))
- }
- }
+ self.restoreRecordingTargetFocus()
+ self.dismissPromptHoverMenu()
}
- .buttonStyle(.plain)
- .padding(.vertical, 4)
- if !self.settings.promptProfiles(for: promptMode).isEmpty {
- Divider()
- .padding(.vertical, 4)
-
- ForEach(self.settings.promptProfiles(for: promptMode)) { profile in
- Button(action: {
+ let profiles = self.settings.promptProfiles(for: promptMode)
+ if !profiles.isEmpty {
+ ForEach(profiles) { profile in
+ let isSelected = promptMode.normalized == .dictate
+ ? (self.settings.dictationPromptSelection(for: activeDictationSlot) == .profile(profile.id))
+ : (self.settings.selectedPromptID(for: promptMode) == profile.id)
+ self.promptMenuRow(
+ profile.name.isEmpty ? "Untitled" : profile.name,
+ rowID: profile.id,
+ isSelected: isSelected
+ ) {
if promptMode.normalized == .dictate {
self.contentState.onDictationPromptSelectionRequested?(.profile(profile.id))
} else {
self.settings.setSelectedPromptID(profile.id, for: promptMode)
}
- let pid = NotchContentState.shared.recordingTargetPID
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
- if let pid { _ = TypingService.activateApp(pid: pid) }
- }
- self.showPromptHoverMenu = false
- }) {
- HStack {
- Text(profile.name.isEmpty ? "Untitled" : profile.name)
- Spacer()
- let isSelected = promptMode.normalized == .dictate
- ? (self.settings.dictationPromptSelection(for: activeDictationSlot) == .profile(profile.id))
- : (self.settings.selectedPromptID(for: promptMode) == profile.id)
- if isSelected {
- Image(systemName: "checkmark")
- .font(.system(size: 10, weight: .semibold))
- }
- }
+ self.restoreRecordingTargetFocus()
+ self.dismissPromptHoverMenu()
}
- .buttonStyle(.plain)
- .padding(.vertical, 4)
}
}
}
- .font(.system(size: 9, weight: .medium))
- .padding(.horizontal, 8)
- .padding(.vertical, 6)
- .foregroundStyle(.white)
+ .padding(3)
.background(Color.black)
- .cornerRadius(8)
+ .clipShape(RoundedRectangle(cornerRadius: 9))
.overlay(
- RoundedRectangle(cornerRadius: 8)
+ RoundedRectangle(cornerRadius: 9)
.stroke(Color.white.opacity(0.12), lineWidth: 1)
)
+ .shadow(color: .black.opacity(0.24), radius: 8, x: 0, y: 5)
.onHover { hovering in
- self.handlePromptHover(hovering)
+ self.handlePromptMenuHover(hovering)
}
}
@ViewBuilder
private var promptSelectorControl: some View {
if self.presentationPolicy.showsPromptSelector {
- ZStack(alignment: .topLeading) {
- HStack(spacing: 6) {
- Text("AI Prompt:")
- .font(.system(size: 9, weight: .medium))
- .foregroundStyle(.white.opacity(0.5))
- Text(self.selectedPromptLabel)
- .font(.system(size: 9, weight: .medium))
- .foregroundStyle(.white.opacity(0.75))
- .lineLimit(1)
- if self.isAppPromptOverrideActive {
- Text("App")
- .font(.system(size: 8, weight: .semibold))
- .foregroundStyle(.white.opacity(0.9))
- .padding(.horizontal, 4)
- .padding(.vertical, 1)
- .background(
- Capsule()
- .fill(Color.white.opacity(0.15))
- )
- }
- ZStack {
- Circle()
- .fill(Color.white.opacity(0.08))
- .frame(width: 14, height: 14)
- Image(systemName: "chevron.down")
- .font(.system(size: 6, weight: .bold))
- .foregroundStyle(.white.opacity(0.7))
- }
- }
- .padding(.horizontal, 6)
- .padding(.vertical, 4)
- .background(Color.clear)
- .cornerRadius(6)
- .opacity(self.isPromptSelectableMode ? (self.contentState.isProcessing ? 0.7 : 1.0) : 0.6)
- .allowsHitTesting(self.isPromptSelectableMode && !self.contentState.isProcessing)
- .onHover { hovering in
- self.handlePromptHover(hovering)
+ HStack(spacing: 6) {
+ Text(self.selectedPromptLabel)
+ .font(.system(size: 9, weight: .medium))
+ .foregroundStyle(self.isHoveringPromptChip ? .white.opacity(0.94) : .white.opacity(0.86))
+ .lineLimit(1)
+ .truncationMode(.tail)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ Image(systemName: "chevron.down")
+ .font(.system(size: 8, weight: .bold))
+ .foregroundStyle(self.isHoveringPromptChip ? .white.opacity(0.78) : .white.opacity(0.62))
+ if self.isAppPromptOverrideActive {
+ Text("App")
+ .font(.system(size: 8, weight: .semibold))
+ .foregroundStyle(.white.opacity(0.82))
+ .padding(.horizontal, 4)
+ .padding(.vertical, 1)
+ .background(
+ Capsule()
+ .fill(Color.white.opacity(0.12))
+ )
}
- .onTapGesture {
- guard self.isPromptSelectableMode, !self.contentState.isProcessing else { return }
- self.showPromptHoverMenu.toggle()
+ }
+ .padding(.horizontal, 12)
+ .padding(.vertical, 7)
+ .frame(width: self.promptSelectorFixedWidth, alignment: .leading)
+ .background(
+ Capsule()
+ .fill(
+ LinearGradient(
+ colors: [
+ Color.black.opacity(self.isHoveringPromptChip ? 0.96 : 0.92),
+ Color(white: self.isHoveringPromptChip ? 0.10 : 0.06),
+ ],
+ startPoint: .top,
+ endPoint: .bottom
+ )
+ )
+ )
+ .overlay(
+ Capsule()
+ .stroke(Color.white.opacity(self.isHoveringPromptChip ? 0.24 : 0.14), lineWidth: 1)
+ )
+ .shadow(color: .black.opacity(0.28), radius: 8, x: 0, y: 4)
+ .shadow(color: .white.opacity(self.isHoveringPromptChip ? 0.06 : 0.03), radius: 0, x: 0, y: 1)
+ .opacity(self.isPromptSelectableMode ? (self.contentState.isProcessing ? 0.7 : 1.0) : 0.6)
+ .allowsHitTesting(self.isPromptSelectableMode && !self.contentState.isProcessing)
+ .onHover { hovering in
+ self.handlePromptChipHover(hovering)
+ }
+ .background(
+ GeometryReader { geometry in
+ Color.clear
+ .onAppear {
+ self.promptSelectorLeading = geometry.frame(in: .named(Self.notchContentCoordinateSpace)).minX
+ }
+ .onChange(of: geometry.frame(in: .named(Self.notchContentCoordinateSpace)).minX) { _, newLeading in
+ self.promptSelectorLeading = newLeading
+ }
}
+ )
+ .transition(.opacity)
+ }
+ }
- if self.showPromptHoverMenu {
- self.promptMenuContent()
- .padding(.top, 26)
- .transition(.opacity)
- .zIndex(10)
- }
+ @ViewBuilder
+ private var promptHoverMenuRow: some View {
+ if self.showPromptHoverMenu {
+ HStack(spacing: 0) {
+ Color.clear
+ .frame(width: self.promptSelectorLeading)
+
+ self.promptMenuContent()
+ .frame(width: self.promptMenuWidth, alignment: .leading)
+
+ Spacer(minLength: 0)
}
- .frame(width: 140, alignment: .leading)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.top, -2)
.transition(.opacity)
}
}
var body: some View {
- VStack(alignment: .leading, spacing: 4) {
+ Group {
+ if self.canExpandCommandHistory {
+ self.notchBodyContent
+ .contentShape(Rectangle())
+ .onTapGesture {
+ if NotchOverlayManager.shared.canHandleNotchCommandTap {
+ NotchOverlayManager.shared.onNotchClicked?()
+ }
+ }
+ } else {
+ self.notchBodyContent
+ }
+ }
+ .onChange(of: self.contentState.mode) { _, _ in
+ if !self.isPromptSelectableMode {
+ self.dismissPromptHoverMenu()
+ }
+ switch self.contentState.mode {
+ case .dictation: self.contentState.promptPickerMode = .dictate
+ case .edit, .write, .rewrite: self.contentState.promptPickerMode = .edit
+ case .command: break
+ }
+ }
+ .animation(.spring(response: 0.25, dampingFraction: 0.8), value: self.hasTranscription)
+ .animation(.easeInOut(duration: 0.2), value: self.contentState.mode)
+ .animation(.easeInOut(duration: 0.25), value: self.contentState.isProcessing)
+ }
+
+ private var notchBodyContent: some View {
+ VStack(alignment: .center, spacing: 6) {
HStack(spacing: 6) {
- if let appIcon = self.contentState.targetAppIcon {
- Image(nsImage: appIcon)
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: 16, height: 16)
- .clipShape(RoundedRectangle(cornerRadius: 3))
- }
+ self.appIconView
NotchWaveformView(
audioPublisher: self.audioPublisher,
@@ -610,26 +725,14 @@ struct NotchExpandedView: View {
)
.frame(width: 80, height: 22)
- if self.presentationPolicy.showsModeLabel {
- if self.contentState.isProcessing {
- ShimmerText(text: self.processingStatusText, color: self.modeColor)
- .frame(width: self.statusLabelWidth, alignment: .center)
- } else {
- Text(self.modeLabel)
- .font(.system(size: 9, weight: .medium))
- .foregroundStyle(self.modeColor)
- .opacity(0.9)
- .frame(width: self.statusLabelWidth, alignment: .center)
- }
- }
+ self.promptSelectorControl
}
+ .frame(maxWidth: .infinity, alignment: .center)
- self.promptSelectorControl
- .frame(maxWidth: .infinity, alignment: .leading)
+ self.promptHoverMenuRow
- // Transcription preview (wrapped, fixed width)
if self.presentationPolicy.showsStreamingPreview && self.hasTranscription && !self.contentState.isProcessing {
- let previewText = self.contentState.cachedPreviewText
+ let previewText = self.visiblePreviewText
if !previewText.isEmpty {
ScrollViewReader { proxy in
ScrollView(.vertical, showsIndicators: false) {
@@ -656,35 +759,16 @@ struct NotchExpandedView: View {
}
}
}
- .frame(maxWidth: .infinity, alignment: .leading)
+ .frame(maxWidth: .infinity, alignment: .center)
.transition(.opacity.combined(with: .scale(scale: 0.95)))
}
}
}
+ .coordinateSpace(name: Self.notchContentCoordinateSpace)
.frame(width: self.notchContentWidth)
.padding(.horizontal, 8)
.padding(.vertical, 6)
- .background(Color.black) // Must be pure black to blend with macOS notch
- .contentShape(Rectangle()) // Make entire area tappable
- .onTapGesture {
- // If in command mode with history, clicking expands the conversation
- if self.canExpandCommandHistory && NotchOverlayManager.shared.canHandleNotchCommandTap {
- NotchOverlayManager.shared.onNotchClicked?()
- }
- }
- .onChange(of: self.contentState.mode) { _, _ in
- if !self.isPromptSelectableMode {
- self.showPromptHoverMenu = false
- }
- switch self.contentState.mode {
- case .dictation: self.contentState.promptPickerMode = .dictate
- case .edit, .write, .rewrite: self.contentState.promptPickerMode = .edit
- case .command: break
- }
- }
- .animation(.spring(response: 0.25, dampingFraction: 0.8), value: self.hasTranscription)
- .animation(.easeInOut(duration: 0.2), value: self.contentState.mode)
- .animation(.easeInOut(duration: 0.25), value: self.contentState.isProcessing)
+ .background(Color.black)
}
}
@@ -704,6 +788,8 @@ struct NotchWaveformView: View {
private let barSpacing: CGFloat = 4
private let minHeight: CGFloat = 3
private let maxHeight: CGFloat = 20
+ private let processingSweepSeconds: Double = 2.2
+ private let processingBandHalfWidth: CGFloat = 0.34
private var currentGlowIntensity: CGFloat {
self.contentState.isProcessing ? 0.0 : 0.35
@@ -724,13 +810,22 @@ struct NotchWaveformView: View {
}
var body: some View {
- HStack(spacing: self.barSpacing) {
- ForEach(0..<self.barCount, id: \.self) { index in
- RoundedRectangle(cornerRadius: self.barWidth / 2)
- .fill(self.color)
- .frame(width: self.barWidth, height: self.barHeights[index])
- .shadow(color: self.color.opacity(self.currentGlowIntensity), radius: self.currentGlowRadius, x: 0, y: 0)
- .shadow(color: self.color.opacity(self.currentGlowIntensity * 0.5), radius: self.currentOuterGlowRadius, x: 0, y: 0)
+ TimelineView(.animation(minimumInterval: 1.0 / 30.0)) { timeline in
+ ZStack {
+ self.barsView(using: { index in
+ self.displayHeight(for: index)
+ })
+ .foregroundStyle(self.color.opacity(self.contentState.isProcessing ? 0.14 : 1.0))
+
+ if self.contentState.isProcessing {
+ self.processingSweep(at: timeline.date)
+ .mask {
+ self.barsView(using: { index in
+ self.displayHeight(for: index)
+ })
+ }
+ .shadow(color: .white.opacity(0.26), radius: 2.5, x: 0, y: 0)
+ }
}
}
.onChange(of: self.data.audioLevel) { _, level in
@@ -765,8 +860,48 @@ struct NotchWaveformView: View {
}
}
+ @ViewBuilder
+ private func barsView(using height: @escaping (Int) -> CGFloat) -> some View {
+ HStack(spacing: self.barSpacing) {
+ ForEach(0..<self.barCount, id: \.self) { index in
+ RoundedRectangle(cornerRadius: self.barWidth / 2)
+ .frame(width: self.barWidth, height: height(index))
+ .shadow(color: self.color.opacity(self.currentGlowIntensity), radius: self.currentGlowRadius, x: 0, y: 0)
+ .shadow(color: self.color.opacity(self.currentGlowIntensity * 0.5), radius: self.currentOuterGlowRadius, x: 0, y: 0)
+ }
+ }
+ }
+
+ private func processingSweep(at date: Date) -> some View {
+ let progress = date.timeIntervalSinceReferenceDate.truncatingRemainder(dividingBy: self.processingSweepSeconds) / self.processingSweepSeconds
+ let centerX = CGFloat(-0.25 + progress * 1.5)
+
+ return Rectangle()
+ .foregroundStyle(
+ LinearGradient(
+ colors: [
+ self.color.opacity(0.1),
+ self.color.opacity(0.22),
+ .white.opacity(0.82),
+ self.color.opacity(0.94),
+ .white.opacity(0.82),
+ self.color.opacity(0.22),
+ self.color.opacity(0.1),
+ ],
+ startPoint: UnitPoint(x: centerX - self.processingBandHalfWidth, y: 0.5),
+ endPoint: UnitPoint(x: centerX + self.processingBandHalfWidth, y: 0.5)
+ )
+ )
+ }
+
+ private func displayHeight(for index: Int) -> CGFloat {
+ guard self.contentState.isProcessing else {
+ return self.barHeights[index]
+ }
+ return self.minHeight
+ }
+
private func setFlatProcessingBars() {
- // During AI processing we want the visualizer to settle to silence (flat).
withAnimation(.easeOut(duration: 0.18)) {
for i in 0..<self.barCount {
self.barHeights[i] = self.minHeight
@@ -801,32 +936,82 @@ struct NotchWaveformView: View {
struct NotchCompactLeadingView: View {
@ObservedObject private var contentState = NotchContentState.shared
- @State private var isPulsing = false
+ @ObservedObject private var activeAppMonitor = ActiveAppMonitor.shared
var body: some View {
- Image(systemName: "waveform")
- .font(.system(size: 9, weight: .medium))
- .foregroundStyle(self.contentState.mode.notchColor)
- .scaleEffect(self.isPulsing ? 1.1 : 1.0)
- .animation(.easeInOut(duration: 0.8).repeatForever(autoreverses: true), value: self.isPulsing)
- .onAppear { self.isPulsing = true }
- .onDisappear { self.isPulsing = false }
+ Group {
+ if let appIcon = self.contentState.targetAppIcon ?? self.activeAppMonitor.activeAppIcon {
+ Image(nsImage: appIcon)
+ .resizable()
+ .aspectRatio(contentMode: .fit)
+ .frame(width: 16, height: 16)
+ .clipShape(RoundedRectangle(cornerRadius: 3))
+ } else {
+ Circle()
+ .fill(self.contentState.mode.notchColor.opacity(0.9))
+ .frame(width: 8, height: 8)
+ }
+ }
}
}
struct NotchCompactTrailingView: View {
+ let audioPublisher: AnyPublisher<CGFloat, Never>
@ObservedObject private var contentState = NotchContentState.shared
- @State private var isPulsing = false
var body: some View {
- Circle()
- .fill(self.contentState.mode.notchColor)
- .frame(width: 5, height: 5)
- .opacity(self.isPulsing ? 0.5 : 1.0)
- .scaleEffect(self.isPulsing ? 0.85 : 1.0)
- .animation(.easeInOut(duration: 1.0).repeatForever(autoreverses: true), value: self.isPulsing)
- .onAppear { self.isPulsing = true }
- .onDisappear { self.isPulsing = false }
+ CompactNotchWaveformView(
+ audioPublisher: self.audioPublisher,
+ color: self.contentState.mode.notchColor
+ )
+ .frame(width: 34, height: 16)
+ }
+}
+
+struct NotchCompactBottomView: View {
+ @ObservedObject private var contentState = NotchContentState.shared
+
+ private let previewWidth: CGFloat = 250
+ private let previewHeight: CGFloat = 20
+ private static let transientOverlayStatusTexts: Set<String> = [
+ "Transcribing",
+ "Refining",
+ "Thinking",
+ "Working",
+ "Transcribing...",
+ "Refining...",
+ "Thinking...",
+ "Working...",
+ ]
+
+ private var compactPreviewText: String {
+ let source = self.contentState.isProcessing
+ ? self.contentState.transcriptionText
+ : self.contentState.cachedPreviewText
+ let trimmed = source.trimmingCharacters(in: .whitespacesAndNewlines)
+ guard !Self.transientOverlayStatusTexts.contains(trimmed) else { return "" }
+ return trimmed
+ }
+
+ private var shouldShowPreview: Bool {
+ SettingsStore.shared.enableStreamingPreview && !self.compactPreviewText.isEmpty
+ }
+
+ var body: some View {
+ ZStack(alignment: .leading) {
+ Text(self.compactPreviewText)
+ .font(.system(size: 9, weight: .medium))
+ .foregroundStyle(.white.opacity(0.82))
+ .lineLimit(1)
+ .truncationMode(.head)
+ .offset(y: self.shouldShowPreview ? 0 : -4)
+ .opacity(self.shouldShowPreview ? 1 : 0)
+ }
+ .frame(width: self.previewWidth, height: SettingsStore.shared.enableStreamingPreview ? self.previewHeight : 0, alignment: .leading)
+ .padding(.horizontal, SettingsStore.shared.enableStreamingPreview ? 10 : 0)
+ .padding(.bottom, SettingsStore.shared.enableStreamingPreview ? 8 : 0)
+ .clipped()
+ .animation(.easeOut(duration: 0.2), value: self.shouldShowPreview)
}
}
@@ -1332,3 +1517,146 @@ struct ExpandedModeWaveformView: View {
}
}
}
+
+struct CompactNotchWaveformView: View {
+ let audioPublisher: AnyPublisher<CGFloat, Never>
+ let color: Color
+
+ @StateObject private var data: AudioVisualizationData
+ @ObservedObject private var contentState = NotchContentState.shared
+ @State private var barHeights: [CGFloat] = Array(repeating: 3, count: 5)
+
+ private let barCount = 5
+ private let barWidth: CGFloat = 2.5
+ private let barSpacing: CGFloat = 2
+ private let minHeight: CGFloat = 3
+ private let maxHeight: CGFloat = 12
+ private let noiseThreshold: CGFloat = 0.05
+ private let processingSweepSeconds: Double = 2.15
+ private let processingBandHalfWidth: CGFloat = 0.42
+ private let processingFlatHeight: CGFloat = 3
+
+ init(audioPublisher: AnyPublisher<CGFloat, Never>, color: Color) {
+ self.audioPublisher = audioPublisher
+ self.color = color
+ _data = StateObject(wrappedValue: AudioVisualizationData(audioLevelPublisher: audioPublisher))
+ }
+
+ var body: some View {
+ TimelineView(.animation(minimumInterval: 1.0 / 30.0)) { timeline in
+ ZStack {
+ self.barsView(using: { index in
+ self.displayHeight(for: index)
+ })
+ .foregroundStyle(self.color.opacity(self.contentState.isProcessing ? 0.16 : 1.0))
+
+ if self.contentState.isProcessing {
+ self.processingSweep(at: timeline.date)
+ .mask {
+ self.barsView(using: { index in
+ self.displayHeight(for: index)
+ })
+ }
+ .shadow(color: .white.opacity(0.28), radius: 2.5, x: 0, y: 0)
+ }
+ }
+ }
+ .onChange(of: self.data.audioLevel) { _, level in
+ if !self.contentState.isProcessing {
+ self.updateBars(level: level)
+ }
+ }
+ .onChange(of: self.contentState.isProcessing) { _, processing in
+ if processing {
+ self.resetBarsToBaseline(animated: false)
+ } else {
+ self.updateBars(level: self.data.audioLevel)
+ }
+ }
+ .onAppear {
+ if self.contentState.isProcessing {
+ self.resetBarsToBaseline(animated: false)
+ } else {
+ self.updateBars(level: self.data.audioLevel)
+ }
+ }
+ }
+
+ @ViewBuilder
+ private func barsView(using height: @escaping (Int) -> CGFloat) -> some View {
+ HStack(spacing: self.barSpacing) {
+ ForEach(0..<self.barCount, id: \.self) { index in
+ RoundedRectangle(cornerRadius: self.barWidth / 2)
+ .frame(width: self.barWidth, height: height(index))
+ }
+ }
+ }
+
+ private func processingSweep(at date: Date) -> some View {
+ let progress = self.processingProgress(at: date)
+ let centerX = CGFloat(-0.25 + progress * 1.5)
+
+ return Rectangle()
+ .foregroundStyle(
+ LinearGradient(
+ colors: [
+ self.color.opacity(0.12),
+ self.color.opacity(0.28),
+ .white.opacity(0.88),
+ self.color.opacity(1.0),
+ .white.opacity(0.88),
+ self.color.opacity(0.28),
+ self.color.opacity(0.12),
+ ],
+ startPoint: UnitPoint(x: centerX - self.processingBandHalfWidth, y: 0.5),
+ endPoint: UnitPoint(x: centerX + self.processingBandHalfWidth, y: 0.5)
+ )
+ )
+ }
+
+ private func processingProgress(at date: Date) -> Double {
+ date.timeIntervalSinceReferenceDate.truncatingRemainder(dividingBy: self.processingSweepSeconds) / self.processingSweepSeconds
+ }
+
+ private func displayHeight(for index: Int) -> CGFloat {
+ guard self.contentState.isProcessing else {
+ return self.barHeights[index]
+ }
+
+ return self.processingFlatHeight
+ }
+
+ private func updateBars(level: CGFloat) {
+ let normalizedLevel = min(max(level, 0), 1)
+ let adjustedLevel = normalizedLevel > self.noiseThreshold
+ ? (normalizedLevel - self.noiseThreshold) / (1.0 - self.noiseThreshold)
+ : 0
+
+ guard adjustedLevel > 0 else {
+ self.resetBarsToBaseline(animated: false)
+ return
+ }
+
+ withAnimation(.easeOut(duration: 0.1)) {
+ for index in 0..<self.barCount {
+ let centerDistance = abs(CGFloat(index) - CGFloat(self.barCount - 1) / 2)
+ let centerFactor = 1.0 - (centerDistance / CGFloat(self.barCount / 2)) * 0.28
+ self.barHeights[index] = self.minHeight + (self.maxHeight - self.minHeight) * adjustedLevel * centerFactor
+ }
+ }
+ }
+
+ private func resetBarsToBaseline(animated: Bool) {
+ let apply = {
+ self.barHeights = Array(repeating: self.minHeight, count: self.barCount)
+ }
+
+ if animated {
+ withAnimation(.easeOut(duration: 0.08)) {
+ apply()
+ }
+ } else {
+ apply()
+ }
+ }
+}