refactor(ALabel): add interval

This commit is contained in:
Alexis
2018-11-23 11:57:37 +01:00
parent 36652158ad
commit ad7400d5ce
10 changed files with 40 additions and 40 deletions

View File

@ -1,13 +1,12 @@
#include "modules/cpu.hpp"
waybar::modules::Cpu::Cpu(const Json::Value& config)
: ALabel(config, "{usage}%")
: ALabel(config, "{usage}%", 10)
{
label_.set_name("cpu");
uint32_t interval = config_["interval"].isUInt() ? config_["interval"].asUInt() : 10;
thread_ = [this, interval] {
thread_ = [this] {
dp.emit();
thread_.sleep_for(chrono::seconds(interval));
thread_.sleep_for(interval_);
};
}