fix: mic permission check, Fn keycode filter, longer clipboard restore, error icon, TCC hint
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,10 +25,17 @@ final class AppModel: ObservableObject {
|
||||
cleaner: PassthroughCleaner(),
|
||||
inserter: TextInserter(pasteboard: SystemPasteboard(), paster: CGEventPaster())
|
||||
)
|
||||
controller.onStateChange = { [weak self] in self?.state = $0 }
|
||||
controller.onStateChange = { [weak self] in
|
||||
self?.state = $0
|
||||
if $0 == .recording { self?.lastError = nil }
|
||||
}
|
||||
controller.onError = { [weak self] in self?.lastError = $0 }
|
||||
hotkey.onEvent = { [weak self] event in
|
||||
guard let self, self.modelReady else { return }
|
||||
if event == .pressed, AVCaptureDevice.authorizationStatus(for: .audio) != .authorized {
|
||||
self.lastError = "Microfoon-toegang ontbreekt"
|
||||
return
|
||||
}
|
||||
Task { await self.controller.handle(event) }
|
||||
}
|
||||
Task { await start() }
|
||||
@@ -46,7 +53,9 @@ final class AppModel: ObservableObject {
|
||||
|
||||
var iconName: String {
|
||||
switch state {
|
||||
case .idle: return modelReady ? "mic" : "mic.slash"
|
||||
case .idle:
|
||||
if lastError != nil { return "exclamationmark.triangle" }
|
||||
return modelReady ? "mic" : "mic.slash"
|
||||
case .recording: return "mic.fill"
|
||||
case .transcribing, .inserting: return "waveform"
|
||||
}
|
||||
@@ -75,6 +84,13 @@ final class AppModel: ObservableObject {
|
||||
_ = AXIsProcessTrustedWithOptions(["AXTrustedCheckOptionPrompt": true] as CFDictionary)
|
||||
}
|
||||
retryHotkey()
|
||||
transcriber.onProgress = { [weak self] fraction in
|
||||
Task { @MainActor in
|
||||
self?.modelStatus = fraction < 1
|
||||
? "Model downloaden… \(Int(fraction * 100))%"
|
||||
: "Model laden…"
|
||||
}
|
||||
}
|
||||
do {
|
||||
try await transcriber.load()
|
||||
modelReady = true
|
||||
|
||||
@@ -56,6 +56,8 @@ public final class HotkeyMonitor {
|
||||
case .tapDisabledByTimeout, .tapDisabledByUserInput:
|
||||
if let tap { CGEvent.tapEnable(tap: tap, enable: true) }
|
||||
case .flagsChanged:
|
||||
// .maskSecondaryFn is also set while arrows/F-keys are held; only react to the Fn key itself.
|
||||
guard event.getIntegerValueField(.keyboardEventKeycode) == 63 else { return }
|
||||
let fnDown = event.flags.contains(.maskSecondaryFn)
|
||||
if let hotkeyEvent = tracker.process(fnDown: fnDown) {
|
||||
onEvent?(hotkeyEvent)
|
||||
|
||||
@@ -20,7 +20,7 @@ public struct TextInserter: TextInserting {
|
||||
public init(
|
||||
pasteboard: PasteboardProviding,
|
||||
paster: KeystrokePosting,
|
||||
restoreDelay: Duration = .milliseconds(150)
|
||||
restoreDelay: Duration = .milliseconds(400)
|
||||
) {
|
||||
self.pasteboard = pasteboard
|
||||
self.paster = paster
|
||||
|
||||
Reference in New Issue
Block a user