Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[HowTo] Adding Start-Up/Logon sounds to Debian

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Post Reply
Message
Author
User avatar
donald
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 1077
Joined: 2021-03-30 20:08
Has thanked: 188 times
Been thanked: 243 times

[HowTo] Adding Start-Up/Logon sounds to Debian

#1 Post by donald »

Ongoing Collaborative thread, I'll add content here at least 1 to 2 times each week. If you have a different experience or knowledge please feel free to share and jump in.

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. :D

[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:
plasma_sound.png

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

autostart_options.png
The scripts will show after you have added them:

plasma_soundautoplays.png

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.
autostart_personal.png


Next up: .desktop files and systemd scripts.
Typo perfectionish.


"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank

User avatar
cds60601
df -h | participant
df -h | participant
Posts: 724
Joined: 2017-11-25 05:58
Location: Florida
Has thanked: 133 times
Been thanked: 64 times

Re: [HowTo] Adding Start-Up/Logon sounds to Debian

#2 Post by cds60601 »

systemd scripts? By chance, would this include converting cron jobs to sysd?
Supercalifragilisticexpialidocious

User avatar
donald
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 1077
Joined: 2021-03-30 20:08
Has thanked: 188 times
Been thanked: 243 times

Re: [HowTo] Adding Start-Up/Logon sounds to Debian

#3 Post by donald »

cds60601 wrote: 2022-12-31 22:16 systemd scripts? By chance, would this include converting cron jobs to sysd?
Not in particular, though as I mentioned a lot of the stuff above and later has a lot of carry-over to other system tasks and jobs. We can touch on using systemd as a cron scheduler a bit later.
Typo perfectionish.


"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank

Post Reply