diff --git a/man/waybar-image.5.scd b/man/waybar-image.5.scd index df7086f05..ff0e34c34 100644 --- a/man/waybar-image.5.scd +++ b/man/waybar-image.5.scd @@ -15,7 +15,10 @@ Addressed by *custom/* *path*: ++ typeof: string ++ The path to the image. - +*exec*: ++ + typeof: string ++ + The path to the script, which should return image path file + it will only execute if the path is not set *size*: ++ typeof: integer ++ The width/height to render the image. diff --git a/src/modules/image.cpp b/src/modules/image.cpp index eed19aea3..b153523ff 100644 --- a/src/modules/image.cpp +++ b/src/modules/image.cpp @@ -9,7 +9,6 @@ waybar::modules::Image::Image(const std::string& name, const std::string& id, dp.emit(); - path_ = config["path"].asString(); size_ = config["size"].asInt(); interval_ = config_["interval"].asInt(); @@ -40,8 +39,22 @@ void waybar::modules::Image::refresh(int sig) { } auto waybar::modules::Image::update() -> void { - Glib::RefPtr pixbuf; + util::command::res output_; + Glib::RefPtr pixbuf; + if(config_["path"].isString()) + { + path_ = config_["path"].asString(); + } + else if(config_["exec"].isString()) + { + output_ = util::command::exec(config_["exec"].asString()); + path_ =output_.out; + } + else + { + path_=""; + } if (Glib::file_test(path_, Glib::FILE_TEST_EXISTS)) pixbuf = Gdk::Pixbuf::create_from_file(path_, size_, size_); else