Adding Sound-Effects to Sway, Hyprland and other Tilling-WM's

I wanted to add sound effects to my Sway desktop for different actions like ScreenLock and similar things. Thanks to the way most dot-File WMs work, you can add commands to almost any action. There is a little program that lets you play music in your terminal called sox. It has a command called "play". You can use this to play a sound when you start your sway season, for example:

exec_always sleep 3 && play '/home/XXXX/.config/sway/Files/Audio/SFX/Windows_XP-Startup.wav'

Or if you want a notification sound you can add this script to your swaync config. Here you need to run a bash script for the sound, because swaync has some restrictions on what the commands in the config can do:

swaync-config:

... "scripts": { "sound-script": { "exec": "bash /home/XXXX/.config/sway/swaync/Sound.sh", "app-name": ".*" } }, ...

Sound.sh:

#!/bin/bash play '/home/XXXX/.config/sway/Files/Audio/SFX/Windows_XP-Notify.wav'

And the last thing to do is to add sounds to hotkeys or actions in your wm. This is relatively easy; You need to put the play command before or after the original command and either, "&&" to do one thing first and then the other, or a "&" to do both commands at the same time. For example:


Start steam and play Sound at the same time:

bindsym $mod+s exec steam & play '/home/XXXX/.config/sway/Files/Audio/SFX/Reverb_Fart.mp3'


Play sound and then close sway:

bindsym $mod+m exec play '/home/lisa/.config/sway/Files/Audio/SFX/Windows_XP-Shutdown.wav' && sway exit


Have fun with your own soundpack :D. I made myself a Meme dot-File-Setup that has almost all the Windows XP sounds xD. To be honest. I kinda like a lot of the sounds Windows XP had and the things like screen lock or notification sounds from XP are really present and clearly signal what you just did without looking.



Sources: