summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2022-01-14 20:40:30 -0800
committerAndreas Kling <kling@serenityos.org>2022-01-15 11:03:23 +0100
commitab4035e227ccd3b9cf81453f9387ca0dc0de1272 (patch)
treee98565c6a7510e504b06f8066dfa3fbaa066bfc8 /Userland
parent0e26ba59f7f0ff6f83df2b12ca6ea5e7bd261b57 (diff)
downloadserenity-ab4035e227ccd3b9cf81453f9387ca0dc0de1272.zip
TerminalSettings: Expose a CheckBox controlling scrollbar visibility
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/TerminalSettings/TerminalSettingsMain.gml5
-rw-r--r--Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp11
-rw-r--r--Userland/Applications/TerminalSettings/TerminalSettingsWidget.h2
3 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsMain.gml b/Userland/Applications/TerminalSettings/TerminalSettingsMain.gml
index 5a44a1f955..dddb7dadb6 100644
--- a/Userland/Applications/TerminalSettings/TerminalSettingsMain.gml
+++ b/Userland/Applications/TerminalSettings/TerminalSettingsMain.gml
@@ -53,6 +53,11 @@
margins: [16, 8, 8]
}
+ @GUI::CheckBox {
+ name: "terminal_show_scrollbar"
+ text: "Show scrollbar"
+ }
+
@GUI::SpinBox {
name: "history_size_spinbox"
min: 0
diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
index 83551f5589..0399efe935 100644
--- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
+++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp
@@ -74,6 +74,15 @@ TerminalSettingsMainWidget::TerminalSettingsMainWidget()
m_max_history_size = value;
Config::write_i32("Terminal", "Terminal", "MaxHistorySize", static_cast<i32>(m_max_history_size));
};
+
+ m_show_scrollbar = Config::read_bool("Terminal", "Terminal", "ShowScrollBar", true);
+ m_orignal_show_scrollbar = m_show_scrollbar;
+ auto& show_scrollbar_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("terminal_show_scrollbar");
+ show_scrollbar_checkbox.on_checked = [&](bool show_scrollbar) {
+ m_show_scrollbar = show_scrollbar;
+ Config::write_bool("Terminal", "Terminal", "ShowScrollBar", show_scrollbar);
+ };
+ show_scrollbar_checkbox.set_checked(m_show_scrollbar);
}
TerminalSettingsViewWidget::TerminalSettingsViewWidget()
@@ -175,12 +184,14 @@ String TerminalSettingsMainWidget::stringify_bell(VT::TerminalWidget::BellMode b
void TerminalSettingsMainWidget::apply_settings()
{
m_original_max_history_size = m_max_history_size;
+ m_orignal_show_scrollbar = m_show_scrollbar;
m_original_bell_mode = m_bell_mode;
write_back_settings();
}
void TerminalSettingsMainWidget::write_back_settings() const
{
Config::write_i32("Terminal", "Terminal", "MaxHistorySize", static_cast<i32>(m_original_max_history_size));
+ Config::write_bool("Terminal", "Terminal", "ShowScrollBar", m_orignal_show_scrollbar);
Config::write_string("Terminal", "Window", "Bell", stringify_bell(m_original_bell_mode));
}
diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.h b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.h
index 4f97f15a7c..5b6e280fe8 100644
--- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.h
+++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.h
@@ -28,9 +28,11 @@ private:
VT::TerminalWidget::BellMode m_bell_mode = VT::TerminalWidget::BellMode::Disabled;
size_t m_max_history_size;
+ bool m_show_scrollbar { true };
VT::TerminalWidget::BellMode m_original_bell_mode;
size_t m_original_max_history_size;
+ bool m_orignal_show_scrollbar { true };
};
class TerminalSettingsViewWidget final : public GUI::SettingsWindow::Tab {