diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift index 2845e9201..51fcc7b75 100644 --- a/Sources/Fluid/ContentView.swift +++ b/Sources/Fluid/ContentView.swift @@ -99,7 +99,7 @@ enum ShortcutRecordingTarget: Hashable { case .primaryDictation: return "Primary Dictation Shortcut" case .secondaryDictation: - return "Secondary Dictation Shortcut" + return "AI Prompt Dictation Shortcut" case .command: return "Command Mode" case .edit: @@ -491,6 +491,9 @@ struct ContentView: View { } private func handlePromptShortcutEnabledChange(_ isEnabled: Bool) { + if isEnabled, SettingsStore.shared.dictationPromptSelection(for: .secondary) == .off { + SettingsStore.shared.setDictationPromptSelection(.default, for: .secondary) + } SettingsStore.shared.promptModeShortcutEnabled = isEnabled self.hotkeyManager?.updatePromptModeShortcutEnabled(isEnabled) @@ -1147,8 +1150,7 @@ struct ContentView: View { switch target { case .secondaryDictation: self.isPromptModeShortcutEnabled = enabled - SettingsStore.shared.promptModeShortcutEnabled = enabled - self.hotkeyManager?.updatePromptModeShortcutEnabled(enabled) + self.handlePromptShortcutEnabledChange(enabled) case .command: self.isCommandModeShortcutEnabled = enabled SettingsStore.shared.commandModeShortcutEnabled = enabled @@ -1773,6 +1775,7 @@ struct ContentView: View { primaryDictationShortcuts: self.$primaryDictationShortcuts, activeShortcutRecordingTarget: self.$activeShortcutRecordingTarget, shortcutRecordingMessage: self.$shortcutRecordingMessage, + promptModeShortcut: self.$promptModeHotkeyShortcut, commandModeShortcut: self.$commandModeHotkeyShortcut, rewriteShortcut: self.$rewriteModeHotkeyShortcut, cancelRecordingShortcut: self.$cancelRecordingHotkeyShortcut, @@ -1780,6 +1783,7 @@ struct ContentView: View { commandModeShortcutEnabled: self.$isCommandModeShortcutEnabled, rewriteShortcutEnabled: self.$isRewriteModeShortcutEnabled, pasteLastTranscriptionShortcutEnabled: self.$isPasteLastTranscriptionShortcutEnabled, + promptModeShortcutEnabled: self.$isPromptModeShortcutEnabled, hotkeyManagerInitialized: self.$hotkeyManagerInitialized, hotkeyMode: self.$hotkeyMode, enableStreamingPreview: self.$enableStreamingPreview, diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift index bf6eead2c..fa5416c38 100644 --- a/Sources/Fluid/UI/SettingsView.swift +++ b/Sources/Fluid/UI/SettingsView.swift @@ -42,6 +42,7 @@ struct SettingsView: View { @Binding var primaryDictationShortcuts: [HotkeyShortcut] @Binding var activeShortcutRecordingTarget: ShortcutRecordingTarget? @Binding var shortcutRecordingMessage: String? + @Binding var promptModeShortcut: HotkeyShortcut @Binding var commandModeShortcut: HotkeyShortcut? @Binding var rewriteShortcut: HotkeyShortcut @Binding var cancelRecordingShortcut: HotkeyShortcut @@ -49,6 +50,7 @@ struct SettingsView: View { @Binding var commandModeShortcutEnabled: Bool @Binding var rewriteShortcutEnabled: Bool @Binding var pasteLastTranscriptionShortcutEnabled: Bool + @Binding var promptModeShortcutEnabled: Bool @Binding var hotkeyManagerInitialized: Bool @Binding var hotkeyMode: HotkeyActivationMode @Binding var enableStreamingPreview: Bool @@ -709,6 +711,28 @@ struct SettingsView: View { self.dictationPromptPicker(for: .primary) Divider().opacity(0.2).padding(.vertical, 4) + self.shortcutRow( + content: .init( + icon: "sparkles", + iconColor: .secondary, + title: "AI Prompt Dictation", + description: "Transcribe and improve speech with a selected AI prompt" + ), + shortcut: self.promptModeShortcut, + isRecording: self.isRecording(.secondaryDictation), + isAnyRecordingActive: self.isRecordingAnyShortcut, + recordingMessage: self.isRecording(.secondaryDictation) ? self.shortcutRecordingMessage : nil, + isEnabled: self.$promptModeShortcutEnabled, + requiresShortcutToEnable: true, + onChangePressed: { + DebugLogger.shared.debug("Starting to record new AI prompt shortcut", source: "SettingsView") + self.shortcutRecordingMessage = nil + self.activeShortcutRecordingTarget = .secondaryDictation + } + ) + self.dictationPromptPicker(for: .secondary) + Divider().opacity(0.2).padding(.vertical, 4) + self.shortcutRow( content: .init( icon: "terminal.fill",