Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was wondering if it was possible to start a mp3 song in one of three places:

  1. After starting the computer from cold, when the Ubuntu logo appears (When loading the system).

  2. When I enter the LightDM greeter.

  3. When I enter the desktop after entering my user/pass in the greeter.

As a bonus maybe run a playlist.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

2 and 3 are quite easy (See below). Number 1 could be possible but I don't really know much about plymouth.

First off, create a small shell script containing these lines:

#!/bin/bash
mpg123 -q $1 &

I chose to save it as /usr/local/bin/play-sound (Also make sure mpg123 is installed). You can use any command-line player you like. The & at the end of the line is imortant since lightdm will wait untill the script finishes. And we want the sound to play during lightdm. And the $1 will be replaced by whaterver file we specify when executing the script later on. Also remember to chmod +x the script.

2 ) Edit /etc/lightdm/lightdm.conf and set greeter-setup-script=play-sound <file.mp3> somewhere in the [SeatDefaults] section. Make sure the mp3 is accessible for all (not in an encrypted home folder or such). Don't use a long file as it will play it until the end.

3 ) Run gnome-session-properties from a terminal or run-dialog. Click Add, enter a nifty name, set the command to play-sound <file.mp3>. Add a comment if you want. Click Add and then Close. This will make the selected file play when the current user logs in. If you want the file to play for all users just move the resulting file from $HOME/.config/autostart/ to /usr/share/gnome/autostart/. I might add that there are more ways to set a login-sound for gnome. This is just a quick way.

I have tested these two solutions in ubuntu 11.10 running gnome-shell and unity. If I get some time over I will look in to the matter of running audio when plymouth runs. Or if anyone else knows ho to do this feel free to join in.

share|improve this answer
    
Please look into it Zoke since it is not yet clear how to do it. –  Luis Alvarado Jan 29 '12 at 21:48
    
Added some more info for you now. –  Zoke Jan 30 '12 at 1:51
    
Thanks Zoke. Good answer. –  Luis Alvarado Jan 30 '12 at 23:28
add comment

There is no option to set custom sound. But you can hack it. ubuntu run files from /usr/share/sounds/ubuntu/stereo so place your desire file and rename it(File format ogg).

As an example if you want to change login sound then replace desktop-login.ogg with your file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.