mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
DisplaySettings: Update selected theme on change
Previously the "Theme" tab in DisplaySettings would only reflect the current theme on startup and get out of sync when a theme would get selected using the taskbar menu.
This commit is contained in:
parent
82f537b847
commit
278fd28502
1 changed files with 16 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
|
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
|
||||||
|
* Copyright (c) 2022, Jakob-Niklas See <git@nwex.de>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
#include <AK/QuickSort.h>
|
#include <AK/QuickSort.h>
|
||||||
#include <Applications/DisplaySettings/ThemesSettingsGML.h>
|
#include <Applications/DisplaySettings/ThemesSettingsGML.h>
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/ConnectionToWindowServer.h>
|
#include <LibGUI/ConnectionToWindowServer.h>
|
||||||
#include <LibGUI/ItemListModel.h>
|
#include <LibGUI/ItemListModel.h>
|
||||||
#include <LibGUI/Process.h>
|
#include <LibGUI/Process.h>
|
||||||
|
@ -54,6 +56,20 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
|
||||||
m_cursor_themes_button->on_click = [&](auto) {
|
m_cursor_themes_button->on_click = [&](auto) {
|
||||||
GUI::Process::spawn_or_show_error(window(), "/bin/MouseSettings", Array { "-t", "cursor-theme" });
|
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()
|
void ThemesSettingsWidget::apply_settings()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue