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

chore(hotkey): add local debug toggle trigger

altic-dev238ff3f48336
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 77d8c3d5..75737c3e 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -4430,6 +4430,7 @@ struct ContentView: View {
self.isRecordingAnyShortcutCapture
}
)
+ self.hotkeyManager?.registerDebugToggleTriggerIfEnabled()
self.hotkeyManagerInitialized = self.hotkeyManager?.validateEventTapHealth() ?? false
diff --git a/Sources/Fluid/Services/GlobalHotkeyManager+DebugTrigger.swift b/Sources/Fluid/Services/GlobalHotkeyManager+DebugTrigger.swift
new file mode 100644
index 00000000..0ee889c9
--- /dev/null
+++ b/Sources/Fluid/Services/GlobalHotkeyManager+DebugTrigger.swift
@@ -0,0 +1,22 @@
+import Foundation
+
+// MARK: - Local diagnostics trigger
+
+extension GlobalHotkeyManager {
+ /// Lets a local script run the exact hotkey toggle path for latency
+ /// reproduction. Inert unless the defaults flag is set on this machine.
+ func registerDebugToggleTriggerIfEnabled() {
+ guard UserDefaults.standard.bool(forKey: "FluidDebugRemoteToggleEnabled") else { return }
+ DistributedNotificationCenter.default().addObserver(
+ forName: Notification.Name("com.FluidApp.debug.toggleRecording"),
+ object: nil,
+ queue: .main
+ ) { [weak self] _ in
+ Task { @MainActor [weak self] in
+ DebugLogger.shared.info("Debug toggle trigger received", source: "GlobalHotkeyManager")
+ self?.toggleRecording()
+ }
+ }
+ DebugLogger.shared.info("Debug toggle trigger enabled", source: "GlobalHotkeyManager")
+ }
+}
diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swift
index d9392598..7be63684 100644
--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift
+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift
@@ -2358,7 +2358,7 @@ final class GlobalHotkeyManager: NSObject {
return true
}
- private func toggleRecording() {
+ func toggleRecording() {
let toggleStopRequestedAt = ProcessInfo.processInfo.systemUptime
if self.asrService.isRunningOrStarting {
self.logStopInput(requestedAt: toggleStopRequestedAt, route: "toggle")