Skip to content
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 option to suppress bell in Terminus with Sublime Text #390

Open
tbullock opened this issue Apr 14, 2023 · 6 comments
Open

Add option to suppress bell in Terminus with Sublime Text #390

tbullock opened this issue Apr 14, 2023 · 6 comments

Comments

@tbullock
Copy link

Description:
Currently, when using Terminus with Sublime Text, there is no option to suppress the bell sound when a shell generates it. This is particularly problematic when connecting over SSH or when running shell commands that produce a bell character, such as when a command is completed, or when there is an error. The lack of an option to suppress the bell can be disruptive and distracting to users.

Suggested Solution:
Suggest adding an option to Terminus that would allow users to disable the bell sound when it is generated by the shell. This could be a simple boolean in the Terminus settings that when true, would suppress the bell sound. This would provide users with greater control over the sound settings in Terminus and improve their overall user experience.

Steps to Reproduce:

  1. Open Terminus with Sublime Text.
  2. Run a shell command that generates a bell character.
  • For Windows: Type the command echo ^G and press Enter where ^G is entered by pressing Ctrl and G simultaneously.
  • For Unix-like systems: Type the command echo -e '\a' and press Enter.
  1. Notice that the bell sound is played and cannot be disabled.

Note that bell characters are regularly generated in many shells when failing to auto-complete, attempting to back-space before the beginning of a line, etc. It is quite distracting.

Expected Result:
The bell sound is not played when the option to suppress it is enabled.

Actual Result:
The bell sound is played even when there is no option to suppress it.

Environment:

  • Terminus version: 0.3.28
  • Sublime Text version: 3.2.2 Build 3211
  • Operating system: Windows 10

Additional Information:
This feature request would greatly benefit users who work with Terminus on a regular basis, particularly those who connect to remote servers via SSH or work with shell commands that produce a bell character. The ability to suppress the bell sound would make it easier to focus on their work without being disrupted by unnecessary sounds.

@randy3k
Copy link
Owner

randy3k commented Apr 14, 2023

It is only a windows issue? echo -e '\a' doesn't produce a bell sound on macOS.

Anyway, it could be fixed by overriding some methods in TerminalPtyProcess.
Need to check what it is.

@tbullock
Copy link
Author

tbullock commented Apr 14, 2023

I'm not entirely certain if this is true, but I would be willing to bet that Macos disables the bell character from doing anything by default. It's a terminal feature from the era when teletype operators needed to get the attention of each other, they could send a bell character which would ring the bell at the remote end of a teletype. This was adopted in early Unix and Windows and remains to this day. Many modern terminals (including the new-fangled Windows terminal) can disable it entirely.

To answer your question, it definitely does impact Windows. I'm sitting here going batty when I try to use Terminus and get bells going off when I hit a typo!

For instance on Windows terminal:
image

and PuTTY

image

etc etc, it's a common feature.

I think the solution might be something like this

# Within the _parser_fsm method

if char in basic:
    if (char == ctrl.SI or char == ctrl.SO) and self.use_utf8:
        continue

    # Add this conditional check to suppress the bell character if the setting is enabled
    if char == "\a" and self.suppress_bell:
        continue

And just add a boolean option suppress_bell to sublime settings

@randy3k
Copy link
Owner

randy3k commented Apr 14, 2023

I meant it doesn’t produce a bell sound on macOS Terminus. It certainly makes a noise in the system Terminal.

I tracked upstream, it seems that the default implementation is empty
https://github.com/selectel/pyte/blob/a1c089e45b5d0eef0f3450984350254248f02519/pyte/screens.py#L958

@randy3k
Copy link
Owner

randy3k commented Apr 14, 2023

Found it. rprichard/winpty#147

It is an windows specific issue because of the use of winpty on windows. There is a workaround in an upstream bug.

Ultimately, we want to move to newer version of pywinpty which uses the ConPTY instead of winpty.

@randy3k
Copy link
Owner

randy3k commented Apr 14, 2023

Besides the workaround, there is nothing we could do here. The signal was intercepted by winpty and the sound was made even before it reaches Terminus.

@tbullock
Copy link
Author

For the time being, I've switched from KSH to CSH on the target machine since it can be configured not to emit bell characters as a workaround.

Ideally, the terminal should be able to handle this though. Thanks for the footwork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants