Never launch new espeak if one is launch; kill one per one espeak, older first

This commit is contained in:
nemunaire 2014-07-07 10:27:11 +02:00
parent 0e77984b1e
commit aba883fff2

16
.speak
View File

@ -1,10 +1,18 @@
#!/bin/sh
# on teste si la lecture est en cours, pour l'arrêter le cas échéant
if [ ! -z $(ps -A | grep espeak | awk '{ print $1 }' ) ]
if ! [ -z "$(ps -A | grep espeak | awk '{ print $1 }' )" ]
then
# kill $(ps -A | grep espeak | awk '{ print $1 }' )
killall espeak
for k in $(ps -A | grep espeak | awk '{ print $1 }' )
do
kill $k
break
done
else
xclip -o | espeak -v $1 | true
SPEAK_LANG="FR"
if [ -n "$1" ]
then
SPEAK_LANG="$1"
fi
xclip -o | espeak -v $SPEAK_LANG | true
fi