-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the BEL control in Windows Terminal #7679
Conversation
Somewhat related to MSFT:14062483. |
Ah. ‘483 is a “complaint” that we changed the bell from a “ding” to the STOP sound in Windows 8(?) or so. I should cut that deliverable: we aren’t going to change it in conhost. |
I'm not sure what's up with the CI bot. It appears to be failing in a feature test on this line: terminal/src/host/ft_host/API_OutputTests.cpp Line 101 in a13ccfd
I can't imagine that has anything to do with the changes in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(leaving a block to formulate my thoughts)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know what, I think I've come up with what I think Dustin's block is over - we probably want the bell to be played by the TermControl
layer, not the Terminal
layer. That way each control implementation can control how the sound is played. Sure, right now the TermControl and the WPF Control will probably want to do the same thing, but someone could theoretically imagine another control that wanted to be able to customize this further.
Piping this up one more level shouldn't be too hard...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, yea this is better. Should we go ahead and implement this for the WPF control at the same time as well? (I won't block over that, we can always file a follow-up for that as well)
I'm a bit out of my depth here. Am I right in thinking I actually need to turn this into an event handler of some sort? So I've going to do a bit more digging and see how some of the other event handling code works, but I just want to make sure this is what you actually had in mind. Of if you think it's better for me to leave this for someone that knows what they're doing and I can do that to. |
@j4james oh no, I don't think it needs to be that complicated. The WPFControl lives at the same layer as the TermControl (it's just embedded in VS instead of in the Terminal app). So in the same way that TermControl registers the function pointer for the callback with |
Mike anticipated my block perfectly! I think that we should pipe this up out of TermControl as an event that TerminalPage/TerminalApp can receive. It's annoying plumbing work, but it'll enable us to light up features like "tab highlight on BEL" (or "put 🔔 icon in tab on BEL") and flip the configuration for whether bells sound to being TerminalApp-only instead of having to push it down into TerminalControl via ITerminalSettings. You can mimic the
|
OK I've added the event handling now, and hooked up the |
Thanks for doing the event work for Cascadia. We can definitely hold WPF back for another change. It usually gets that treatment anyway 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent as always. Thanks!
Is there a fix for the silent bell? Terminal version 1.3.2651.0 |
@jarlva I think you can expect this to be fixed in Windows Terminal 1.5, which will be released to public near the end of October. |
Adds a new setting, `bellStyle`, to be able to disable the audible bell added in #7679. Currently, this setting accepts two values: * `audible`: play a noise on a bell * `none`: Don't play a noise. In the future, we can add a `"bellStyle": "visible"` for flashing the Terminal instead of making a noise on bell. ## Validation Steps Performed Pressing <kbd>Ctrl+G</kbd> in cmd, and hitting enter is an easy way of triggering a bell. I set the setting to `none`, and presto, the bell stopped. Closes #2360
🎉 Handy links: |
Summary of the Pull Request
This PR makes the Windows Terminal play an audible sound when the
BEL
control character is output.References
BEL
to trigger visual forms of notification.BEL
, which should probably be reopened, because this PR does not include any such configuration.PR Checklist
Detailed Description of the Pull Request / Additional comments
The
BEL
control was already being forwarded through conpty, so it was just a matter of hooking up theWarningBell
dispatch method to actually play a sound. I've used thePlaySound
API to output the sound configured for the "Critical Stop" system event (aka SystemHand), since that is the sound used in conhost.Validation Steps Performed
I've manually confirmed that the terminal produces the expected sound when executing
echo ^G
in a cmd shell, orprintf "\a"
in a WSL bash shell.