Hacking sound themes in Karmic
Gnome used to allow the user to change system sounds to their own liking. The System > Preferences > Sound menu option used to show a breakdown of the specific events with the option to choose whichever supported file the user wanted. Personally, I always opted to replace the login sound with MGM’s roaring lion.
With the new functionality introduced with Ubuntu 9.10 Karmic Koala, there’s no simple way to do this without a bit of hacking at the command line, or through a root nautilus window if one feels inclined.
Navigate to the shared sounds directory.
cd /usr/share/sounds
In it, there should be a directory named ubuntu. Within ubuntu is an index.theme file and the sounds stored in a directory named stereo. I first made a complete copy of the ubuntu directory into a new directory.
sudo cp -a ./ubuntu ./adam
I then opened the ./adam/index.theme file with nano…
sudo nano ./adam/index.theme
… and changed my new theme’s name. I changed:
[Sound Theme]
Name=Ubuntu
Directories=stereo[stereo]
OutputProfile=stereo
… to:
[Sound Theme]
Name=Adam
Directories=stereo[stereo]
OutputProfile=stereo
… and saved the file.
I now had a new entry in the available themes named Adam.
To change the startup sound, I had to copy over my MGM roaring lion file and change its name. I renamed the old file just in case. Not that it was needed as it was still in the original ubuntu directory, just following my back-up before editing rule.
cd /usr/share/sounds/adam/stereo
sudo mv desktop-login.ogg desktop-login.ogg.old
sudo cp ~/Audio/mgmua_lionroar.wav .
sudo chmod 0644 mgmua_lionroar.wav
sudo mv mgmua_lionroar.wav desktop-login.wav
The filenames are based on the XDG Sound Theme specifications spelled out at freedestop.org. So far, only .ogg .oga and .wav files are supported.
This should at least start you on your way. There’s a lot more information with examples at freedesktop.org’s website. There have been bug reports filed about having the old functionality restored, but we can only wait and see what develops.




November 17th, 2009 at 3:26 am
Excelent hack!
Thank you very much for your help.
November 20th, 2009 at 2:10 am
That’s the only thing we can do… :(
November 20th, 2009 at 2:11 am
PS: Thanks for the freedesktop.org tip!
November 20th, 2009 at 2:25 am
@Hi
… for now. It’s a new design/feature that doesn’t (as far as I know) have a simple GUI counterpart like before. It takes a bit of time and can seem tedious, but it does work. Every time I log in now I’m greeted by the familiar roaring sound of a lion.
December 12th, 2009 at 2:38 am
Is there any other step required to get some of the sound events working? I’ve followed the information in the freedesktop.org tip and placed files in the required location for the events device-added and device-removed (I’d like a sound to indicate when a USB device is connected and disconnected). They are both ogg files.
However, no sound plays when USB devices are connected or removed. Unfortunately my linux-fu is a little weak so I’m not even sure how to check whether the event is recorded by libcanberra or not.
Any help anyone could provide would be greatly appreciated.
December 12th, 2009 at 7:17 am
Ugh, please do NOT tell users to do stupid things like modifying files in /usr other than in /usr/local!
Sound themes belong in ~/.local/share/sounds/
You can also create a custom theme here named __custom and simply symlink to the audio files you wish to use.
December 12th, 2009 at 7:12 pm
@charrion
I can’t get those events to sound, either. It would be nice if they did, but I noticed there are other events that don’t work either. I’ll keep digging around on that.
@Ryan Hayle
Although my steps involve files located in the /usr directory, I haven’t told anyone to modify any existing files. If you noticed, the first step was to copy a set of files to a new directory in which to modify while preserving the originals.
I do appreciate you pointing out an alternative location for sound themes. It was an area of freedesktop.org’s documentation that I overlooked. However, that location would force any new sound files to remain localized to that one user rather than being accessible system-wide. While most users are using single-user installations, there are some, including myself, who have computers with more than one user account. It would be nice to have one set of files rather than going through the task of duplicating them for every user.