How to play a soundfile when launching a program

I use Opensuse leap with KDE plasma desktop
I like to have a sound file play when launching applications , ie, when I launch krusader I want picard to say engauge. ( I think computing should be fun )

I have had this working for several years by creating my own link to applications on my desktop and appending aplay /home/path to soundfile to the executable in the properties of the application launcher. after recent upgrades this no longer works.

I looked at system settings-notifications-application specific settings and could not see how to add a start sound to various programs.

How can I add sounds to the app launcher?

Thank you
ws

1 Like

I want picard to say engauge.

Of course you do! :rocket:

Off the top of my head, if you launch it from the launcher menu, you can right click on the application and choose “Edit Application”. This opens the KDE Menu Editor. You could then change the “Program” field for a script that plays a sound and the launches the program, I guess.

Would that work I wonder?

1 Like

Another alternative could be modifying this KWin script GitHub - luisbocanegra/win_audio with some tinkering it should be possible to add “rules” to have different sets of sounds depending on the program class name or window title.

Edit: just realized how little explanation that readme has, that script lets you configure sounds for different window actions (open/close/minimize…) here is a screenshot

The current sound schemes when rewritten were suppose to have all the system sounds for any event you wanted, but somehow when it was finished that ended up not being the case.

Hi Paul
This is what I have been doing for several years, but now I cant get it to work. I am not a code writer so I dont know what changed or went wrong with my systems. I have a work around for any program that does not require root level access that involves a bash script launching the app with an extra command to play a file. A little more tedious but works ok.

thank you for your response

walter

I agree, I cant see how to set sounds to very much at all in the notifications settings section. But since this is a fun thing rather than a critical operation, I dont know if programmers are willing to spend much time on it :slightly_frowning_face:

thank you for the response
walter

I havent seen how to add something like kmymoney or brave browser to a list here to have it play a soundfile, I think this attaches different sound bits to any window opening or closing and some error events.

Thank you
walter

Yes, it applies for all the windows but with some changes it can be made play different sounds depending on the window, should be relatively easy to implement, will try adding it this weekend. I will likely expose it as a JSON input field where you can manually set sounds per app

Using the “technique” (aka “dirty clueless hack”) described above, this worked for me:

cvlc --play-and-exit --no-loop /usr/share/sounds/ocean/stereo/bell.oga;picmi

You do need VLC installed.