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.
Thank you very much for your suggestions, I’ll try them out when I have time.
Welp, to some extent it is 1990s. I use Windows 98 startup sound for a startup (it sounds very space-y as well, fits Endeavour OS theme perfectly), and wanna use Windows 95 startup for a shutdown (brings memories about when the computer felt like some sort of magic, and the Internet was a place that you go to, not an omnipresent being that you cannot hide from in your real life). It brings me a subtle reminder about better and easier times. So, like, not the most crucial customization piece, yet quite a welcome one.
If I did everything correcly, this one didn’t do the trick for me.
I came up with a silly workaround on the way. I just created a “restart” command, as I usually turn the computer off via command anyways. It goes like this:
#!/bin/bash
# Play the sound
mplayer (location.wav) </dev/null >/dev/null 2>&1
# reboot
reboot
This gonna pass for a while, but I intend to try out the other ways in the future to make it properly.