diff options
Diffstat (limited to 'src/wanda/wallpaper.cpp')
| -rw-r--r-- | src/wanda/wallpaper.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wanda/wallpaper.cpp b/src/wanda/wallpaper.cpp new file mode 100644 index 0000000..3fc93b3 --- /dev/null +++ b/src/wanda/wallpaper.cpp @@ -0,0 +1,23 @@ +#include <wanda/logging.hpp> +#include <wanda/optional.hpp> +#include <wanda/setting.hpp> +#include <wanda/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
\ No newline at end of file |
