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

fix for preferred device being unavailable

grohith32707e7b6c986d5
diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swift
index 02068361..2410fd45 100644
--- a/Sources/Fluid/ContentView.swift
+++ b/Sources/Fluid/ContentView.swift
@@ -389,9 +389,8 @@ struct ContentView: View {
self.selectedInputUID = sysIn
}
case .manual:
- if let prefIn = SettingsStore.shared.preferredInputDeviceUID {
- self.selectedInputUID = prefIn
- }
+ // The refreshed device list drives the displayed selection.
+ break
}
if let sysOut = AudioDevice.getDefaultOutputDevice()?.uid {
diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swift
index d9807953..115ebc21 100644
--- a/Sources/Fluid/UI/SettingsView.swift
+++ b/Sources/Fluid/UI/SettingsView.swift
@@ -75,6 +75,28 @@ struct SettingsView: View {
let revealAppInFinder: () -> Void
let openApplicationsFolder: () -> Void
+ private var inputDeviceSelection: Binding<String> {
+ Binding(
+ get: { self.selectedInputUID },
+ set: { newUID in
+ guard !newUID.isEmpty else { return }
+ guard !self.asr.isRunning else {
+ DebugLogger.shared.warning(
+ "Cannot change input device during recording",
+ source: "SettingsView"
+ )
+ return
+ }
+
+ self.selectedInputUID = newUID
+ SettingsStore.shared.recordInputDeviceSelection(newUID)
+ if SettingsStore.shared.shouldSyncInputSelectionToSystemDefault() {
+ _ = AudioDevice.setDefaultInputDevice(uid: newUID)
+ }
+ }
+ )
+ }
+
private var isRecordingAnyShortcut: Bool {
self.activeShortcutRecordingTarget != nil
}
@@ -1093,7 +1115,7 @@ struct SettingsView: View {
.font(self.theme.typography.bodyStrong)
.foregroundStyle(self.settingsTitleText)
Spacer()
- Picker("", selection: self.$selectedInputUID) {
+ Picker("", selection: self.inputDeviceSelection) {
// Handle empty state gracefully
if self.inputDevices.isEmpty {
Text("Loading...").tag("")
@@ -1108,22 +1130,6 @@ struct SettingsView: View {
.pickerStyle(.menu)
.frame(width: 240)
.disabled(self.asr.isRunning)
- .onChange(of: self.selectedInputUID) { oldUID, newUID in
- guard !newUID.isEmpty else { return }
-
- // Prevent device changes during active recording
- if self.asr.isRunning {
- DebugLogger.shared.warning("Cannot change input device during recording", source: "SettingsView")
- // Revert to previous value
- self.selectedInputUID = oldUID
- return
- }
-
- SettingsStore.shared.recordInputDeviceSelection(newUID)
- if SettingsStore.shared.shouldSyncInputSelectionToSystemDefault() {
- _ = AudioDevice.setDefaultInputDevice(uid: newUID)
- }
- }
// Sync selection when devices load or change
.onChange(of: self.inputDevices) { _, newDevices in
// Update cached default device name when device list changes
@@ -1145,6 +1151,12 @@ struct SettingsView: View {
newDevices.contains(where: { $0.uid == preferredUID })
{
self.selectedInputUID = preferredUID
+ } else if let defaultUID = AudioDevice.getDefaultInputDevice()?.uid,
+ newDevices.contains(where: { $0.uid == defaultUID })
+ {
+ self.selectedInputUID = defaultUID
+ } else {
+ self.selectedInputUID = newDevices.first?.uid ?? ""
}
}
}