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

feat(history): arrow-key navigation and Cmd-C copy in the History list (#1183)

Fe2-O39e3cea539dcf
diff --git a/Sources/Fluid/UI/TranscriptionHistoryView.swift b/Sources/Fluid/UI/TranscriptionHistoryView.swift
index dc893acb..39a25fa3 100644
--- a/Sources/Fluid/UI/TranscriptionHistoryView.swift
+++ b/Sources/Fluid/UI/TranscriptionHistoryView.swift
@@ -42,6 +42,7 @@ struct TranscriptionHistoryView: View {
@State private var copyFeedbackTask: Task<Void, Never>?
@State private var availableAudioFiles: Set<String> = []
@State private var audioAvailabilityRevision = UUID()
+ @FocusState private var listFocused: Bool
private struct AudioAvailabilityRequest: Equatable {
let fileNames: [String]
@@ -236,6 +237,15 @@ struct TranscriptionHistoryView: View {
.padding(.horizontal, 8)
.padding(.vertical, 6)
}
+ .focusable()
+ .focusEffectDisabled()
+ .focused(self.$listFocused)
+ .onMoveCommand { direction in
+ self.moveSelection(direction, proxy: proxy)
+ }
+ .onCopyCommand {
+ self.copyCommandProviders()
+ }
.onAppear { self.reveal(self.selectedEntryID, with: proxy) }
.onChange(of: self.historyStore.selectedEntryID) { _, id in self.reveal(id, with: proxy) }
.task(id: self.pinRevealRequest) {
@@ -281,6 +291,7 @@ struct TranscriptionHistoryView: View {
ZStack(alignment: .bottomTrailing) {
Button {
self.selectedEntryID = entry.id
+ self.listFocused = true
} label: {
VStack(alignment: .leading, spacing: 7) {
HStack(spacing: 8) {
@@ -329,6 +340,7 @@ struct TranscriptionHistoryView: View {
.buttonStyle(.plain)
.simultaneousGesture(TapGesture(count: 2).onEnded {
self.selectedEntryID = entry.id
+ self.listFocused = true
self.copyFinalText(entry)
})
.help("Double-click to copy final text")
@@ -691,6 +703,10 @@ struct TranscriptionHistoryView: View {
private func copyFinalText(_ entry: TranscriptionHistoryEntry) {
guard let text = entry.clipboardText else { return }
self.copyToClipboard(text)
+ self.showCopiedFeedback(for: entry)
+ }
+
+ private func showCopiedFeedback(for entry: TranscriptionHistoryEntry) {
self.copyFeedbackTask?.cancel()
self.copiedEntryID = entry.id
self.copyFeedbackTask = Task { @MainActor in
@@ -699,6 +715,28 @@ struct TranscriptionHistoryView: View {
}
}
+ private func moveSelection(_ direction: MoveCommandDirection, proxy: ScrollViewProxy) {
+ let entries = self.filteredEntries
+ guard !entries.isEmpty else { return }
+ let current = self.selectedEntryID.flatMap { id in entries.firstIndex(where: { $0.id == id }) }
+ let next: Int
+ switch direction {
+ case .up: next = max((current ?? 0) - 1, 0)
+ case .down: next = current.map { min($0 + 1, entries.count - 1) } ?? 0
+ default: return
+ }
+ let id = entries[next].id
+ self.selectedEntryID = id
+ proxy.scrollTo(id)
+ }
+
+ private func copyCommandProviders() -> [NSItemProvider] {
+ guard let entry = self.selectedEntry, let text = entry.clipboardText else { return [] }
+ ClipboardAudit.record("ui_copy_command")
+ self.showCopiedFeedback(for: entry)
+ return [NSItemProvider(object: text as NSString)]
+ }
+
private func copyToClipboard(_ text: String) {
ClipboardAudit.record("ui_copy_begin")
NSPasteboard.general.clearContents()