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

Unify dictation into two configurable shortcuts

altic-dev4c7a42f7433e
diff --git a/Sources/Fluid/Analytics/AnalyticsService.swift b/Sources/Fluid/Analytics/AnalyticsService.swift
index 6167a799..654066af 100644
--- a/Sources/Fluid/Analytics/AnalyticsService.swift
+++ b/Sources/Fluid/Analytics/AnalyticsService.swift
@@ -74,6 +74,10 @@ final class AnalyticsService {
let settings = SettingsStore.shared
+ let anyDictationShortcutUsesAI =
+ settings.dictationPromptSelection(for: .primary) != .off ||
+ settings.dictationPromptSelection(for: .secondary) != .off
+
var properties: [String: Any] = [
"app_version": version,
"app_build": build,
@@ -82,7 +86,7 @@ final class AnalyticsService {
"environment": environment,
// Low-cardinality settings snapshot
- "ai_processing_enabled": !settings.isDictationPromptOff,
+ "ai_processing_enabled": anyDictationShortcutUsesAI,
"streaming_preview_enabled": settings.enableStreamingPreview,
"press_and_hold_mode": settings.pressAndHoldMode,
"copy_to_clipboard_enabled": settings.copyTranscriptionToClipboard,
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 7cf8d801..31a52fd8 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -87,6 +87,7 @@ struct ContentView: View {
@State private var isRecordingForRewrite: Bool = false // Track if current recording is for rewrite mode
@State private var isRecordingForCommand: Bool = false // Track if current recording is for command mode
@State private var promptModeOverrideText: String? // System prompt text to use when in prompt mode
+ @State private var activeDictationShortcutSlot: SettingsStore.DictationShortcutSlot? = nil
@State private var activeRecordingMode: ActiveRecordingMode = .none
@State private var isRecordingShortcut = false
@State private var isRecordingPromptModeShortcut = false
@@ -1395,64 +1396,15 @@ struct ContentView: View {
}
*/
- /// Build a general system prompt with voice editing commands support
- private func buildSystemPrompt(appInfo: (name: String, bundleId: String, windowTitle: String)) -> String {
- return SettingsStore.shared.effectiveSystemPrompt(
- for: .dictate,
- appBundleID: appInfo.bundleId
- )
- }
-
- private var shouldTracePromptProcessing: Bool {
- self.forcePromptTraceToConsole ||
- UserDefaults.standard.bool(forKey: "EnableDebugLogs")
- }
-
- private var forcePromptTraceToConsole: Bool {
- ProcessInfo.processInfo.environment["FLUID_PROMPT_TRACE"] == "1"
- }
-
- private func logDictationPromptTrace(_ title: String, value: String) {
- let line = "[PromptTrace][Dictate] \(title):\n\(value)"
- if self.forcePromptTraceToConsole {
- print(line)
- }
- DebugLogger.shared.debug(line, source: "ContentView")
- }
-
- private func customPromptAnalyticsProperties(promptSource: String, overrideEmpty: Bool?) -> [String: Any] {
- let providerID = SettingsStore.shared.selectedProviderID
- let providerKey = self.providerKey(for: providerID)
- let selectedModel = SettingsStore.shared.selectedModelByProvider[providerKey] ?? SettingsStore.shared.selectedModel ?? ""
- let isCustomProvider = !ModelRepository.shared.isBuiltIn(providerID)
- let providerName = isCustomProvider ? "Custom Provider" : ModelRepository.shared.displayName(for: providerID)
-
- var properties: [String: Any] = [
- "prompt_source": promptSource,
- "provider_id": isCustomProvider ? "custom" : providerID,
- "provider_name": providerName,
- "provider_type": isCustomProvider ? "custom" : "built_in",
- ]
- if !selectedModel.isEmpty {
- properties["model"] = isCustomProvider ? "custom" : selectedModel
- }
- if let overrideEmpty {
- properties["override_empty"] = overrideEmpty
- }
- return properties
- }
-
- // MARK: - Local Endpoint Detection
-
- private func isLocalEndpoint(_ urlString: String) -> Bool {
- return ModelRepository.shared.isLocalEndpoint(urlString)
- }
-
// NOTE: Thinking token filtering is now handled by LLMClient.stripThinkingTags()
// MARK: - Modular AI Processing
- private func processTextWithAI(_ inputText: String, overrideSystemPrompt: String? = nil) async -> String {
+ private func processTextWithAI(
+ _ inputText: String,
+ overrideSystemPrompt: String? = nil,
+ dictationSlot: SettingsStore.DictationShortcutSlot? = nil
+ ) async -> String {
// CRITICAL FIX: Read current settings from SettingsStore, not stale @State copies
// This ensures AI provider/model changes in AISettingsView take effect immediately
let currentSelectedProviderID = SettingsStore.shared.selectedProviderID
@@ -1491,7 +1443,7 @@ struct ContentView: View {
let systemPrompt: String = {
let override = overrideSystemPrompt?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
if !override.isEmpty { return override }
- return self.buildSystemPrompt(appInfo: appInfo)
+ return self.buildSystemPrompt(appInfo: appInfo, dictationSlot: dictationSlot)
}()
// Route to Apple Intelligence if selected
@@ -1500,20 +1452,24 @@ struct ContentView: View {
if #available(macOS 26.0, *) {
let provider = AppleIntelligenceProvider()
if self.shouldTracePromptProcessing {
- let selectedProfile = SettingsStore.shared.resolvedPromptProfile(
- for: .dictate,
+ let activeSlot = dictationSlot ?? self.currentDictationShortcutSlot(for: self.activeRecordingMode) ?? .primary
+ let selectedProfile = SettingsStore.shared.resolvedDictationPromptProfile(
+ for: activeSlot,
appBundleID: appInfo.bundleId
)
let selectedPromptName: String = {
+ if SettingsStore.shared.dictationPromptSelection(for: activeSlot) == .off {
+ return "Off"
+ }
if let profile = selectedProfile {
return profile.name.isEmpty ? "Untitled Prompt" : profile.name
}
- return "Default Dictate"
+ return "Default"
}()
self.logDictationPromptTrace("Selected prompt profile", value: selectedPromptName)
self.logDictationPromptTrace(
"Prompt body (custom/default body)",
- value: SettingsStore.shared.effectivePromptBody(for: .dictate, appBundleID: appInfo.bundleId)
+ value: SettingsStore.shared.effectiveDictationPromptBody(for: activeSlot, appBundleID: appInfo.bundleId)
)
self.logDictationPromptTrace("Built-in default system prompt (baseline)", value: SettingsStore.defaultSystemPromptText(for: .dictate))
self.logDictationPromptTrace("Final system prompt sent to model", value: systemPrompt)
@@ -1543,20 +1499,24 @@ struct ContentView: View {
DebugLogger.shared.debug("Using app context for AI: app=\(appInfo.name), bundleId=\(appInfo.bundleId), title=\(appInfo.windowTitle)", source: "ContentView")
if self.shouldTracePromptProcessing {
- let selectedProfile = SettingsStore.shared.resolvedPromptProfile(
- for: .dictate,
+ let activeSlot = dictationSlot ?? self.currentDictationShortcutSlot(for: self.activeRecordingMode) ?? .primary
+ let selectedProfile = SettingsStore.shared.resolvedDictationPromptProfile(
+ for: activeSlot,
appBundleID: appInfo.bundleId
)
let selectedPromptName: String = {
+ if SettingsStore.shared.dictationPromptSelection(for: activeSlot) == .off {
+ return "Off"
+ }
if let profile = selectedProfile {
return profile.name.isEmpty ? "Untitled Prompt" : profile.name
}
- return "Default Dictate"
+ return "Default"
}()
self.logDictationPromptTrace("Selected prompt profile", value: selectedPromptName)
self.logDictationPromptTrace(
"Prompt body (custom/default body)",
- value: SettingsStore.shared.effectivePromptBody(for: .dictate, appBundleID: appInfo.bundleId)
+ value: SettingsStore.shared.effectiveDictationPromptBody(for: activeSlot, appBundleID: appInfo.bundleId)
)
self.logDictationPromptTrace("Built-in default system prompt (baseline)", value: SettingsStore.defaultSystemPromptText(for: .dictate))
self.logDictationPromptTrace("Prompt override in use", value: (overrideSystemPrompt?.isEmpty == false) ? "yes" : "no")
@@ -1656,6 +1616,7 @@ struct ContentView: View {
let modeAtStop = self.activeRecordingMode
let wasRewriteMode = modeAtStop == .edit || self.isRecordingForRewrite
let wasCommandMode = modeAtStop == .command || self.isRecordingForCommand
+ let activeDictationSlot = self.currentDictationShortcutSlot(for: modeAtStop)
let promptOverride = self.promptModeOverrideText
DebugLogger.shared.info(
"Routing decision snapshot | activeMode=\(modeAtStop.rawValue) | rewrite=\(wasRewriteMode) | command=\(wasCommandMode) | overlay=\(NotchContentState.shared.mode.rawValue)",
@@ -1748,10 +1709,8 @@ struct ContentView: View {
var finalText: String
- // Check if we should use AI processing.
- // Prompt mode can still use AI when a provider is configured even if the global gate is off.
- let shouldUseAI = DictationAIPostProcessingGate.isConfigured() ||
- (promptOverride != nil && DictationAIPostProcessingGate.isProviderConfigured())
+ let shouldUseAI = activeDictationSlot.map { DictationAIPostProcessingGate.isConfigured(for: $0) } ??
+ DictationAIPostProcessingGate.isConfigured()
let transcriptionModelInfo = self.currentTranscriptionModelInfo()
if shouldUseAI {
@@ -1766,7 +1725,11 @@ struct ContentView: View {
// Ensure the status label becomes visible immediately.
await Task.yield()
- finalText = await self.processTextWithAI(transcribedText, overrideSystemPrompt: promptOverride)
+ finalText = await self.processTextWithAI(
+ transcribedText,
+ overrideSystemPrompt: promptOverride,
+ dictationSlot: activeDictationSlot
+ )
let postProcessingLatencyMs = Int((Date().timeIntervalSince(postProcessingStart) * 1000).rounded())
AnalyticsService.shared.capture(
.dictationPostProcessingCompleted,
@@ -2158,11 +2121,8 @@ struct ContentView: View {
}
private func setActiveRecordingMode(_ mode: ActiveRecordingMode) {
- if mode != .promptMode {
- self.promptModeOverrideText = nil
- NotchContentState.shared.promptModeOverrideProfileName = nil
- NotchContentState.shared.promptModeOverrideProfileID = nil
- NotchContentState.shared.isPromptModeActive = false
+ if mode != .dictate, mode != .promptMode {
+ self.clearActiveDictationShortcutState()
}
self.activeRecordingMode = mode
switch mode {
@@ -2406,21 +2366,10 @@ struct ContentView: View {
NotchContentState.shared.onCancelRequested = {
_ = self.handleCancelShortcut()
}
- 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
- }
+ NotchContentState.shared.onDictationPromptSelectionRequested = { selection in
+ let slot = self.activeDictationShortcutSlot ?? .primary
+ SettingsStore.shared.setDictationPromptSelection(selection, for: slot)
+ self.applyDictationShortcutSelectionContext(for: slot)
}
guard self.hotkeyManager == nil else { return }
@@ -2444,18 +2393,7 @@ struct ContentView: View {
"ContentView: selected model for dictate hotkey=\(SettingsStore.shared.selectedSpeechModel.displayName)",
source: "ContentView"
)
- self.captureRecordingContext()
- self.setActiveRecordingMode(.dictate)
- self.rewriteModeService.clearState()
- self.menuBarManager.setOverlayMode(.dictation)
-
- guard !self.asr.isRunning else { return }
- if SettingsStore.shared.enableTranscriptionSounds {
- TranscriptionSoundPlayer.shared.playStartSound()
- }
- Task {
- await self.asr.start()
- }
+ self.beginDictationRecording(for: .primary, mode: .dictate)
},
stopAndProcessCallback: {
let route = self.currentDictationOutputRouteForHotkeyStop()
@@ -2464,30 +2402,7 @@ struct ContentView: View {
},
promptModeCallback: {
DebugLogger.shared.info("Prompt mode triggered", source: "ContentView")
- self.captureRecordingContext()
-
- // Resolve the full system prompt for the selected profile
- let settings = SettingsStore.shared
- if let promptID = settings.promptModeSelectedPromptID,
- let profile = settings.dictationPromptProfiles.first(where: { $0.id == promptID })
- {
- self.promptModeOverrideText = SettingsStore.combineBasePrompt(for: .dictate, with: SettingsStore.stripBasePrompt(for: .dictate, from: profile.prompt))
- NotchContentState.shared.promptModeOverrideProfileName = profile.name
- NotchContentState.shared.promptModeOverrideProfileID = profile.id
- }
-
- NotchContentState.shared.isPromptModeActive = true
- self.setActiveRecordingMode(.promptMode)
- self.rewriteModeService.clearState()
- self.menuBarManager.setOverlayMode(.dictation)
-
- guard !self.asr.isRunning else { return }
- if settings.enableTranscriptionSounds {
- TranscriptionSoundPlayer.shared.playStartSound()
- }
- Task {
- await self.asr.start()
- }
+ self.beginDictationRecording(for: .secondary, mode: .promptMode)
},
commandModeCallback: {
DebugLogger.shared.info("Command mode triggered", source: "ContentView")
@@ -2721,6 +2636,127 @@ struct ContentView: View {
// MARK: - ContentView Playground & Onboarding Helpers
extension ContentView {
+ private func buildSystemPrompt(
+ appInfo: (name: String, bundleId: String, windowTitle: String),
+ dictationSlot: SettingsStore.DictationShortcutSlot? = nil
+ ) -> String {
+ if let slot = dictationSlot ?? self.currentDictationShortcutSlot(for: self.activeRecordingMode) {
+ return SettingsStore.shared.effectiveDictationSystemPrompt(for: slot, appBundleID: appInfo.bundleId)
+ }
+ return SettingsStore.shared.effectiveSystemPrompt(for: .dictate, appBundleID: appInfo.bundleId)
+ }
+
+ private var shouldTracePromptProcessing: Bool {
+ self.forcePromptTraceToConsole ||
+ UserDefaults.standard.bool(forKey: "EnableDebugLogs")
+ }
+
+ private var forcePromptTraceToConsole: Bool {
+ ProcessInfo.processInfo.environment["FLUID_PROMPT_TRACE"] == "1"
+ }
+
+ private func logDictationPromptTrace(_ title: String, value: String) {
+ let line = "[PromptTrace][Dictate] \(title):\n\(value)"
+ if self.forcePromptTraceToConsole {
+ print(line)
+ }
+ DebugLogger.shared.debug(line, source: "ContentView")
+ }
+
+ private func customPromptAnalyticsProperties(promptSource: String, overrideEmpty: Bool?) -> [String: Any] {
+ let providerID = SettingsStore.shared.selectedProviderID
+ let providerKey = self.providerKey(for: providerID)
+ let selectedModel = SettingsStore.shared.selectedModelByProvider[providerKey] ?? SettingsStore.shared.selectedModel ?? ""
+ let isCustomProvider = !ModelRepository.shared.isBuiltIn(providerID)
+ let providerName = isCustomProvider ? "Custom Provider" : ModelRepository.shared.displayName(for: providerID)
+
+ var properties: [String: Any] = [
+ "prompt_source": promptSource,
+ "provider_id": isCustomProvider ? "custom" : providerID,
+ "provider_name": providerName,
+ "provider_type": isCustomProvider ? "custom" : "built_in",
+ ]
+ if !selectedModel.isEmpty {
+ properties["model"] = isCustomProvider ? "custom" : selectedModel
+ }
+ if let overrideEmpty {
+ properties["override_empty"] = overrideEmpty
+ }
+ return properties
+ }
+
+ private func isLocalEndpoint(_ urlString: String) -> Bool {
+ ModelRepository.shared.isLocalEndpoint(urlString)
+ }
+
+ private func currentDictationShortcutSlot(for mode: ActiveRecordingMode) -> SettingsStore.DictationShortcutSlot? {
+ switch mode {
+ case .dictate:
+ return self.activeDictationShortcutSlot ?? .primary
+ case .promptMode:
+ return self.activeDictationShortcutSlot ?? .secondary
+ case .none, .edit, .command:
+ return nil
+ }
+ }
+
+ private func clearActiveDictationShortcutState() {
+ self.activeDictationShortcutSlot = nil
+ self.promptModeOverrideText = nil
+ NotchContentState.shared.activeDictationShortcutSlot = nil
+ NotchContentState.shared.promptModeOverrideProfileName = nil
+ NotchContentState.shared.promptModeOverrideProfileID = nil
+ NotchContentState.shared.isPromptModeActive = false
+ }
+
+ private func applyDictationShortcutSelectionContext(for slot: SettingsStore.DictationShortcutSlot) {
+ let settings = SettingsStore.shared
+ self.activeDictationShortcutSlot = slot
+ NotchContentState.shared.activeDictationShortcutSlot = slot
+ NotchContentState.shared.isPromptModeActive = (slot == .secondary)
+
+ switch settings.dictationPromptSelection(for: slot) {
+ case .off, .default:
+ self.promptModeOverrideText = nil
+ NotchContentState.shared.promptModeOverrideProfileName = nil
+ NotchContentState.shared.promptModeOverrideProfileID = nil
+ case let .profile(profileID):
+ guard let profile = settings.selectedDictationPromptProfile(for: slot) ?? settings.dictationPromptProfiles.first(where: {
+ $0.id == profileID && $0.mode.normalized == .dictate
+ }) else {
+ settings.setDictationPromptSelection(.default, for: slot)
+ self.promptModeOverrideText = nil
+ NotchContentState.shared.promptModeOverrideProfileName = nil
+ NotchContentState.shared.promptModeOverrideProfileID = nil
+ return
+ }
+
+ self.promptModeOverrideText = SettingsStore.combineBasePrompt(
+ for: .dictate,
+ with: SettingsStore.stripBasePrompt(for: .dictate, from: profile.prompt)
+ )
+ NotchContentState.shared.promptModeOverrideProfileName = profile.name
+ NotchContentState.shared.promptModeOverrideProfileID = profile.id
+ }
+ }
+
+ private func beginDictationRecording(for slot: SettingsStore.DictationShortcutSlot, mode: ActiveRecordingMode) {
+ DebugLogger.shared.debug("Begin dictation recording for slot \(slot.rawValue)", source: "ContentView")
+ self.captureRecordingContext()
+ self.applyDictationShortcutSelectionContext(for: slot)
+ self.setActiveRecordingMode(mode)
+ self.rewriteModeService.clearState()
+ self.menuBarManager.setOverlayMode(.dictation)
+
+ guard !self.asr.isRunning else { return }
+ if SettingsStore.shared.enableTranscriptionSounds {
+ TranscriptionSoundPlayer.shared.playStartSound()
+ }
+ Task {
+ await self.asr.start()
+ }
+ }
+
private func callOpenAIChat() async {
guard !self.isCallingAI else { return }
await MainActor.run { self.isCallingAI = true }
diff --git a/Sources/Fluid/Persistence/BackupService.swift b/Sources/Fluid/Persistence/BackupService.swift
index 158de0c0..5ac4e212 100644
--- a/Sources/Fluid/Persistence/BackupService.swift
+++ b/Sources/Fluid/Persistence/BackupService.swift
@@ -18,6 +18,7 @@ struct SettingsBackupPayload: Codable, Equatable {
let promptModeHotkeyShortcut: HotkeyShortcut
let promptModeShortcutEnabled: Bool
let promptModeSelectedPromptID: String?
+ let secondaryDictationPromptOff: Bool?
let commandModeHotkeyShortcut: HotkeyShortcut
let commandModeShortcutEnabled: Bool
let commandModeSelectedModel: String?
@@ -62,6 +63,7 @@ struct SettingsBackupPayload: Codable, Equatable {
let vocabularyBoostingEnabled: Bool
let customDictionaryEntries: [SettingsStore.CustomDictionaryEntry]
let selectedDictationPromptID: String?
+ let dictationPromptOff: Bool?
let selectedEditPromptID: String?
let defaultDictationPromptOverride: String?
let defaultEditPromptOverride: String?
diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swift
index 2749af85..7f9859b8 100644
--- a/Sources/Fluid/Persistence/SettingsStore.swift
+++ b/Sources/Fluid/Persistence/SettingsStore.swift
@@ -88,6 +88,22 @@ final class SettingsStore: ObservableObject {
}
}
+ enum DictationShortcutSlot: String, Codable, CaseIterable, Identifiable {
+ case primary
+ case secondary
+
+ var id: String { self.rawValue }
+
+ var displayName: String {
+ switch self {
+ case .primary:
+ return "Primary Dictation Shortcut"
+ case .secondary:
+ return "Secondary Dictation Shortcut"
+ }
+ }
+ }
+
enum DictationPromptSelection: Equatable {
case off
case `default`
@@ -287,26 +303,34 @@ final class SettingsStore: ObservableObject {
}
var dictationPromptSelection: DictationPromptSelection {
- if self.isDictationPromptOff {
+ self.dictationPromptSelection(for: .primary)
+ }
+
+ func setDictationPromptSelection(_ selection: DictationPromptSelection) {
+ self.setDictationPromptSelection(selection, for: .primary)
+ }
+
+ func dictationPromptSelection(for slot: DictationShortcutSlot) -> DictationPromptSelection {
+ if self.isDictationPromptOff(for: slot) {
return .off
}
- if let promptID = self.selectedDictationPromptID {
+ if let promptID = self.selectedDictationPromptID(for: slot) {
return .profile(promptID)
}
return .default
}
- func setDictationPromptSelection(_ selection: DictationPromptSelection) {
+ func setDictationPromptSelection(_ selection: DictationPromptSelection, for slot: DictationShortcutSlot) {
switch selection {
case .off:
- self.isDictationPromptOff = true
- self.selectedDictationPromptID = nil
+ self.setDictationPromptOff(true, for: slot)
+ self.setSelectedDictationPromptID(nil, for: slot)
case .default:
- self.isDictationPromptOff = false
- self.selectedDictationPromptID = nil
+ self.setDictationPromptOff(false, for: slot)
+ self.setSelectedDictationPromptID(nil, for: slot)
case let .profile(promptID):
- self.isDictationPromptOff = false
- self.selectedDictationPromptID = promptID
+ self.setDictationPromptOff(false, for: slot)
+ self.setSelectedDictationPromptID(promptID, for: slot)
}
}
@@ -371,6 +395,86 @@ final class SettingsStore: ObservableObject {
}
}
+ func selectedDictationPromptID(for slot: DictationShortcutSlot) -> String? {
+ switch slot {
+ case .primary:
+ return self.selectedDictationPromptID
+ case .secondary:
+ return self.promptModeSelectedPromptID
+ }
+ }
+
+ func setSelectedDictationPromptID(_ id: String?, for slot: DictationShortcutSlot) {
+ switch slot {
+ case .primary:
+ self.selectedDictationPromptID = id
+ case .secondary:
+ self.promptModeSelectedPromptID = id
+ }
+ }
+
+ func isDictationPromptOff(for slot: DictationShortcutSlot) -> Bool {
+ switch slot {
+ case .primary:
+ return self.isDictationPromptOff
+ case .secondary:
+ return self.isSecondaryDictationPromptOff
+ }
+ }
+
+ func setDictationPromptOff(_ isOff: Bool, for slot: DictationShortcutSlot) {
+ switch slot {
+ case .primary:
+ self.isDictationPromptOff = isOff
+ case .secondary:
+ self.isSecondaryDictationPromptOff = isOff
+ }
+ }
+
+ func selectedDictationPromptProfile(for slot: DictationShortcutSlot) -> DictationPromptProfile? {
+ guard let id = self.selectedDictationPromptID(for: slot) else { return nil }
+ return self.dictationPromptProfiles.first(where: { $0.id == id && $0.mode.normalized == .dictate })
+ }
+
+ func resolvedDictationPromptProfile(for slot: DictationShortcutSlot, appBundleID: String?) -> DictationPromptProfile? {
+ switch self.dictationPromptSelection(for: slot) {
+ case .off:
+ return nil
+ case let .profile(promptID):
+ return self.dictationPromptProfiles.first(where: { $0.id == promptID && $0.mode.normalized == .dictate })
+ case .default:
+ guard let binding = self.appPromptBinding(for: .dictate, appBundleID: appBundleID) else { return nil }
+ let promptID = binding.promptID
+ return self.dictationPromptProfiles.first {
+ $0.id == promptID && $0.mode.normalized == .dictate
+ }
+ }
+ }
+
+ func isAppDictationPromptBindingActive(for slot: DictationShortcutSlot, appBundleID: String?) -> Bool {
+ guard self.dictationPromptSelection(for: slot) == .default else { return false }
+ return self.hasAppPromptBinding(for: .dictate, appBundleID: appBundleID)
+ }
+
+ func dictationPromptDisplayName(for slot: DictationShortcutSlot, appBundleID: String?) -> String {
+ switch self.dictationPromptSelection(for: slot) {
+ case .off:
+ return "Off"
+ case .default:
+ if let profile = self.resolvedDictationPromptProfile(for: slot, appBundleID: appBundleID) {
+ let name = profile.name.trimmingCharacters(in: .whitespacesAndNewlines)
+ return name.isEmpty ? "Untitled" : name
+ }
+ return "Default"
+ case let .profile(promptID):
+ guard let profile = self.dictationPromptProfiles.first(where: { $0.id == promptID && $0.mode.normalized == .dictate }) else {
+ return "Default"
+ }
+ let name = profile.name.trimmingCharacters(in: .whitespacesAndNewlines)
+ return name.isEmpty ? "Untitled" : name
+ }
+ }
+
func setSelectedPromptID(_ id: String?, for mode: PromptMode) {
switch mode.normalized {
case .dictate:
@@ -802,6 +906,40 @@ final class SettingsStore: ObservableObject {
self.promptResolution(for: mode, appBundleID: appBundleID).profile
}
+ func effectiveDictationPromptBody(for slot: DictationShortcutSlot, appBundleID: String? = nil) -> String {
+ switch self.dictationPromptSelection(for: slot) {
+ case .off:
+ return ""
+ case .default:
+ return self.effectivePromptBody(for: .dictate, appBundleID: appBundleID)
+ case let .profile(promptID):
+ guard let profile = self.dictationPromptProfiles.first(where: { $0.id == promptID && $0.mode.normalized == .dictate }) else {
+ return self.effectivePromptBody(for: .dictate, appBundleID: appBundleID)
+ }
+ let body = Self.stripBasePrompt(for: .dictate, from: profile.prompt)
+ if !body.isEmpty {
+ return body
+ }
+ return self.effectivePromptBody(for: .dictate, appBundleID: appBundleID)
+ }
+ }
+
+ func effectiveDictationSystemPrompt(for slot: DictationShortcutSlot, appBundleID: String? = nil) -> String {
+ switch self.dictationPromptSelection(for: slot) {
+ case .off, .default:
+ return self.effectiveSystemPrompt(for: .dictate, appBundleID: appBundleID)
+ case let .profile(promptID):
+ guard let profile = self.dictationPromptProfiles.first(where: { $0.id == promptID && $0.mode.normalized == .dictate }) else {
+ return self.effectiveSystemPrompt(for: .dictate, appBundleID: appBundleID)
+ }
+ let body = Self.stripBasePrompt(for: .dictate, from: profile.prompt)
+ if !body.isEmpty {
+ return Self.combineBasePrompt(for: .dictate, with: body)
+ }
+ return self.effectiveSystemPrompt(for: .dictate, appBundleID: appBundleID)
+ }
+ }
+
func effectivePromptBody(for mode: PromptMode, appBundleID: String? = nil) -> String {
self.promptResolution(for: mode, appBundleID: appBundleID).promptBody
}
@@ -1692,6 +1830,17 @@ final class SettingsStore: ObservableObject {
}
}
+ var isSecondaryDictationPromptOff: Bool {
+ get {
+ let value = self.defaults.object(forKey: Keys.secondaryDictationPromptOff)
+ return value as? Bool ?? false
+ }
+ set {
+ objectWillChange.send()
+ self.defaults.set(newValue, forKey: Keys.secondaryDictationPromptOff)
+ }
+ }
+
var commandModeShortcutEnabled: Bool {
get {
let value = self.defaults.object(forKey: Keys.commandModeShortcutEnabled)
@@ -1993,6 +2142,7 @@ final class SettingsStore: ObservableObject {
promptModeHotkeyShortcut: self.promptModeHotkeyShortcut,
promptModeShortcutEnabled: self.promptModeShortcutEnabled,
promptModeSelectedPromptID: self.promptModeSelectedPromptID,
+ secondaryDictationPromptOff: self.isSecondaryDictationPromptOff,
commandModeHotkeyShortcut: self.commandModeHotkeyShortcut,
commandModeShortcutEnabled: self.commandModeShortcutEnabled,
commandModeSelectedModel: self.commandModeSelectedModel,
@@ -2037,6 +2187,7 @@ final class SettingsStore: ObservableObject {
vocabularyBoostingEnabled: self.vocabularyBoostingEnabled,
customDictionaryEntries: self.customDictionaryEntries,
selectedDictationPromptID: self.selectedDictationPromptID,
+ dictationPromptOff: self.isDictationPromptOff,
selectedEditPromptID: self.selectedEditPromptID,
defaultDictationPromptOverride: self.defaultDictationPromptOverride,
defaultEditPromptOverride: self.defaultEditPromptOverride
@@ -2108,10 +2259,12 @@ final class SettingsStore: ObservableObject {
self.dictationPromptProfiles = promptProfiles
self.appPromptBindings = appPromptBindings
self.selectedDictationPromptID = payload.selectedDictationPromptID
+ self.isDictationPromptOff = payload.dictationPromptOff ?? self.isDictationPromptOff
self.selectedEditPromptID = payload.selectedEditPromptID
self.defaultDictationPromptOverride = payload.defaultDictationPromptOverride
self.defaultEditPromptOverride = payload.defaultEditPromptOverride
self.promptModeSelectedPromptID = payload.promptModeSelectedPromptID
+ self.isSecondaryDictationPromptOff = payload.secondaryDictationPromptOff ?? false
self.normalizePromptSelectionsIfNeeded()
}
@@ -2207,13 +2360,17 @@ final class SettingsStore: ObservableObject {
} else if self.defaults.object(forKey: Keys.enableAIProcessing) != nil {
shouldStartOff = !self.defaults.bool(forKey: Keys.enableAIProcessing)
} else {
- shouldStartOff = false
+ shouldStartOff = true
}
self.defaults.set(shouldStartOff, forKey: Keys.dictationPromptOff)
}
private func normalizePromptSelectionsIfNeeded() {
+ if self.defaults.object(forKey: Keys.secondaryDictationPromptOff) == nil {
+ self.defaults.set(false, forKey: Keys.secondaryDictationPromptOff)
+ }
+
// One-time migration to unified edit keys.
if self.defaults.object(forKey: Keys.selectedEditPromptID) == nil,
let migratedSelectedEditID = self.selectedEditPromptID
@@ -3385,6 +3542,7 @@ private extension SettingsStore {
static let promptModeHotkeyShortcut = "PromptModeHotkeyShortcut"
static let promptModeShortcutEnabled = "PromptModeShortcutEnabled"
static let promptModeSelectedPromptID = "PromptModeSelectedPromptID"
+ static let secondaryDictationPromptOff = "SecondaryDictationPromptOff"
// Rewrite Mode Keys
static let rewriteModeHotkeyShortcut = "RewriteModeHotkeyShortcut"
diff --git a/Sources/Fluid/Services/DictationAIPostProcessingGate.swift b/Sources/Fluid/Services/DictationAIPostProcessingGate.swift
index 21816754..74749a43 100644
--- a/Sources/Fluid/Services/DictationAIPostProcessingGate.swift
+++ b/Sources/Fluid/Services/DictationAIPostProcessingGate.swift
@@ -7,8 +7,12 @@ enum DictationAIPostProcessingGate {
/// - For Apple Intelligence: requires `AppleIntelligenceService.isAvailable`
/// - For other providers: requires a local endpoint OR a non-empty API key
static func isConfigured() -> Bool {
+ self.isConfigured(for: .primary)
+ }
+
+ static func isConfigured(for slot: SettingsStore.DictationShortcutSlot) -> Bool {
let settings = SettingsStore.shared
- guard !settings.isDictationPromptOff else { return false }
+ guard settings.dictationPromptSelection(for: slot) != .off else { return false }
return self.isProviderConfigured()
}
diff --git a/Sources/Fluid/UI/AISettings/AIEnhancementSettingsViewModel.swift b/Sources/Fluid/UI/AISettings/AIEnhancementSettingsViewModel.swift
index 44a8d00a..50be6cc7 100644
--- a/Sources/Fluid/UI/AISettings/AIEnhancementSettingsViewModel.swift
+++ b/Sources/Fluid/UI/AISettings/AIEnhancementSettingsViewModel.swift
@@ -1494,12 +1494,11 @@ final class AIEnhancementSettingsViewModel: ObservableObject {
return trimmed.isEmpty ? "Untitled Prompt" : trimmed
}
- func isPromptSelectionOff(for mode: SettingsStore.PromptMode) -> Bool {
- mode.normalized == .dictate && self.settings.isDictationPromptOff
+ func isPrimaryDictationPromptSelectionOff() -> Bool {
+ self.settings.isDictationPromptOff
}
- func selectPromptOff(for mode: SettingsStore.PromptMode) {
- guard mode.normalized == .dictate else { return }
+ func selectPrimaryDictationPromptOff() {
self.settings.setDictationPromptSelection(.off)
self.selectedDictationPromptID = self.settings.selectedDictationPromptID
self.isDictationPromptOff = self.settings.isDictationPromptOff
diff --git a/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift b/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
index 5ccb2350..dc62136a 100644
--- a/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
+++ b/Sources/Fluid/UI/AISettingsView+AdvancedSettings.swift
@@ -20,7 +20,7 @@ extension AIEnhancementSettingsView {
Text("Prompt Profiles")
.font(.system(size: 15, weight: .semibold))
.foregroundStyle(self.theme.palette.primaryText)
- Text(" - Pick one prompt for Dictate and one for Edit Text.")
+ Text(" - Manage prompt bodies here. Shortcut assignment lives in Keyboard Shortcuts.")
.font(.system(size: 13))
.foregroundStyle(self.theme.palette.secondaryText)
}
@@ -182,7 +182,7 @@ extension AIEnhancementSettingsView {
.frame(width: 20, height: 20)
.background(Circle().fill(tone.opacity(mode.normalized == .dictate ? 0.85 : 0.65)))
HStack(alignment: .firstTextBaseline, spacing: 0) {
- Text(mode.normalized == .dictate ? "Dictate Mode" : "Edit Text Mode")
+ Text(mode.normalized == .dictate ? "Dictation Prompt Profiles" : "Edit Text Mode")
.font(.system(size: 13, weight: .semibold))
.foregroundStyle(self.theme.palette.primaryText)
Text(" - \(self.promptSectionDescription(for: mode))")
@@ -194,6 +194,13 @@ extension AIEnhancementSettingsView {
}
.padding(.horizontal, 2)
+ if mode.normalized == .dictate {
+ Text("Selection indicators here preview the primary dictation shortcut. Assign each shortcut in Keyboard Shortcuts.")
+ .font(.caption2)
+ .foregroundStyle(self.theme.palette.secondaryText)
+ .padding(.horizontal, 4)
+ }
+
if mode.normalized == .edit {
self.editModeProviderModelRow
}
@@ -202,21 +209,23 @@ extension AIEnhancementSettingsView {
self.promptProfileCard(
cardKey: "\(mode.normalized.rawValue)-off",
title: "Off",
- subtitle: "Use raw transcription for normal dictation with no AI post-processing.",
+ subtitle: "Use raw transcription for the primary dictation shortcut with no AI post-processing.",
mode: mode,
- isSelected: self.viewModel.isPromptSelectionOff(for: mode),
+ isSelected: self.viewModel.isPrimaryDictationPromptSelectionOff(),
onUse: {
- self.viewModel.selectPromptOff(for: mode)
+ self.viewModel.selectPrimaryDictationPromptOff()
}
)
}
self.promptProfileCard(
cardKey: "\(mode.normalized.rawValue)-default",
- title: "Default \(self.friendlyModeName(mode))",
+ title: mode.normalized == .dictate ? "Default Dictation Prompt" : "Default \(self.friendlyModeName(mode))",
subtitle: self.viewModel.promptPreview(self.viewModel.defaultPromptBodyPreview(for: mode)),
mode: mode,
- isSelected: !self.viewModel.isPromptSelectionOff(for: mode) && self.viewModel.selectedPromptID(for: mode) == nil,
+ isSelected: mode.normalized == .dictate
+ ? (!self.viewModel.isPrimaryDictationPromptSelectionOff() && self.viewModel.selectedPromptID(for: mode) == nil)
+ : self.viewModel.selectedPromptID(for: mode) == nil,
onUse: {
self.viewModel.setSelectedPromptID(nil, for: mode)
},
@@ -646,7 +655,7 @@ extension AIEnhancementSettingsView {
private func promptSectionDescription(for mode: SettingsStore.PromptMode) -> String {
switch mode {
case .dictate:
- return "No selected-text context - Process raw voice text - clean, write into email, convert terminal commands, translate etc."
+ return "Create dictation prompt bodies here. The primary shortcut preview is shown here; both shortcut assignments are set in Keyboard Shortcuts."
case .edit, .write, .rewrite:
return "Uses selected text as context (when text is selected) - Edit or rewrite selected text - answer questions, summarize, convert to bullets etc."
}
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index 1c771179..f6dfcc4f 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -117,6 +117,52 @@ struct SettingsView: View {
)
}
+ private func dictationPromptSelectionBinding(for slot: SettingsStore.DictationShortcutSlot) -> Binding<String> {
+ Binding(
+ get: {
+ switch self.settings.dictationPromptSelection(for: slot) {
+ case .off:
+ return "__OFF__"
+ case .default:
+ return "__DEFAULT__"
+ case let .profile(id):
+ return id
+ }
+ },
+ set: { newValue in
+ switch newValue {
+ case "__OFF__":
+ self.settings.setDictationPromptSelection(.off, for: slot)
+ case "__DEFAULT__":
+ self.settings.setDictationPromptSelection(.default, for: slot)
+ default:
+ self.settings.setDictationPromptSelection(.profile(newValue), for: slot)
+ }
+ }
+ )
+ }
+
+ @ViewBuilder
+ private func dictationPromptPicker(for slot: SettingsStore.DictationShortcutSlot) -> some View {
+ let profiles = self.settings.promptProfiles(for: .dictate)
+ HStack {
+ Text("AI Prompt")
+ .font(.subheadline)
+ .foregroundStyle(.secondary)
+ .padding(.leading, 30)
+ Spacer()
+ Picker("", selection: self.dictationPromptSelectionBinding(for: slot)) {
+ Text("Off").tag("__OFF__")
+ Text("Default").tag("__DEFAULT__")
+ ForEach(profiles) { profile in
+ Text(profile.name.isEmpty ? "Untitled" : profile.name).tag(profile.id)
+ }
+ }
+ .frame(width: 190)
+ }
+ .padding(.bottom, 4)
+ }
+
var body: some View {
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 16) {
@@ -524,7 +570,7 @@ struct SettingsView: View {
Spacer()
if self.accessibilityEnabled {
- if self.isRecordingShortcut || self.isRecordingCommandModeShortcut || self.isRecordingRewriteShortcut || self.isRecordingCancelShortcut {
+ if self.isRecordingShortcut || self.isRecordingPromptModeShortcut || self.isRecordingCommandModeShortcut || self.isRecordingRewriteShortcut || self.isRecordingCancelShortcut {
Text("Recording…")
.font(.caption.weight(.semibold))
.foregroundStyle(.orange)
@@ -547,7 +593,7 @@ struct SettingsView: View {
if self.accessibilityEnabled {
VStack(alignment: .leading, spacing: 12) {
- if self.isRecordingShortcut || self.isRecordingCommandModeShortcut || self.isRecordingRewriteShortcut || self.isRecordingCancelShortcut {
+ if self.isRecordingShortcut || self.isRecordingPromptModeShortcut || self.isRecordingCommandModeShortcut || self.isRecordingRewriteShortcut || self.isRecordingCancelShortcut {
HStack(spacing: 8) {
Image(systemName: "hand.point.up.left.fill")
.foregroundStyle(.orange)
@@ -580,8 +626,8 @@ struct SettingsView: View {
self.shortcutRow(
icon: "mic.fill",
iconColor: .secondary,
- title: "Transcribe Mode",
- description: "Dictate text anywhere",
+ title: "Primary Dictation Shortcut",
+ description: "Defaults to raw transcription, but can use Off, Default, or any custom prompt.",
shortcut: self.hotkeyShortcut,
isRecording: self.isRecordingShortcut,
onChangePressed: {
@@ -589,13 +635,14 @@ struct SettingsView: View {
self.isRecordingShortcut = true
}
)
+ self.dictationPromptPicker(for: .primary)
Divider().opacity(0.2).padding(.vertical, 4)
self.shortcutRow(
icon: "text.bubble.fill",
iconColor: .secondary,
- title: "Transcribe with Prompt",
- description: "Dictate with a specific AI prompt",
+ title: "Secondary Dictation Shortcut",
+ description: "Defaults to Default cleanup, but can use Off, Default, or any custom prompt.",
shortcut: self.promptModeShortcut,
isRecording: self.isRecordingPromptModeShortcut,
isEnabled: self.$promptModeShortcutEnabled,
@@ -606,35 +653,7 @@ struct SettingsView: View {
)
if self.promptModeShortcutEnabled {
- let profiles = self.settings.promptProfiles(for: .dictate)
- if !profiles.isEmpty {
- HStack {
- Text("Prompt")
- .font(.subheadline)
- .foregroundStyle(.secondary)
- .padding(.leading, 30)
- Spacer()
- Picker("", selection: Binding(
- get: { self.settings.promptModeSelectedPromptID ?? "" },
- set: { newValue in
- self.settings.promptModeSelectedPromptID = newValue.isEmpty ? nil : newValue
- }
- )) {
- Text("Select a prompt...").tag("")
- ForEach(profiles) { profile in
- Text(profile.name.isEmpty ? "Untitled" : profile.name).tag(profile.id)
- }
- }
- .frame(width: 170)
- }
- .padding(.bottom, 4)
- } else {
- Text("Add prompts in AI Enhancements → Prompt Profiles")
- .font(.caption)
- .foregroundStyle(.secondary)
- .padding(.leading, 30)
- .padding(.bottom, 4)
- }
+ self.dictationPromptPicker(for: .secondary)
}
Divider().opacity(0.2).padding(.vertical, 4)
diff --git a/Sources/Fluid/Views/BottomOverlayView.swift b/Sources/Fluid/Views/BottomOverlayView.swift
index bac70cbc..f61dd05f 100644
--- a/Sources/Fluid/Views/BottomOverlayView.swift
+++ b/Sources/Fluid/Views/BottomOverlayView.swift
@@ -1235,10 +1235,11 @@ private struct BottomOverlayPromptMenuView: View {
@ViewBuilder
private func offRow() -> some View {
- let isSelected = self.settings.isDictationPromptOff
+ let activeSlot = self.contentState.activeDictationShortcutSlot ?? .primary
+ let isSelected = self.settings.dictationPromptSelection(for: activeSlot) == .off
Button(action: {
- if self.contentState.isPromptModeActive, self.promptMode.normalized == .dictate {
- self.contentState.onPromptModeProfileChangeRequested?(nil)
+ if self.promptMode.normalized == .dictate {
+ self.contentState.onDictationPromptSelectionRequested?(.off)
} else {
self.settings.setDictationPromptSelection(.off)
}
@@ -1265,12 +1266,13 @@ private struct BottomOverlayPromptMenuView: View {
@ViewBuilder
private func defaultRow(selectedID: String?) -> some View {
- let isSelected = !self.settings.isDictationPromptOff && selectedID == nil
+ let activeSlot = self.contentState.activeDictationShortcutSlot ?? .primary
+ let isSelected = self.promptMode.normalized == .dictate
+ ? (self.settings.dictationPromptSelection(for: activeSlot) == .default)
+ : (selectedID == nil)
Button(action: {
- if self.contentState.isPromptModeActive, self.promptMode.normalized == .dictate {
- self.contentState.onPromptModeProfileChangeRequested?(nil)
- } else if self.promptMode.normalized == .dictate {
- self.settings.setDictationPromptSelection(.default)
+ if self.promptMode.normalized == .dictate {
+ self.contentState.onDictationPromptSelectionRequested?(.default)
} else {
self.settings.setSelectedPromptID(nil, for: self.promptMode)
}
@@ -1297,10 +1299,13 @@ private struct BottomOverlayPromptMenuView: View {
@ViewBuilder
private func profileRow(_ profile: SettingsStore.DictationPromptProfile, selectedID: String?) -> some View {
- let isSelected = selectedID == profile.id
+ let activeSlot = self.contentState.activeDictationShortcutSlot ?? .primary
+ let isSelected = self.promptMode.normalized == .dictate
+ ? (self.settings.dictationPromptSelection(for: activeSlot) == .profile(profile.id))
+ : (selectedID == profile.id)
Button(action: {
- if self.contentState.isPromptModeActive, self.promptMode.normalized == .dictate {
- self.contentState.onPromptModeProfileChangeRequested?(profile)
+ if self.promptMode.normalized == .dictate {
+ self.contentState.onDictationPromptSelectionRequested?(.profile(profile.id))
} else {
self.settings.setSelectedPromptID(profile.id, for: self.promptMode)
}
@@ -1802,13 +1807,17 @@ struct BottomOverlayView: View {
self.activeAppMonitor.activeAppBundleID
}
+ private var activeDictationShortcutSlot: SettingsStore.DictationShortcutSlot {
+ self.contentState.activeDictationShortcutSlot ?? .primary
+ }
+
private var isAppPromptOverrideActive: Bool {
guard let activePromptMode else { return false }
- if activePromptMode.normalized == .dictate &&
- self.settings.isDictationPromptOff &&
- !self.contentState.isPromptModeActive
- {
- return false
+ if activePromptMode.normalized == .dictate {
+ return self.settings.isAppDictationPromptBindingActive(
+ for: self.activeDictationShortcutSlot,
+ appBundleID: self.promptResolutionBundleID
+ )
}
return self.settings.hasAppPromptBinding(
for: activePromptMode,
@@ -1817,15 +1826,12 @@ struct BottomOverlayView: View {
}
private var selectedPromptLabel: String {
- if let overrideName = self.contentState.promptModeOverrideProfileName {
- return overrideName
- }
guard let activePromptMode else { return "N/A" }
- if activePromptMode.normalized == .dictate &&
- self.settings.isDictationPromptOff &&
- !self.contentState.isPromptModeActive
- {
- return "Off"
+ if activePromptMode.normalized == .dictate {
+ return self.settings.dictationPromptDisplayName(
+ for: self.activeDictationShortcutSlot,
+ appBundleID: self.promptResolutionBundleID
+ )
}
if let profile = self.settings.resolvedPromptProfile(
for: activePromptMode,
@@ -2086,7 +2092,7 @@ struct BottomOverlayView: View {
private var promptSelectorTrigger: some View {
HStack(spacing: 5) {
- Text("AI:")
+ Text("AI Prompt:")
.font(.system(size: self.promptSelectorFontSize, weight: .medium))
.foregroundStyle(.white.opacity(0.5))
.lineLimit(1)
diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swift
index bba198f1..a5a8e76d 100644
--- a/Sources/Fluid/Views/NotchContentViews.swift
+++ b/Sources/Fluid/Views/NotchContentViews.swift
@@ -20,12 +20,13 @@ class NotchContentState: ObservableObject {
@Published var mode: OverlayMode = .dictation
@Published var promptPickerMode: SettingsStore.PromptMode = .dictate
@Published var isProcessing: Bool = false // AI processing state
+ @Published var activeDictationShortcutSlot: SettingsStore.DictationShortcutSlot? = nil
@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)
@Published var isPromptModeActive: Bool = false // True for the entire prompt-mode session, even when no profile is selected
- /// Called when the user picks a different prompt from the overlay during prompt mode recording.
- var onPromptModeProfileChangeRequested: ((SettingsStore.DictationPromptProfile?) -> Void)?
+ /// Called when the user picks a different dictation prompt from the overlay during recording.
+ var onDictationPromptSelectionRequested: ((SettingsStore.DictationPromptSelection) -> Void)?
/// Icon of the target app (where text will be typed)
@Published var targetAppIcon: NSImage?
@@ -347,13 +348,17 @@ struct NotchExpandedView: View {
self.activeAppMonitor.activeAppBundleID
}
+ private var activeDictationShortcutSlot: SettingsStore.DictationShortcutSlot {
+ self.contentState.activeDictationShortcutSlot ?? .primary
+ }
+
private var isAppPromptOverrideActive: Bool {
guard let activePromptMode else { return false }
- if activePromptMode.normalized == .dictate &&
- self.settings.isDictationPromptOff &&
- !self.contentState.isPromptModeActive
- {
- return false
+ if activePromptMode.normalized == .dictate {
+ return self.settings.isAppDictationPromptBindingActive(
+ for: self.activeDictationShortcutSlot,
+ appBundleID: self.promptResolutionBundleID
+ )
}
return self.settings.hasAppPromptBinding(
for: activePromptMode,
@@ -362,15 +367,12 @@ struct NotchExpandedView: View {
}
private var selectedPromptLabel: String {
- if let overrideName = self.contentState.promptModeOverrideProfileName {
- return overrideName
- }
guard let activePromptMode else { return "N/A" }
- if activePromptMode.normalized == .dictate &&
- self.settings.isDictationPromptOff &&
- !self.contentState.isPromptModeActive
- {
- return "Off"
+ if activePromptMode.normalized == .dictate {
+ return self.settings.dictationPromptDisplayName(
+ for: self.activeDictationShortcutSlot,
+ appBundleID: self.promptResolutionBundleID
+ )
}
if let profile = self.settings.resolvedPromptProfile(
for: activePromptMode,
@@ -405,13 +407,12 @@ 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.isPromptModeActive
+ let activeDictationSlot = self.activeDictationShortcutSlot
return VStack(alignment: .leading, spacing: 0) {
- if promptMode.normalized == .dictate && !isInPromptMode {
+ if promptMode.normalized == .dictate {
Button(action: {
- self.settings.setDictationPromptSelection(.off)
+ self.contentState.onDictationPromptSelectionRequested?(.off)
let pid = NotchContentState.shared.recordingTargetPID
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
if let pid { _ = TypingService.activateApp(pid: pid) }
@@ -421,7 +422,7 @@ struct NotchExpandedView: View {
HStack {
Text("Off")
Spacer()
- let isSelected = !isInPromptMode && self.settings.isDictationPromptOff
+ let isSelected = self.settings.dictationPromptSelection(for: activeDictationSlot) == .off
if isSelected {
Image(systemName: "checkmark")
.font(.system(size: 10, weight: .semibold))
@@ -436,14 +437,10 @@ struct NotchExpandedView: View {
}
Button(action: {
- if isInPromptMode {
- self.contentState.onPromptModeProfileChangeRequested?(nil)
+ if promptMode.normalized == .dictate {
+ self.contentState.onDictationPromptSelectionRequested?(.default)
} else {
- if promptMode.normalized == .dictate {
- self.settings.setDictationPromptSelection(.default)
- } else {
- self.settings.setSelectedPromptID(nil, for: promptMode)
- }
+ self.settings.setSelectedPromptID(nil, for: promptMode)
}
let pid = NotchContentState.shared.recordingTargetPID
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
@@ -454,9 +451,9 @@ struct NotchExpandedView: View {
HStack {
Text("Default")
Spacer()
- let isSelected = isInPromptMode
- ? (self.contentState.promptModeOverrideProfileID == nil)
- : (!self.settings.isDictationPromptOff && self.settings.selectedPromptID(for: promptMode) == nil)
+ 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))
@@ -472,8 +469,8 @@ struct NotchExpandedView: View {
ForEach(self.settings.promptProfiles(for: promptMode)) { profile in
Button(action: {
- if isInPromptMode {
- self.contentState.onPromptModeProfileChangeRequested?(profile)
+ if promptMode.normalized == .dictate {
+ self.contentState.onDictationPromptSelectionRequested?(.profile(profile.id))
} else {
self.settings.setSelectedPromptID(profile.id, for: promptMode)
}
@@ -486,8 +483,8 @@ struct NotchExpandedView: View {
HStack {
Text(profile.name.isEmpty ? "Untitled" : profile.name)
Spacer()
- let isSelected = isInPromptMode
- ? (self.contentState.promptModeOverrideProfileID == profile.id)
+ 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")
@@ -552,7 +549,7 @@ struct NotchExpandedView: View {
if !self.contentState.isProcessing {
ZStack(alignment: .top) {
HStack(spacing: 6) {
- Text("AI:")
+ Text("AI Prompt:")
.font(.system(size: 9, weight: .medium))
.foregroundStyle(.white.opacity(0.5))
Text(self.selectedPromptLabel)