diff options
author | Alex McGrath <amk@amk.ie> | 2020-12-19 21:47:45 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-21 00:17:12 +0100 |
commit | f1d7d864ae4c8df8fb9a2ea6c7d1f761bc0bee7e (patch) | |
tree | de73e99415f1e49c0bfbc0090d1d3627d6ee2dc1 /Applications | |
parent | 0cc970bd07c0fa339d7f35d468fd0923aaf7e3a2 (diff) | |
download | serenity-f1d7d864ae4c8df8fb9a2ea6c7d1f761bc0bee7e.zip |
LibVT+Terminal: Add the option to disable the bell
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/Terminal/main.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/Applications/Terminal/main.cpp b/Applications/Terminal/main.cpp index 64dbb2193d..6a785e346f 100644 --- a/Applications/Terminal/main.cpp +++ b/Applications/Terminal/main.cpp @@ -193,10 +193,28 @@ static RefPtr<GUI::Window> create_settings_window(TerminalWidget& terminal) auto& sysbell_radio = radio_container.add<GUI::RadioButton>("Use (Audible) System Bell"); auto& visbell_radio = radio_container.add<GUI::RadioButton>("Use (Visual) Terminal Bell"); - sysbell_radio.set_checked(terminal.should_beep()); - visbell_radio.set_checked(!terminal.should_beep()); - sysbell_radio.on_checked = [&terminal](const bool checked) { - terminal.set_should_beep(checked); + auto& nobell_radio = radio_container.add<GUI::RadioButton>("Disable Terminal Bell"); + + switch (terminal.bell_mode()) { + case TerminalWidget::BellMode::Visible: + sysbell_radio.set_checked(true); + break; + case TerminalWidget::BellMode::AudibleBeep: + visbell_radio.set_checked(true); + break; + case TerminalWidget::BellMode::Disabled: + nobell_radio.set_checked(true); + break; + } + + sysbell_radio.on_checked = [&terminal](const bool) { + terminal.set_bell_mode(TerminalWidget::BellMode::AudibleBeep); + }; + visbell_radio.on_checked = [&terminal](const bool) { + terminal.set_bell_mode(TerminalWidget::BellMode::Visible); + }; + nobell_radio.on_checked = [&terminal](const bool) { + terminal.set_bell_mode(TerminalWidget::BellMode::Disabled); }; auto& slider_container = settings.add<GUI::GroupBox>("Background Opacity"); @@ -316,7 +334,15 @@ int main(int argc, char** argv) terminal.apply_size_increments_to_window(*window); window->show(); window->set_icon(app_icon.bitmap_for_size(16)); - terminal.set_should_beep(config->read_bool_entry("Window", "AudibleBeep", false)); + + auto bell = config->read_entry("Window", "Bell", "Visible"); + if (bell == "AudibleBeep") { + terminal.set_bell_mode(TerminalWidget::BellMode::AudibleBeep); + } else if (bell == "Disabled") { + terminal.set_bell_mode(TerminalWidget::BellMode::Disabled); + } else { + terminal.set_bell_mode(TerminalWidget::BellMode::Visible); + } RefPtr<GUI::Window> settings_window; |