Index: plugins/sound/Makefile.am
===================================================================
--- plugins/sound/Makefile.am	(revision 181)
+++ plugins/sound/Makefile.am	(working copy)
@@ -13,6 +13,7 @@
 	-I$(top_srcdir)/gnome-settings-daemon			\
 	-I$(top_srcdir)/plugins/sounds/libsounds		\
 	-DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\"	\
+	-DESD_SERVER="\"$(ESD_SERVER)\""			\
 	$(AM_CPPFLAGS)
 
 libsound_la_CFLAGS = \
Index: plugins/sound/gsd-sound-manager.c
===================================================================
--- plugins/sound/gsd-sound-manager.c	(revision 181)
+++ plugins/sound/gsd-sound-manager.c	(working copy)
@@ -54,6 +54,8 @@
 struct GsdSoundManagerPrivate
 {
         gboolean padding;
+        /* esd/PulseAudio pid */
+        GPid pid;
 };
 
 enum {
@@ -68,18 +70,44 @@
 
 static gpointer manager_object = NULL;
 
+static void
+reset_esd_pid (GPid pid, gint status, gpointer user_data)
+{
+	GsdSoundManager *manager = (GsdSoundManager *) user_data;
 
+	if (pid == manager->priv->pid)
+		manager->priv->pid = 0;
+}
+
 /* start_gnome_sound
  *
  * Start GNOME sound.
  */
 static void
-start_gnome_sound (void)
+start_gnome_sound (GsdSoundManager *manager)
 {
-        gnome_sound_init (NULL);
-        if (gnome_sound_connection_get () < 0) {
-                g_warning ("Could not start GNOME sound.\n");
-        }
+	char  *argv[] = {ESD_SERVER, "-nobeeps", NULL};
+	GError *err = NULL;
+	time_t  starttime;
+
+	if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
+			    &manager->priv->pid, &err)) {
+		g_warning ("Could not start esd: %s\n", err->message);
+		g_error_free (err);
+		return;
+	}
+
+	g_child_watch_add (manager->priv->pid, reset_esd_pid, NULL);
+
+	starttime = time (NULL);
+	gnome_sound_init (NULL);
+
+	while (gnome_sound_connection_get () < 0
+	       && ((time (NULL) - starttime) < 4))
+	{
+		g_usleep (200);
+		gnome_sound_init (NULL);
+	}
 }
 
 #ifdef HAVE_ESD
@@ -91,7 +119,7 @@
  * Stop GNOME sound.
  */
 static void
-stop_gnome_sound (void)
+stop_gnome_sound (GsdSoundManager *manager)
 {
 #ifdef HAVE_ESD
         /* Can't think of a way to do this reliably, so we fake it for now */
@@ -99,6 +127,13 @@
         set_esd_standby = TRUE;
 #else
         gnome_sound_shutdown ();
+
+	if (manager->priv->pid) {
+		if (kill (manager->priv->pid, SIGTERM) == -1)
+			g_printerr ("Failed to kill esd (pid %d)\n", manager->priv->pid);
+		else
+			manager->priv->pid = 0;
+	}
 #endif
 }
 
@@ -189,13 +224,14 @@
         enable_sound = TRUE;
 #endif
         event_sounds = gconf_client_get_bool (client, "/desktop/gnome/sound/event_sounds", NULL);
+        /* FIXME this is completely bogus, the entry doesn't exist */
         event_changed_new = gconf_client_get_int  (client, "/desktop/gnome/sound/event_changed", NULL);
 
         closure.enable_system_sounds = event_sounds;
 
         if (enable_sound) {
                 if (gnome_sound_connection_get () < 0)
-                        start_gnome_sound ();
+                        start_gnome_sound (manager);
 #ifdef HAVE_ESD
                 else if (set_esd_standby) {
                         esd_resume (gnome_sound_connection_get ());
@@ -206,7 +242,7 @@
 #ifdef HAVE_ESD
                 if (!set_esd_standby)
 #endif
-                        stop_gnome_sound ();
+                        stop_gnome_sound (manager);
         }
 
         if (enable_sound &&
@@ -216,7 +252,6 @@
                 inited = TRUE;
                 event_changed_old = event_changed_new;
 
-
                 props = sound_properties_new ();
                 sound_properties_add_defaults (props, NULL);
                 sound_properties_foreach (props, reload_foreach_cb, &closure);
@@ -267,7 +302,7 @@
 {
         g_debug ("Stopping sound manager");
 
-        stop_gnome_sound ();
+        stop_gnome_sound (manager);
 }
 
 static void
Index: configure.ac
===================================================================
--- configure.ac	(revision 181)
+++ configure.ac	(working copy)
@@ -227,6 +227,22 @@
 AC_SUBST(ESD_CFLAGS)
 AC_SUBST(ESD_LIBS)
 
+# Look for esound, even if compiling without esd support,
+# as we still need to launch esd or PulseAudio to support sounds
+ESDSERVERDIR=`$PKG_CONFIG --variable=esd_serverdir esound`
+old_path=$PATH
+if test x"$ESDSERVERDIR" != x; then
+	PATH=$ESDSERVERDIR:$PATH
+fi
+
+AC_PATH_PROG(ESD_SERVER, esd, no)
+if test x"$ESD_SERVER" = xno; then
+	AC_MSG_ERROR([esd executable not found in your path - should be installed with ESound])
+fi
+
+AC_SUBST(ESD_SERVER)
+PATH=$old_path
+
 dnl ==============================================
 dnl GStreamer section
 dnl ==============================================
