Updated speaking utilities.

This commit is contained in:
Storm Dragon 2022-10-07 05:30:01 -04:00
parent cccfaa47f6
commit 55130abe76
2 changed files with 4 additions and 4 deletions

View File

@ -32,7 +32,7 @@ while pgrep -u "$USER" ^$1 &> /dev/null ; do
continue continue
fi fi
if [[ "${newText}" =~ ^[0-9A-Za-z[:space:][:punct:]]+$ ]]; then if [[ "${newText}" =~ ^[0-9A-Za-z[:space:][:punct:]]+$ ]]; then
spd-say "$newText" spd-say -- "$newText"
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
continue continue
fi fi
@ -41,7 +41,7 @@ while pgrep -u "$USER" ^$1 &> /dev/null ; do
$0~originalText { print $2; exitCode = 0; exit} $0~originalText { print $2; exitCode = 0; exit}
END { exit exitCode }' "$dictionaryFile")" END { exit exitCode }' "$dictionaryFile")"
if [[ "${#translatedText}" -ge 1 ]]; then if [[ "${#translatedText}" -ge 1 ]]; then
spd-say "$translatedText" spd-say -- "$translatedText"
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
continue continue
fi fi
@ -49,6 +49,6 @@ while pgrep -u "$USER" ^$1 &> /dev/null ; do
if ! [[ "${newText}" =~ ^[0-9[:punct:]]+$ ]]; then if ! [[ "${newText}" =~ ^[0-9[:punct:]]+$ ]]; then
echo "${newText})==:[${translatedText}" >> "$dictionaryFile" echo "${newText})==:[${translatedText}" >> "$dictionaryFile"
fi fi
spd-say "$translatedText" spd-say -- "$translatedText"
echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null echo "" | xclip -d "${DISPLAY:-:0}" -selection clipboard 2> /dev/null
done done

View File

@ -16,7 +16,7 @@ while pgrep -u "$USER" ^$1 &> /dev/null ; do
if [[ "$wnd_title" =~ $lookfor ]]; then if [[ "$wnd_title" =~ $lookfor ]]; then
wnd_title=${BASH_REMATCH[1]} wnd_title=${BASH_REMATCH[1]}
if [[ "$old_title" != "$wnd_title" ]]; then if [[ "$old_title" != "$wnd_title" ]]; then
spd-say "$wnd_title" spd-say -- "$wnd_title"
old_title="$wnd_title" old_title="$wnd_title"
fi fi
fi fi