mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
refactor: also pass id to custom modules
This commit is contained in:
parent
e999cca7a6
commit
9e1200ae32
@ -12,7 +12,7 @@ namespace waybar::modules {
|
||||
|
||||
class Custom : public ALabel {
|
||||
public:
|
||||
Custom(const std::string&, const Json::Value&);
|
||||
Custom(const std::string&, const std::string&, const Json::Value&);
|
||||
~Custom();
|
||||
auto update() -> void;
|
||||
void refresh(int /*signal*/);
|
||||
|
@ -64,7 +64,7 @@ waybar::IModule* waybar::Factory::makeModule(const std::string& name) const {
|
||||
return new waybar::modules::Temperature(id, config_[name]);
|
||||
}
|
||||
if (ref.compare(0, 7, "custom/") == 0 && ref.size() > 7) {
|
||||
return new waybar::modules::Custom(ref.substr(7), config_[name]);
|
||||
return new waybar::modules::Custom(ref.substr(7), id, config_[name]);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
auto err = fmt::format("Disabling module \"{}\", {}", name, e.what());
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "modules/custom.hpp"
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
waybar::modules::Custom::Custom(const std::string& name, const Json::Value& config)
|
||||
: ALabel(config, "custom-" + name_, name, "{}"), name_(name), fp_(nullptr), pid_(-1) {
|
||||
waybar::modules::Custom::Custom(const std::string& name, const std::string& id,
|
||||
const Json::Value& config)
|
||||
: ALabel(config, "custom-" + name_, id, "{}"), name_(name), fp_(nullptr), pid_(-1) {
|
||||
if (config_["exec"].isString()) {
|
||||
if (interval_.count() > 0) {
|
||||
delayWorker();
|
||||
|
Loading…
Reference in New Issue
Block a user