There are many ways to do introduce sounds in Debian for purposes such as a logon sound for desktop users, a script completion sound, or even a sound played on a headless server so that you know the server has started or is shutting down. We will do a few of them.
I'll start off with Desktop Environments, specifically KDE Plasma which is the Desktop Environment I use, though some of the commands/scripts shown in this thread are usable with other Desktop Environments as well.
For those of you on laptops, be mindful of your auditory excellence in public spaces.
[Plasma]
Via the default System Setings:
Level of Ease: Easy
System Settings -> Notifications -> Configure. Under the right most section there is a section titled: 'System Services'. Select Plasma Workspace, then select Configure Events.
Screenshot of the arrows of confusion needed for this task:
Browse through the window looking for the Login and Logout events, select the appropriate radio button to turn the event on, then browse to your selected .ogg or .wav file to have it start at logon or at logoff.
--
The default directory for sounds will be /usr/share/sounds. I tend to use a fair amount of sounds, mainly in .wav and .mp3 formats so I keep another sounds folder under my home directory for music I convert or have downloaded to use.
If you have a selection of mp3s that you wish to convert to .wav, place them all in a single directory and from the command line use the following command to convert each mp3 to wav inside that directory.
Code: Select all
for f in *.mp3; do ffmpeg -i "$f" "$(name $f).wav"; done
Scripting via the Autostart GUI:
Level of Ease: Easy
KDE also provides a means to run scripts desired in your startup process, for the topic here, we are going to use this feature to play Logon and Logoff sounds.
Autostart is found in: System Settings -> Shortcuts -> Startup and Shutdown -> Autostart.
Selecting Add will offer 3 options for script you with to run at startup:
Application
Login Script
Logoff Script
The scripts will show after you have added them:
Here are 2 very simple scripts that you can use to play sound files for logon and logoff:
Code: Select all
logon.sh
#!/bin/bash
aplay /home/donald/Sounds/wav/goofy_yell.wav 2>&1
Code: Select all
logoff.sh
#!/bin/bash
aplay /home/donald/Sounds/wav/bells.wav 2>&1
Another location to place the scripts can be in your .config.plasma-workspace directory, otherwise I believe the above will play for all users. I'll check this later when I move onto the other Desktop Environments and set up a dummy new user account. *Open for edit, I guess*
The directory for your logoff sounds script: ~/.config.plasma-workspace/shutdown
The directory for your logon sounds script: ~/.config.plasma-workspace/autostart
Also note that if you place them in your .config.plasma-workspace location, they will show up in the Autostart menu.
Next up: .desktop files and systemd scripts.