aboutsummaryrefslogtreecommitdiff
path: root/src/wallpaper.cpp
blob: 39abb600dc3faed8cab84adeac9e06cf76a0f158 (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 "optional.hpp"
#include "setting.hpp"
#include "wallpaper.hpp"

#include <iostream>

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();
        }) || [] { std::cerr << "No such key!\n"; };
    }) || [] { std::cerr << "No such setting!\n"; };
}

} // namespace wanda