From 5a457b4dd0e587973306322698addcbaf8c74eef Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Tue, 8 Jul 2025 19:23:36 -0400 Subject: [PATCH] Fixed bug where tts and rate were not saving to the config file. --- tojam | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tojam b/tojam index ad9a631..aea0682 100755 --- a/tojam +++ b/tojam @@ -252,12 +252,22 @@ configure_ninjam() { [[ ${menuCode} -ne 0 ]] && continue fi fi - sed -i -e "s/^tts=.*/tts=\"${tts}\"/" -e "s/^ttsRate=.*/ttsRate=\"${ttsRate}\"/" "${config}/config" && - if [[ "${tts}" == "true" ]]; then - dialog --msgbox "TTS enabled at rate ${ttsRate}." -1 -1 - else - dialog --msgbox "TTS disabled." -1 -1 - fi + # Update or add TTS settings + if grep -q "^tts=" "${config}/config"; then + sed -i "s/^tts=.*/tts=\"${tts}\"/" "${config}/config" + else + echo "tts=\"${tts}\"" >> "${config}/config" + fi + if grep -q "^ttsRate=" "${config}/config"; then + sed -i "s/^ttsRate=.*/ttsRate=\"${ttsRate}\"/" "${config}/config" + else + echo "ttsRate=\"${ttsRate}\"" >> "${config}/config" + fi + if [[ "${tts}" == "true" ]]; then + dialog --msgbox "TTS enabled at rate ${ttsRate}." -1 -1 + else + dialog --msgbox "TTS disabled." -1 -1 + fi ;; "username") userName="$(dialog --backtitle "Tojam" \