PDA

View Full Version : Restoring startup, login and logout sounds



seanos
February 4th, 2016, 09:14 AM
For some reason (see proverb about cats & curiosity) I’ve been investigating how to make Ubuntu noisy again. This seems to be a little messy, which I guess is one of the reasons the devs dropped these in the first place, and I’m not sure I really understand how it used to be done anyway. I thought I’d share what I’ve figured out and see if anyone can add to it.

Themes
There is a freedesktop.org spec (http://www.freedesktop.org/wiki/Specifications/sound-theme-spec/) for sound themes, but Ubuntu doesn’t really seem to have a (easily discoverable) mechanism for choosing a theme.

Themes are installed in folders under /usr/share/sounds and can be selected using dconf Editor at /org/gnome/desktop/sound/theme-name or on the command line:

gsettings set org.gnome.desktop.sound theme-name "ubuntu"

Playing sounds
To use the freedesktop abstracted sound names (according to your theme) the command to use (at least in 14.04) is

canberra-gtk-play --id=<sound-name>
or
canberra-gtk-play -i <sound-name>

e.g.
canberra-gtk-play -i system-ready
canberra-gtk-play -i desktop-login
canberra-gtk-play -i desktop-logout

There are plenty of other options for playing sounds, but they will require a direct path to the file (e.g. paplay, aplay) and so ignore themes.

Triggering the sounds
This is where things get messy.

desktop-login
There seem to be two options here. What I’m guessing is the original method still seems to work, but the one most commonly suggested (#2) might be a little easier to tweak.

Either…



gksu gedit /usr/share/gnome/autostart/libcanberra-login-sound.desktop and change this line to true:

X-GNOME-Autostart-enabled=true

(assumes /org/gnome/desktop/sound/event-sounds is set to true in dconf)

OR
Create a new entry in Startup Applications that runs canberra-gtk-play -i desktop-login (or a script running canberra-gtk-play)


Both of these work for me, but the start of the sound is cut off. I suppose this might be fixed by a script doing something like

canberra-gtk-play -f /home/you/silent.wav
canberra-gtk-play -i desktop-login to wake up the system or maybe sleep 1 && canberra-gtk-play -i desktop-login. if it’s just happening too early.

desktop-logout
I’ve read a lot of articles about these sounds in the last couple of days, but almost all of them are about a login sound (even ones that seem to be about a startup sound). The one method I’ve read for logout uses lightdm.conf.

You could just put a command directly into the file, but I prefer to call a script.

gksu gedit /etc/lightdm/lightdm.conf and add a session-cleanup-script under [SeatDefaults] (if the file doesn’t exist you could just add the following)…

[SeatDefaults]
session-cleanup-script=/home/you/bin/lightdm-session-cleanup

Then create the /home/you/bin/lightdm-session-cleanup script…

#!/bin/bash

/usr/bin/canberra-gtk-play -i desktop-logout

This more or less works for me though, once again, the sound can be cut off early.

Inexplicably, one theme which uses different naming, refuses to acknowledge desktop-logout no matter whether I link or copy the relevant file, but canberra-gtk-play -i ending (not in the list of standard names) works.

system-ready
This used to be that familiar drum sound you heard when Ubuntu started up. I cannot figure out how to get this to play.

It looks like canberra-gtk-play requires something that hasn’t started when the greeter appears (Pulseaudio?), but I haven’t had any luck using aplay either. I’ve only tried running it from a lightdm.conf greeter-setup-script but the result is that I end up in low graphics mode and can’t get any further without opening a console, editing files and rebooting.

I suppose there are other ways to achieve this, but I suspect there will be similar problems of what audio is available at the time.

Comments?

QIII
February 4th, 2016, 09:19 AM
Moved to The Cafe. Not a support request.

seanos
February 5th, 2016, 02:13 AM
OK. I suppose that qualifies as a species of comment, though I’m really not sure this counts as “lighthearted and enjoyable discussions, such as you might find around a water cooler at work”…at least not anywhere I’ve worked.