From 89d2d99e924f18160aad80fd28e7bc44c182530b Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 16 Apr 2026 22:07:21 -0400 Subject: [PATCH] Improve the apply speech settings confirmation work flow. --- usr/local/bin/speechd_rate.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/usr/local/bin/speechd_rate.py b/usr/local/bin/speechd_rate.py index fb36b3a..50c0ecd 100755 --- a/usr/local/bin/speechd_rate.py +++ b/usr/local/bin/speechd_rate.py @@ -227,6 +227,21 @@ class SpeechRateMenu: # If cancel fails, try to reinitialize self.init_speech() + def confirm_saved_settings(self): + """Restart speechd, announce success, and wait for confirmation.""" + subprocess.run( + ["sudo", "killall", "speech-dispatcher"], + check=False, + ) + time.sleep(1) + self.init_speech() + self.speak("Speech settings applied. Press Enter to continue.", interrupt=False) + + while True: + key = self.stdscr.getch() + if key == curses.KEY_ENTER or key == 10 or key == 13: + break + def draw_menu(self): """Draw the menu on the screen""" self.stdscr.clear() @@ -391,12 +406,10 @@ class SpeechRateMenu: self.speak("Saving speech settings to system configuration.") success = self.save_settings_to_config() if success: - self.speak(f"Speech settings saved successfully. Rate {self.currentRate}, Volume {self.currentVolume}, Pitch {self.currentPitch}.") + self.confirm_saved_settings() else: self.speak("Failed to save speech settings. You may need root privileges.") - # Wait briefly to allow speech to complete before exiting - time.sleep(4) break # Exit the loop after saving elif key == 27 or key == ord('q') or key == ord('Q'): # Esc or Q