vscode: Audio bell does not work in integrated terminal
- VSCode Version: 1.22.1 (commit
950b8b0d37a9b7061b6f0d291837ccc4015f5ecd
) - OS Version: Ubuntu 17.10
Steps to Reproduce:
- Open an integrated terminal
- Type
echo "\a"
Assuming your OS is configured to allow TTY, you should hear a bell. In a normal terminal, this works fine. In code’s, it does not.
Does this issue occur when all extensions are disabled?: Yes
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 23
- Comments: 54 (24 by maintainers)
Commits related to this issue
- Enable media-src self See #47711 — committed to microsoft/vscode by Tyriar 5 years ago
- fix #47711 — committed to microsoft/vscode by meganrogge 2 years ago
- xterm@4.2.0 Diff: https://github.com/xtermjs/xterm.js/compare/d9f58c0...f30c38f - Fix edge case in text decoder - mp3 sound, fixes #47711 - New column sequences - Limit parse buffer size - -1 dispos... — committed to code-oss-dev/code by Tyriar 5 years ago
I think an audible bell would be preferable
@tjx666 it was never lacking shell integration, it’s an issue with Electron sound. We seem to have worked around those since audio cues are now supported, this just needs someone to investigate and create a sound (which I’ve requested internally).
we will release this version in a few weeks @nnWhisperer
Electron appears to offer a way to invoke the default system sound: shell.beep()
https://www.electronjs.org/docs/api/shell#shellbeep
it’s been a long road. getting from there to here. -rest of the enterprise theme song-
I know it’s not the sound, but a visual bell is coming in the upcoming release which is driven by the same setting: https://github.com/microsoft/vscode/issues/121939
here is a +1 from 2021
MacOS work-around:
osascript -e "beep beep beep"
I’m seeing this too.
Even with
terminal.integrated.enableBell
enabled, runningprintf "\a"
in the VS Code Integrated Terminal triggers no sound, despite the same command triggering a sound in my OS terminal.MacOS 10.14.5
Just wanted to add a data point about this commands usefulness:
I typically run commands that take 1-2 minutes to complete in the terminal. Ex: building or compiling a program In iTerm or terminal app, I tend to append the
beep
command at the end of my program to let me know when its done.Personal reason:
beep
command, I just close my eyes and let thebeep
command tell me when my command is done 🔔Work around for now for VSCode terminal:
As other’s have mentioned there is a work around. I’ve created these shell aliases below that can be added to your
.bashrc
,.zshrc
files etc.Usage:
@tjx666 I think it will look bad if we change the title in the dropdown as other titles will shift around when the bell triggers. We might end up adding a visual bell mode later on when this issue gets tackled that will flash the border around the terminal or something.
I can also reproduce this issue in macOS with
VS Code: 1.34.0 macOS: 10.14.5
i can confirm
printf '\a'
orecho '\a'
will give a chime. BUT:it is NOT the system chime, NOR does it bump the VSCode icon in the dock, NOR does it add a notification icon to VSCode in the dock. (terminal does all this, see icon attached)
to reproduce in terminal, you might have to test it using a sleep, so you have time to unfocus the terminal before it rings the bell:
sleep 5 && printf '\a'
and then quickly focus another app within 5 secondsFound myself on
Version: 1.72.2
and can confirm that enabling the setting does in fact give you a bell sound 😄Enable with
Cmd + Shift + P
, search/selectPreferences: Open Settings (UI)
, search for “bell” and check on the “Terminal > Integrated: Enable Bell” toggle.Can also use
Moving forward
printf '\a'
will give you a chime.The audio bell works on my computer! Thanks for your work - this has been a huge pain point for my workflow for years.
You need to opt in w the setting for it to work (it’s off by default)
It’s nice that there are workarounds like
osascript
, but many existing shell scripts expect the actual bell (tput bel
) to work and don’t allow any customization to replace it with anything else.Same issue on : Version: 1.52.1 Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523 Date: 2020-12-16T16:30:02.420Z Electron: 9.3.5 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Darwin x64 18.7.0
Tested via nodejs with : console.log(“\x07”) workaround :
Wish it worked in a loop, so that function could accept nTimes argument for number of beeps.
Using
speaker-test
in vscode terminal (Arch Linux) also fails to emit audio. Outside vscode it is working fine.@deepak1556 I just found a public domain bell-like sound. xterm.js is a web app and doesn’t have access to some system bell sound.