Like many other people, I dislike the standard error sound that Windows makes when auto-complete fails or when return is hit on an empty line in the WSL bash. Info: Windows 10 Edu, WSL2 with Ubuntu 20.04.

However, I don't want to eliminate it- I want to change it. I can only find tricks to eliminate it either via Sound Mixer or editing the inputrc file. There is one answer saying I can change the whole sound, which is of course not what I want. I would like a custom sound for WSL bash, and the rest to remain Win-default.

Is this possible? Perhaps registry or something within WSL itself?

I found the sounds under /usr/share/sounds/freedesktop/stereo, which has the bell.oga file which is what I would like to use. I installed gnome-tweaks which is where I'd adjust this on Ubuntu; but I haven't gotten the GUI within WSL2 working yet. Either way I am unsure whether any setting within WSL affects that Windows treats the WSL bash as just another "console host window". I'd appreciate any leads on this!


Short answer -- Probably not without using a different Terminal Emulator.

The sound that plays for the "bell" is determined by the Terminal Emulator. In your case, since you call it "WSL bash", you are probably launching it with the bash command (or perhaps the distribution name), and thus using the resulting Windows Console. Windows Console is very basic, without many configuration options. As you've discovered, it relies on the Windows "Critical Stop" sound.

And in that, it isn't alone. Even if you upgrade to Microsoft's much more modern, open-source (and actively developed) Windows Terminal (installable from the Microsoft Store) as a replacement, it still just calls the Critical Stop sound as well. It's Microsoft software, so that makes sense -- they are likely going to rely on the underlying Windows API's. There are options to disable, enable, or use visual bell only. But no option to change the sound itself.

That said, the Windows Terminal team does take feature requests (through Github), so it can't hurt to ask.

Even the popular alternative ConEmu seems to do the same.

Hyper is another alternative. I see that there's a "BellURL" option in its config, but I can't find any documentation on how it works. Might be worth checking out, though.

While I haven't tried this route, you could also consider installing X Server in WSL and using one of the myriad Linux Terminal Emulators. I'm guessing that some of these would have a setting for the this. You'd also need audio support -- I believe this is done through PulseAudio. There's a Kali distribution (Win-KeX that bundles this. I did try to install it a while back, but I was unsuccessful. I honestly didn't put much effort into it.

Finally, Microsoft is adding full graphical support to WSL (called WSLg), with audio as well. Once this is done, as with the previous option, you could use a Linux Terminal Emulator inside Windows to run the WSL Bash shell. It's currently in the Insider/Preview release of Windows (which I don't necessarily recommend installing on your day-to-day computer) for release later this year.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.