Skip to content

Commit

Permalink
LibGUI: Save current wallpaper setting to WindowManager.ini.
Browse files Browse the repository at this point in the history
  • Loading branch information
asliturk authored and awesomekling committed Feb 2, 2020
1 parent c5edc09 commit 9dfe652
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Libraries/LibGUI/GDesktop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <LibCore/CConfigFile.h>
#include <LibGUI/GDesktop.h>
#include <LibGUI/GWindowServerConnection.h>
#include <string.h>
Expand Down Expand Up @@ -53,7 +54,17 @@ void GDesktop::did_receive_screen_rect(Badge<GWindowServerConnection>, const Rec
bool GDesktop::set_wallpaper(const StringView& path)
{
GWindowServerConnection::the().post_message(WindowServer::AsyncSetWallpaper(path));
return GWindowServerConnection::the().wait_for_specific_message<WindowClient::AsyncSetWallpaperFinished>()->success();
auto ret_val = GWindowServerConnection::the().wait_for_specific_message<WindowClient::AsyncSetWallpaperFinished>()->success();

if (ret_val) {
dbg() << "Saving wallpaper path '" << path << "' to config file at " << config->file_name();

RefPtr<CConfigFile> config = CConfigFile::get_for_app("WindowManager");
config->write_entry("Background", "Wallpaper", path);
config->sync();
}

return ret_val;
}

String GDesktop::wallpaper() const
Expand Down

0 comments on commit 9dfe652

Please sign in to comment.