aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: 38fdf7ffadb4077b1c783610e646f4d1934e82f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "setting.hpp"
#include "optional.hpp"

#include <iostream>
#include <string>

#include <typeinfo>

int main()
{
  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) {
      std::visit([](auto &&value) {
        using ValueType = std::decay_t<decltype(value)>;
        if constexpr (std::is_same_v<ValueType, std::string>)
        {
          std::cout << value << '\n';
        }
      },
      *value);
      std::cout << (value = "file:///"s) << '\n';
    }) || [] { std::cerr << "No such key!\n"; };
  }) || [] { std::cerr << "No such setting!\n"; };
}