Skip to content

Commit

Permalink
WindowServer: Reuse config variable from the class on theme change
Browse files Browse the repository at this point in the history
When changing the theme, there were two Core::ConfigFile instances
(one class scoped -- m_config and one function scoped -- wm_config)
fighting over the file, resulting in not saving the new theme name
to the config. :^(

This makes WindowServer remember selected theme from the menu
after reboot!
  • Loading branch information
Karol Kosek authored and awesomekling committed Jul 21, 2021
1 parent d804ce8 commit f2c9ef3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Userland/Services/WindowServer/WindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1955,10 +1955,9 @@ bool WindowManager::update_theme(String theme_path, String theme_name)
return false;
Gfx::set_system_theme(new_theme);
m_palette = Gfx::PaletteImpl::create_with_anonymous_buffer(new_theme);
auto wm_config = Core::ConfigFile::open("/etc/WindowServer.ini");
wm_config->write_entry("Theme", "Name", theme_name);
wm_config->remove_entry("Background", "Color");
wm_config->sync();
m_config->write_entry("Theme", "Name", theme_name);
m_config->remove_entry("Background", "Color");
m_config->sync();
invalidate_after_theme_or_font_change();
return true;
}
Expand Down

0 comments on commit f2c9ef3

Please sign in to comment.