aboutsummaryrefslogtreecommitdiff
path: root/src/wallpaper.cpp
blob: b4e0b7654ac2ed5443fc29fc33e92edc421f1cce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "logging.hpp"
#include "optional.hpp"
#include "setting.hpp"
#include "wallpaper.hpp"

namespace wanda
{
  void set_wallpaper(std::filesystem::path wallpaper)
  {
    using namespace wanda::literals;
    using namespace wanda::std_ext;
    using namespace std::string_literals;

    with("org.gnome.desktop.background"_setting, [&](auto & setting) {
      with(setting["picture-uri"_key], [&](auto & value) {
        value = "file://" + wallpaper.native();
      }) ||
          [&] { get_logger()->error("invalid settings key"); };
    }) ||
        [&] { get_logger()->error("invalid setting"); };
  }

}  // namespace wanda