Is there a way to make the shutdown sound play full length of the file, and is there a way to make it play when shutting down/rebooting via terminal command?
I use cvlc in order to make the sound play. Startup melody plays as intended, but if I click “Shutdown” or “Reboot”, the melody plays only for a second or so, before completing the above mentioned action. Plus, if shutting down via command, there is no sound at all.
It is not that big of a deal, but it would be great to find the way to implement this customization. I used to have the same issue back on KDE and decided that I don’t care that much. Just so happens that now I have some spare time to tinker with it. Any ideas or suggestions?
When you shut down or reboot through the GUI, your system kicks off a shutdown sequence that terminates processes, including the audio playback process (cvlc), before the sound can finish. That’s why your melody only plays for a second or so.
Desktop environments like GNOME, KDE, or XFCE typically stop audio services, such as PulseAudio or PipeWire, early in the shutdown process, which interrupts your sound.
When you use terminal commands like shutdown, reboot, or poweroff, they don’t trigger the same scripts or hooks as GUI shutdowns.
Thank you for the information. I guess there’s no point in trying to make the shutdown sound play when turning off via command then. However I wonder if there’s a way to make it so that the process termination sequence doesn’t proceed before the tune has played entire file first.
In xfce startup settings you can add a script that plays your sound. You can choose when this event will be triggerd (on shutdown or logout etc) just click on trigger
I’m not sure how this works but it implies that the sound would be played before logout or shutdown is suppose
I’ve already done that. It just doesn’t play entire melody before shutting down or rebooting. You can just hear a few first notes of the tune and the computer is already off.
Basicaly you create a systemd unit which run an action during its shutdown.
It may also be necessary to add Requires= in the [Unit] section with sound.target so that the sound is not disabled before it plays the tune. But I am not sure if that is the correct way.
Also you will delay the shutdown.
It is a strange thing to see that someone wants to play all kind of sound during booting and shutdown. Feels like 1990s to me.