feat(modules): generic label module to allow max-length on all labels

This commit is contained in:
Alexis
2018-08-18 11:43:48 +02:00
parent c128562284
commit b1fd4d7b82
19 changed files with 76 additions and 99 deletions

View File

@ -1,7 +1,7 @@
#include "modules/cpu.hpp"
waybar::modules::Cpu::Cpu(Json::Value config)
: config_(std::move(config))
: ALabel(std::move(config))
{
label_.set_name("cpu");
uint32_t interval = config_["interval"] ? config_["inveral"].asUInt() : 10;
@ -9,7 +9,7 @@ waybar::modules::Cpu::Cpu(Json::Value config)
Glib::signal_idle().connect_once(sigc::mem_fun(*this, &Cpu::update));
thread_.sleep_for(chrono::seconds(interval));
};
};
}
auto waybar::modules::Cpu::update() -> void
{
@ -21,7 +21,3 @@ auto waybar::modules::Cpu::update() -> void
label_.set_text(fmt::format(format, load));
}
}
waybar::modules::Cpu::operator Gtk::Widget &() {
return label_;
}