#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
-#define ESPEAK_BIN "espeak"
+#define ESPEAKTIME_BIN "espeaktime-now.sh"
#define GCONF_KEY "/apps/Maemo/espeaktime"
/* TODO: read these from disk */
(*cfg->effect) ? "+" : "", cfg->effect);
strftime(text, sizeof(text), cfg->text, tm);
+ setenv("EST_TESTMODE", test_mode ? "1" : "0", 1);
+ setenv("EST_IGN_SILENT", cfg->ignore_silent ? "1" : "0", 1);
+
pid = fork();
if (pid < 0) {
perror("fork");
return;
g_print("execlp: -a '%s' -p '%s' -s '%s' -v '%s' '%s'\n",
astr, pstr, sstr, vstr, text);
- res = execlp(ESPEAK_BIN, ESPEAK_BIN,
+ res = execlp(ESPEAKTIME_BIN, ESPEAKTIME_BIN,
"-a", astr, "-p", pstr, "-s", sstr, "-v", vstr,
text, NULL);
g_print("execlp: %d (%s)\n", res, g_strerror(errno));
#!/bin/sh
-fname=/tmp/espeaktime-$$.wav
-espeak -w $fname $(date "+%H:%M")
+# if we ever get empty or bogus arguments, espeak will try to
+# read text from stdin, and hang -- prevent that.
+exec < /dev/null
-export PULSE_PROP="module-stream-restore.id=x-maemo-applet-profiles event.id=ringtone-preview"
-nice -n -5 play-sound $fname
+if [ "$EST_IGN_SILENT" = "1" ]; then
+ fname=/tmp/espeaktime-$$.wav
-rm -f $fname
+ export PULSE_PROP="module-stream-restore.id=x-maemo-applet-profiles event.id=ringtone-preview"
+ espeak -w $fname "${@}"
+ play-sound $fname
+ rm -f $fname
+else
+ exec espeak "${@}"
+fi