2016-11-02 19:22:45 +00:00
|
|
|
#include "modules/counter.hpp"
|
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
#include "modules/meta/base.inl"
|
|
|
|
#include "modules/meta/timer_module.inl"
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS
|
2016-11-02 19:22:45 +00:00
|
|
|
|
|
|
|
namespace modules {
|
2016-11-20 22:04:31 +00:00
|
|
|
template class module<counter_module>;
|
|
|
|
template class timer_module<counter_module>;
|
|
|
|
|
2016-11-02 19:22:45 +00:00
|
|
|
void counter_module::setup() {
|
|
|
|
m_interval = chrono::duration<double>(m_conf.get<float>(name(), "interval", 1));
|
|
|
|
m_formatter->add(DEFAULT_FORMAT, TAG_COUNTER, {TAG_COUNTER});
|
|
|
|
}
|
|
|
|
|
|
|
|
bool counter_module::update() {
|
|
|
|
m_counter++;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-25 12:55:15 +00:00
|
|
|
bool counter_module::build(builder* builder, const string& tag) const {
|
2016-11-02 19:22:45 +00:00
|
|
|
if (tag == TAG_COUNTER) {
|
|
|
|
builder->node(to_string(m_counter));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS_END
|