diff options
author | networkException <git@nwex.de> | 2022-06-16 20:28:48 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-17 19:46:30 +0100 |
commit | e2d2b403e9264bb86062cc7f3711390d8c082650 (patch) | |
tree | 1648f115cb6df7ace0db2a5fb0c732394585263a /Userland/Applications | |
parent | c76c3e38e68436e27f44adf53ba376bd907bebbc (diff) | |
download | serenity-e2d2b403e9264bb86062cc7f3711390d8c082650.zip |
DisplaySettings: Handle an override theme being active
This patch updates the "Theme" tab to react to an override theme being
set. The preview will reflect the override theme and the combo box will
show no selection.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp index 6a0bd8714b..16710544b7 100644 --- a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp @@ -30,15 +30,15 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed) size_t current_theme_index; auto current_theme_name = current_system_theme(); + auto theme_overridden = GUI::ConnectionToWindowServer::the().is_system_theme_overridden(); m_theme_names.ensure_capacity(m_themes.size()); for (auto& theme_meta : m_themes) { m_theme_names.append(theme_meta.name); - if (current_theme_name == theme_meta.name) { + if (!theme_overridden && current_theme_name == theme_meta.name) { m_selected_theme = &theme_meta; current_theme_index = m_theme_names.size() - 1; } } - VERIFY(m_selected_theme); m_theme_preview = find_descendant_of_type_named<GUI::Frame>("preview_frame")->add<ThemePreviewWidget>(palette()); m_themes_combo = *find_descendant_of_type_named<GUI::ComboBox>("themes_combo"); m_themes_combo->set_only_allow_values_from_model(true); @@ -58,6 +58,13 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed) }; GUI::Application::the()->on_theme_change = [&]() { + auto theme_override = GUI::ConnectionToWindowServer::the().get_system_theme_override(); + if (theme_override.has_value()) { + m_themes_combo->clear_selection(); + static_cast<RefPtr<GUI::AbstractThemePreview>>(m_theme_preview)->set_theme(*theme_override); + return; + } + auto current_theme_name = current_system_theme(); size_t index = 0; |