Startup Sounds with SLiM
========================
:author: Aaron Ball
:email: nullspoon@iohq.net



For a pretty long time I've been running Xfce for my desktop and SLiM as my
login manager to save on boot time. This weekend though, I decided that a
second or two added to my boot time wouldn't bother me too much if it made my
system a little less utilitarian.

Inevitably, the first places to look are (completely unecessary, yes I know) a
fancy theme for Xfce (sprinkle a little transparency in there to taste), new
icons, cool theme for my login manager, and a startup sound.

Most of that was really easy. The startup sound on the other hand is something
not so well documented (especially with SLiM). I dabbled around a bit and had
an idea that believe it or not, worked on the first try.

First off, I hit up good 'ol gnome-look.org for some system sounds to try out
and settled finally on the
http://gnome-look.org/content/show.php/%22Borealis%22+sound+theme?content=12584[Borealis
sound scheme].

Once you've got the sound file you want (I used Exit1_1.wav for mine), actually
getting it to run on startup is actually really simple. All you need to do is
add a line to your rc.conf file that has mplayer open up your sound you want
played. For example...

----
mplayer /home/username/.sounds/Exit1_1.wav
----

One minor thing here for you SysV users out there you don't have an rc.local
file. To do this with a system that uses System V for initialization (Debian,
most forks of Debian I believe, Fedora, etc.), you need to create a script at
*/etc/init.d/local* (you can call it whatever, but for the purposes of this,
we'll call it local). Once the script is created, add the following lines
(referencing my example above)...

----
#!/bin/sh
mplayer /home/username/.sounds/Exit1_1.wav
----

Now that we've added those, we need to run

----
update-rc.d /etc/init.d/local defaults 80
----

and you should be good to go.

Now, there is one concern here that could potentially cause some issues.
If you shut your computer down with the volume turned up, when your
computer boots back up again, you'll get a nice loud system startup
sound. To remedy this, we simply need to reset our volume before we call
mplayer in our script. To do this, we just add the following line before
the mplayer line:

----
amixer set Master 30%
----

That sets our volume to 30%. If you want to set it higher or lower, you can
just change that percentage value.

Category:Linux
Category:SLiM


// vim: set syntax=asciidoc:
