summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp
index 2b7518e549..6a0bd8714b 100644
--- a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp
+++ b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
+ * Copyright (c) 2022, Jakob-Niklas See <git@nwex.de>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -9,6 +10,7 @@
#include <AK/QuickSort.h>
#include <Applications/DisplaySettings/ThemesSettingsGML.h>
#include <LibCore/DirIterator.h>
+#include <LibGUI/Application.h>
#include <LibGUI/ConnectionToWindowServer.h>
#include <LibGUI/ItemListModel.h>
#include <LibGUI/Process.h>
@@ -54,6 +56,20 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
m_cursor_themes_button->on_click = [&](auto) {
GUI::Process::spawn_or_show_error(window(), "/bin/MouseSettings", Array { "-t", "cursor-theme" });
};
+
+ GUI::Application::the()->on_theme_change = [&]() {
+ auto current_theme_name = current_system_theme();
+
+ size_t index = 0;
+ for (auto& theme_meta : m_themes) {
+ if (current_theme_name == theme_meta.name) {
+ m_themes_combo->set_selected_index(index, GUI::AllowCallback::No);
+ m_selected_theme = &m_themes.at(index);
+ m_theme_preview->set_theme(m_selected_theme->path);
+ }
+ ++index;
+ }
+ };
}
void ThemesSettingsWidget::apply_settings()