Skip to content

Commit 0b56d5f

Browse files
committed
Read Aloud: Preview shows the widget + visible toast feedback
- Preview button now drives the app-level TTSController (wired to the recorder widget), so it shows the same "Speaking" widget a real trigger does — a reliable way to see Read Aloud working without selecting text - TTSController.notify now surfaces a visible toast (no text selected, missing API key, errors) instead of only an esc beep
1 parent bcf7ccd commit 0b56d5f

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

native-macos/Zerm/TextToSpeech/TTSController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,6 @@ final class TTSController: ObservableObject {
107107
private func notify(_ message: String) {
108108
statusMessage = message
109109
logger.notice("\(message, privacy: .public)")
110+
NotificationManager.shared.showNotification(title: message, type: .info, duration: 3.0)
110111
}
111112
}

native-macos/Zerm/Views/Settings/TextToSpeechSettingsView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ struct TextToSpeechSettingsView: View {
1212
@State private var verifyState: VerifyState = .idle
1313
@State private var isPreviewing = false
1414

15-
/// Retained so preview playback isn't cut off when the action returns.
16-
/// Does not call `registerHotkey()`, so it never double-binds the global shortcut.
17-
@StateObject private var previewController = TTSController()
15+
/// The app-level controller (wired to the recorder widget), so Preview shows the same
16+
/// "Speaking" widget a real trigger does — a reliable way to see Read Aloud working.
17+
@EnvironmentObject private var ttsController: TTSController
1818

1919
@ObservedObject private var kokoro = KokoroModelManager.shared
2020
@EnvironmentObject private var hotkeyManager: HotkeyManager
@@ -286,7 +286,7 @@ struct TextToSpeechSettingsView: View {
286286
private func preview() async {
287287
isPreviewing = true
288288
defer { isPreviewing = false }
289-
await previewController.speak("This is how the selected voice sounds in Zerm.")
289+
await ttsController.speak("This is how the selected voice sounds in Zerm.")
290290
// brief settle so synthesis can start before the button re-enables
291291
try? await Task.sleep(nanoseconds: 1_200_000_000)
292292
}

0 commit comments

Comments
 (0)