mirror of
https://github.com/Louis-CFM/coucou.git
synced 2026-12-07 07:32:35 +09:00
- Mute while dictating: once the blip is heard, every output in use goes quiet (videos, music, calls) and comes back as it was when the microphone closes. A Mac already muted stays muted; a crash mid-dictation is undone at launch. Settings → Coucou Flow → "Mute the Mac while you dictate", on by default. - Nowhere to paste: the pill grows with the words (three lines at most, then "…") and a Copy button. In a web browser, the page itself no longer counts as a text field (YouTube, an article), so the card shows there too. - Custom shortcut: "Hold to dictate" → "Custom shortcut…" unfolds an editor under the row. Hold 1 to 6 keys together, let go, ↩ saves (Esc cancels); the menu then shows the keys in place of "Custom shortcut". An event tap keeps the shortcut's own key (the D of ⌘⇧D) out of the app in front. Plain letters need ⌃, ⌥, ⌘ or fn; a left modifier alone, Esc, ↩ and Caps Lock are refused. FlowChord and FlowShortcutRules are tested in tests/FlowKeyLogicTests.swift. Strings in the 16 languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B9uCpASh6JFgbMYMyYUrBN
74 lines
3.0 KiB
Swift
74 lines
3.0 KiB
Swift
#if !APPSTORE
|
|
import SwiftUI
|
|
|
|
/// Settings → Voice: Flow dictation (hold a key, speak, the words are pasted where you type).
|
|
struct FlowSettingsBox: View {
|
|
@ObservedObject private var flow = FlowDictation.shared
|
|
@State private var editingShortcut = false
|
|
|
|
var body: some View {
|
|
GroupBox(String(localized: "flow.title")) {
|
|
VStack(alignment: .leading, spacing: 10) {
|
|
HStack {
|
|
Toggle(String(localized: "flow.enable"), isOn: $flow.isEnabled)
|
|
Spacer()
|
|
Button(String(localized: "hub.open")) { FlowHubController.shared.show() }
|
|
}
|
|
|
|
Text(String(format: String(localized: "flow.how %@"), flow.key.label))
|
|
.font(.system(size: 11))
|
|
.foregroundColor(.secondary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
|
|
HStack(spacing: 8) {
|
|
Text(String(localized: "flow.key"))
|
|
FlowKeyPicker(editing: $editingShortcut)
|
|
}
|
|
.disabled(!flow.isEnabled)
|
|
|
|
FlowCollapsible(isOpen: editingShortcut) {
|
|
FlowShortcutEditor(active: editingShortcut) { _ in
|
|
withAnimation(FlowMotion.fold) { editingShortcut = false }
|
|
}
|
|
}
|
|
|
|
if flow.key == .fn {
|
|
Text(String(localized: "flow.fn-help"))
|
|
.font(.system(size: 11))
|
|
.foregroundColor(.secondary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
}
|
|
|
|
if flow.isEnabled {
|
|
if flow.trusted {
|
|
Label(String(localized: "flow.access-ok"), systemImage: "checkmark.circle.fill")
|
|
.font(.system(size: 11))
|
|
.foregroundColor(.green)
|
|
} else {
|
|
HStack(alignment: .top, spacing: 6) {
|
|
Image(systemName: "exclamationmark.circle")
|
|
.foregroundColor(.orange)
|
|
VStack(alignment: .leading, spacing: 6) {
|
|
Text(String(localized: "flow.accessibility"))
|
|
.font(.system(size: 11))
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
Button(String(localized: "flow.accessibility-open")) {
|
|
flow.openAccessibilitySettings()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Text(String(localized: "flow.privacy"))
|
|
.font(.system(size: 11))
|
|
.foregroundColor(.secondary)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
}
|
|
.padding(6)
|
|
}
|
|
.onAppear { flow.recheckTrust() }
|
|
}
|
|
}
|
|
#endif
|