summaryrefslogtreecommitdiff
path: root/Libraries/LibVT
diff options
context:
space:
mode:
authorAlex McGrath <amk@amk.ie>2020-12-19 21:47:45 +0000
committerAndreas Kling <kling@serenityos.org>2020-12-21 00:17:12 +0100
commitf1d7d864ae4c8df8fb9a2ea6c7d1f761bc0bee7e (patch)
treede73e99415f1e49c0bfbc0090d1d3627d6ee2dc1 /Libraries/LibVT
parent0cc970bd07c0fa339d7f35d468fd0923aaf7e3a2 (diff)
downloadserenity-f1d7d864ae4c8df8fb9a2ea6c7d1f761bc0bee7e.zip
LibVT+Terminal: Add the option to disable the bell
Diffstat (limited to 'Libraries/LibVT')
-rw-r--r--Libraries/LibVT/TerminalWidget.cpp5
-rw-r--r--Libraries/LibVT/TerminalWidget.h13
2 files changed, 14 insertions, 4 deletions
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp
index 46ce22bc5d..47dbe11067 100644
--- a/Libraries/LibVT/TerminalWidget.cpp
+++ b/Libraries/LibVT/TerminalWidget.cpp
@@ -812,7 +812,10 @@ void TerminalWidget::terminal_did_resize(u16 columns, u16 rows)
void TerminalWidget::beep()
{
- if (m_should_beep) {
+ if (m_bell_mode == BellMode::Disabled) {
+ return;
+ }
+ if (m_bell_mode == BellMode::AudibleBeep) {
sysbeep();
return;
}
diff --git a/Libraries/LibVT/TerminalWidget.h b/Libraries/LibVT/TerminalWidget.h
index a2793d6acd..d7b4d32c0a 100644
--- a/Libraries/LibVT/TerminalWidget.h
+++ b/Libraries/LibVT/TerminalWidget.h
@@ -61,8 +61,15 @@ public:
void set_opacity(u8);
float opacity() { return m_opacity; };
- bool should_beep() { return m_should_beep; }
- void set_should_beep(bool sb) { m_should_beep = sb; };
+
+ enum class BellMode {
+ Visible,
+ AudibleBeep,
+ Disabled
+ };
+
+ BellMode bell_mode() { return m_bell_mode; }
+ void set_bell_mode(BellMode bm) { m_bell_mode = bm; };
RefPtr<Core::ConfigFile> config() const { return m_config; }
@@ -151,7 +158,7 @@ private:
// Snapshot of m_hovered_href when opening a context menu for a hyperlink.
String m_context_menu_href;
- bool m_should_beep { false };
+ BellMode m_bell_mode { BellMode::Visible };
bool m_belling { false };
bool m_alt_key_held { false };
bool m_rectangle_selection { false };