aboutsummaryrefslogtreecommitdiff
path: root/src/wallpaper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallpaper.cpp')
-rw-r--r--src/wallpaper.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wallpaper.cpp b/src/wallpaper.cpp
new file mode 100644
index 0000000..39abb60
--- /dev/null
+++ b/src/wallpaper.cpp
@@ -0,0 +1,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 \ No newline at end of file