Auto-start ESD/ESound in XFCE
December 23rd, 2006
As you may be aware I am a relatively recent convert to Ubuntu. As such I am still tweaking my desktop to my liking (Who am I kidding, I don’t think I’ll ever finish tweaking it).
I was previously running Gnome (Ubuntu’s default) Desktop, except with XFWM as by Window Manager, as I have never liked Metacity (Gnome’s default WM). Today, I changed my default session (from the "Options" menu in the GDM — the graphical login screen) to XFCE, as many of the Gnome features I don’t use anyway, and I have always liked XFCE, it was on my desktop in my Gentoo day’s (that or Openbox).
Everything seemed to work fine. There were a few things I needed to configure because they were handled by Gnome application previously, but on the whole most things were very similar. The first issue I noticed was I had no sound (There is almost always music playing on my machine, as it should be). After some investigation, I discovered that ESD hadn’t started:
$ ps x | grep esd
5981 pts/1 S+ 0:00 grep esd
A quick search led me to a post on the Ubuntu Forums which wasn’t directly very helpful, but it indicated that, at least I wasn’t the only one. And it also inspired my solution.
I wrote a quick script to start ESD, but only if it isn’t already running (thanks to the problem encountered in the aforementioned post)
~/bin/startesd
#!/bin/sh
APP="/usr/bin/esd"
ARGS="-nobeeps"
if [ `pidof $APP` ]; then
#Do Nothing - already running
return
else
$APP $ARGS&
fi;
Then, by adding an entry to run that script into XFCE’s (new to me, but apparently not so new) "autostart-editor"
$ xfce4-autostart-editor
or "Autostarted Applications" in the settings menu.
I had sound, without having to manually start ESD each time.
The only other configuration I need to get round to doing it configuring my multimedia keys… but that can wait ’till some other time.




Updated:
Since this seems to be a fairly popular article, and since I am using it myself, I have updated the script to prevent the annoying “Ding” sound, that accompanies the start of ESD.
Comment by Brenton — 2007-01-08 @ 14:42