Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1118  / 2 Years ago, tue, december 7, 2021, 11:44:50

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.


More From » 11.10

 Answers
2

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.


[#40686] Wednesday, December 8, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
intssive

Total Points: 493
Total Questions: 119
Total Answers: 101

Location: Liberia
Member since Mon, Feb 1, 2021
3 Years ago
intssive questions
Tue, Mar 21, 23, 08:19, 1 Year ago
Wed, Aug 31, 22, 04:04, 2 Years ago
Sat, Sep 25, 21, 15:09, 3 Years ago
Fri, Dec 31, 21, 09:13, 2 Years ago
;