1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 21:45:08 +00:00

FileManager: Apply wallpaper on startup

I noticed that nothing actually applies the wallpaper on startup.
I wasn't sure where to put the responsibility, so I gave it to
the desktop mode file manager.

Also adds a save_config option to set_wallpaper so it doesn't
needlessly save the config.
This commit is contained in:
Luke 2020-08-14 21:17:46 +01:00 committed by Andreas Kling
parent 14a54a72fa
commit c434a91c91
3 changed files with 10 additions and 3 deletions

View file

@ -64,12 +64,12 @@ void Desktop::set_wallpaper_mode(const StringView& mode)
WindowServerConnection::the().post_message(Messages::WindowServer::SetWallpaperMode(mode));
}
bool Desktop::set_wallpaper(const StringView& path)
bool Desktop::set_wallpaper(const StringView& path, bool save_config)
{
WindowServerConnection::the().post_message(Messages::WindowServer::AsyncSetWallpaper(path));
auto ret_val = WindowServerConnection::the().wait_for_specific_message<Messages::WindowClient::AsyncSetWallpaperFinished>()->success();
if (ret_val) {
if (ret_val && save_config) {
RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("WindowManager");
dbg() << "Saving wallpaper path '" << path << "' to config file at " << config->file_name();
config->write_entry("Background", "Wallpaper", path);