Gnome used to have login and logoff sounds, but they removed them and made it impossible to add a logout sound back. Login and logoff sounds are one of the nicest things for a desktop environment to have, because it sets the mood when logging in and off of the PC. This could be implemented by making it so if the sound theme has a login or logoff sound, then those sounds will play.
The login sound is already there and is rather nice (tho you can change it). It’s in
/usr/share/sounds/freedesktop/stereo and called service-login.oga
Install the mpv player:
sudo apt install mpv
Then make an autostart folder in your .config folder
/home/yourname/.config
and a file called
loginsound.desktop containing:
----------------------
[Desktop Entry]
Type=Application
Exec=mpv /usr/share/sounds/freedesktop/stereo/service-login.oga
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=Login Sound
--------------------------
To test, run:
mpv /usr/share/sounds/freedesktop/stereo/service-login.oga
Don’t know about logout. The sound is already there but we’re using autostart so…
Edit:
3. Shutdown/Logout Scripts
Because GNOME and modern Linux desktops rely on systemd user sessions, there is no physical folder to drop a script into for execution upon shutdown. Instead, you must create a custom systemd service for the user.