Re: [PATCH 4/4] speakup: Add documentation on changing the speakup messages language

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 11/01/2021 à 23:37, Samuel Thibault a écrit :
+Note: the speakupconf must be installed on your system so that settings are saved.
+Otherwise, you will have an error: your language will be loaded but you will
+have to run the script again every time Speakup restarts.
+See section 16.1. for information about speakupconf.

Alternatively the attached scripts allow to save/restore the settings for
each hard synth independently and the settings for espeakup vs speechd-el
independently as well.

Suggested usage: the user runs speakup-save when happy with the settings,
speakup-restore is run at boot.

Didier
#!/bin/sh
if [ ! $(id -u) -eq 0 ]; then
	gettext -s "Please run this script as root."
	exit
fi

if [ ! -f /sys/accessibility/speakup/synth ]; then
	gettext -s  "speakup being not in use, there is no setting to restore."
	exit
elif [ "$(</sys/accessibility/speakup/synth)" = "none" ]; then
	gettext -s "speakup being not in use, there is no setting to restore."
	exit
fi

SYNTH=$(</sys/accessibility/speakup/synth)
ESPEAKUP=$(ps -C espeakup --noheaders|wc -l)
SPEECHD_UP=$(ps -C speechd-up --noheaders|wc -l)
# We saved settings separately for:
# espeakup
# each hard synthesizer
# speechd-up
# so that we restore the relevant settings for the synthesizer and
# screen reader in use.

SAVEDSYNTH="$SYNTH"
if [ "$SYNTH" = "soft" ] && [ $ESPEAKUP -ne 0 ]; then
	SAVEDSYNTH="espeakup"
fi
if [ "$SYNTH" = "soft" ] && [ $SPEECHD_UP -ne 0 ]; then
	SAVEDSYNTH="speechd-up"
fi
# If SYNTH has not been set to speechd-up or speakup a hard synth is
# in use, like e.g. SAVEDSYNTH=apollo
if [ ! -d /var/lib/speakup/$SAVEDSYNTH ]; then
	gettext -s "No speakup settings saved for $SAVEDSYNTH, so nothing to restore."
	exit
fi
cd /var/lib/speakup/$SAVEDSYNTH
ls|while read i; do
	if [ -w /sys/accessibility/speakup/$i ] && [ -f /sys/accessibility/speakup/$i ]; then
		cp $i /sys/accessibility/speakup/
	fi
done
if [ -d i18n ] && [ -d /sys/accessibility/speakup/i18n ]; then
	( cd i18n
	ls|while read i; do
		if [ -w /sys/accessibility/speakup/i18n/$i ]; then
			cp $i /sys/accessibility/speakup/i18n/
		fi
	done
	)
fi
( cd $SYNTH
ls|while read i; do
	if [ -w /sys/accessibility/speakup/$SYNTH/$i ]; then
			cp $i /sys/accessibility/speakup/$SYNTH/
		fi
	done
	)
gettext -s "speakup settings have been restored for $SAVEDSYNTH."
	

#!/bin/sh
if [ ! $(id -u) -eq 0 ]; then
	gettext -s "Please run this script as root."
	exit
fi
if [ ! -f /sys/accessibility/speakup/synth ]; then
	 gettext -s "speakup being not in use, there is no setting to save."
	exit
fi
SYNTH=$(</sys/accessibility/speakup/synth)

if [ "$SYNTH" = "none" ]; then
	gettext -s "speakup being not in use, there is no setting to save."
	exit
fi
ESPEAKUP=$(ps -C espeakup --noheaders|wc -l)
SPEECHD_UP=$(ps -C speechd-up --noheaders|wc -l)
# We save settings separately for:
# espeakup
# each hard synthesizer
# speechd-up
# so that we restore the relevant settings for the synthesizer and
# case occurring the screen reader in use.
if [ "$SYNTH" = "soft" ] && [ $ESPEAKUP -ne 0 ] && [ $SPEECHD_UP -ne 0 ]; then
	gettext -s "espeakup and speechd-up are both running, not saving settings."
	exit
fi
if [ "$SYNTH" = "soft" ] && [ $ESPEAKUP -eq 0 ] && [ $SPEECHD_UP -eq 0 ]; then
	gettext -s "neither espeakup nor speechd-up is running, not saving settings."
	exit
fi
if [ "$SYNTH" = "soft" ] && [ $ESPEAKUP -ne 0 ]; then
	SYNTH="espeakup"
fi
if [ "$SYNTH" = "soft" ] && [ $SPEECHD_UP -ne 0 ]; then
	SYNTH="speechd-up"
fi
# If SYNTH has not been set to speechd-up or speakup it is the hard synth
# in use.
mkdir -p /var/lib/speakup/$SYNTH	
cd /sys/accessibility/speakup
for i in $(find . -type d|sed "/^.$/d;s/..//"); do
	mkdir -p /var/lib/speakup/$SYNTH/$i
done
for i in $(find . -type f|sed "s/..//"|grep -v -e silent -e version -e "synth.*"); do
	if [ -f $i ] && [ -w $i ]; then
		cp $i /var/lib/speakup/$SYNTH/$i
	fi
done
gettext "Current speakup settings have been saved in "
echo "/var/lib/speakup/$SYNTH."
_______________________________________________
Speakup mailing list
Speakup@xxxxxxxxxxxxxxxxx
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup

[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]

  Powered by Linux