fixed merge conflicts
This commit is contained in:
parent
154368e616
commit
3e9bd4580d
@ -8,6 +8,7 @@ extension KeyboardShortcuts.Name {
|
|||||||
static let toggleMiniRecorder2 = Self("toggleMiniRecorder2")
|
static let toggleMiniRecorder2 = Self("toggleMiniRecorder2")
|
||||||
static let pasteLastTranscription = Self("pasteLastTranscription")
|
static let pasteLastTranscription = Self("pasteLastTranscription")
|
||||||
static let pasteLastEnhancement = Self("pasteLastEnhancement")
|
static let pasteLastEnhancement = Self("pasteLastEnhancement")
|
||||||
|
static let retryLastTranscription = Self("retryLastTranscription")
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
@ -58,7 +59,7 @@ class HotkeyManager: ObservableObject {
|
|||||||
// Key state tracking
|
// Key state tracking
|
||||||
private var currentKeyState = false
|
private var currentKeyState = false
|
||||||
private var keyPressStartTime: Date?
|
private var keyPressStartTime: Date?
|
||||||
private let briefPressThreshold = 1.7
|
private let briefPressThreshold = 0.8
|
||||||
private var isHandsFreeMode = false
|
private var isHandsFreeMode = false
|
||||||
|
|
||||||
// Debounce for Fn key
|
// Debounce for Fn key
|
||||||
@ -141,25 +142,31 @@ class HotkeyManager: ObservableObject {
|
|||||||
|
|
||||||
self.whisperState = whisperState
|
self.whisperState = whisperState
|
||||||
self.miniRecorderShortcutManager = MiniRecorderShortcutManager(whisperState: whisperState)
|
self.miniRecorderShortcutManager = MiniRecorderShortcutManager(whisperState: whisperState)
|
||||||
|
|
||||||
if KeyboardShortcuts.getShortcut(for: .pasteLastTranscription) == nil {
|
if KeyboardShortcuts.getShortcut(for: .pasteLastTranscription) == nil {
|
||||||
let defaultPasteShortcut = KeyboardShortcuts.Shortcut(.v, modifiers: [.command, .option])
|
let defaultPasteShortcut = KeyboardShortcuts.Shortcut(.v, modifiers: [.command, .option])
|
||||||
KeyboardShortcuts.setShortcut(defaultPasteShortcut, for: .pasteLastTranscription)
|
KeyboardShortcuts.setShortcut(defaultPasteShortcut, for: .pasteLastTranscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardShortcuts.onKeyUp(for: .pasteLastTranscription) { [weak self] in
|
KeyboardShortcuts.onKeyUp(for: .pasteLastTranscription) { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
LastTranscriptionService.pasteLastTranscription(from: self.whisperState.modelContext)
|
LastTranscriptionService.pasteLastTranscription(from: self.whisperState.modelContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardShortcuts.onKeyUp(for: .pasteLastEnhancement) { [weak self] in
|
KeyboardShortcuts.onKeyUp(for: .pasteLastEnhancement) { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
LastTranscriptionService.pasteLastEnhancement(from: self.whisperState.modelContext)
|
LastTranscriptionService.pasteLastEnhancement(from: self.whisperState.modelContext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeyboardShortcuts.onKeyUp(for: .retryLastTranscription) { [weak self] in
|
||||||
|
guard let self = self else { return }
|
||||||
|
Task { @MainActor in
|
||||||
|
LastTranscriptionService.retryLastTranscription(from: self.whisperState.modelContext, whisperState: self.whisperState)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
try? await Task.sleep(nanoseconds: 100_000_000)
|
try? await Task.sleep(nanoseconds: 100_000_000)
|
||||||
@ -436,4 +443,3 @@ class HotkeyManager: ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -74,6 +74,62 @@ struct SettingsView: View {
|
|||||||
subtitle: "Additional shortcuts for VoiceInk"
|
subtitle: "Additional shortcuts for VoiceInk"
|
||||||
) {
|
) {
|
||||||
VStack(alignment: .leading, spacing: 18) {
|
VStack(alignment: .leading, spacing: 18) {
|
||||||
|
// Paste Last Transcription
|
||||||
|
HStack(spacing: 12) {
|
||||||
|
Text("Paste Last Transcription")
|
||||||
|
.font(.system(size: 13, weight: .medium))
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
KeyboardShortcuts.Recorder(for: .pasteLastTranscription)
|
||||||
|
.controlSize(.small)
|
||||||
|
|
||||||
|
InfoTip(
|
||||||
|
title: "Paste Last Transcription",
|
||||||
|
message: "Shortcut for pasting the most recent transcription at current cursor position."
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paste Last Enhancement
|
||||||
|
HStack(spacing: 12) {
|
||||||
|
Text("Paste Last Enhancement")
|
||||||
|
.font(.system(size: 13, weight: .medium))
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
KeyboardShortcuts.Recorder(for: .pasteLastEnhancement)
|
||||||
|
.controlSize(.small)
|
||||||
|
|
||||||
|
InfoTip(
|
||||||
|
title: "Paste Last Enhancement",
|
||||||
|
message: "Shortcut for pasting the most recent AI-enhanced text. If no enhancement exists, nothing is pasted. If the enhancement failed, the error message is pasted."
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add separator after Paste Last Enhancement
|
||||||
|
Divider()
|
||||||
|
|
||||||
|
// Retry Last Transcription
|
||||||
|
HStack(spacing: 12) {
|
||||||
|
Text("Retry Last Transcription")
|
||||||
|
.font(.system(size: 13, weight: .medium))
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
KeyboardShortcuts.Recorder(for: .retryLastTranscription)
|
||||||
|
.controlSize(.small)
|
||||||
|
|
||||||
|
InfoTip(
|
||||||
|
title: "Retry Last Transcription",
|
||||||
|
message: "Re-transcribe the last recorded audio using the current model and copy the result."
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
|
||||||
|
Divider()
|
||||||
|
|
||||||
// Custom Cancel Shortcut
|
// Custom Cancel Shortcut
|
||||||
VStack(alignment: .leading, spacing: 12) {
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
@ -109,42 +165,6 @@ struct SettingsView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Divider()
|
|
||||||
|
|
||||||
// Paste Last Transcription
|
|
||||||
HStack(spacing: 12) {
|
|
||||||
Text("Paste Last Transcription")
|
|
||||||
.font(.system(size: 13, weight: .medium))
|
|
||||||
.foregroundColor(.secondary)
|
|
||||||
|
|
||||||
KeyboardShortcuts.Recorder(for: .pasteLastTranscription)
|
|
||||||
.controlSize(.small)
|
|
||||||
|
|
||||||
InfoTip(
|
|
||||||
title: "Paste Last Transcription",
|
|
||||||
message: "Shortcut for pasting the most recent transcription at current cursor position."
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Paste Last Enhancement
|
|
||||||
HStack(spacing: 12) {
|
|
||||||
Text("Paste Last Enhancement")
|
|
||||||
.font(.system(size: 13, weight: .medium))
|
|
||||||
.foregroundColor(.secondary)
|
|
||||||
|
|
||||||
KeyboardShortcuts.Recorder(for: .pasteLastEnhancement)
|
|
||||||
.controlSize(.small)
|
|
||||||
|
|
||||||
InfoTip(
|
|
||||||
title: "Paste Last Enhancement",
|
|
||||||
message: "Shortcut for pasting the most recent AI-enhanced text. If no enhancement exists, nothing is pasted. If the enhancement failed, the error message is pasted."
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
|
||||||
|
|
||||||
Divider()
|
Divider()
|
||||||
|
|
||||||
// Middle-Click Toggle
|
// Middle-Click Toggle
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user