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/clock.hpp"
waybar::modules::Clock::Clock(Json::Value config)
: config_(std::move(config))
: ALabel(std::move(config))
{
label_.set_name("clock");
uint32_t interval = config_["interval"] ? config_["inveral"].asUInt() : 60;
@ -12,7 +12,7 @@ waybar::modules::Clock::Clock(Json::Value config)
+ std::chrono::seconds(interval));
thread_.sleep_until(timeout);
};
};
}
auto waybar::modules::Clock::update() -> void
{
@ -20,7 +20,3 @@ auto waybar::modules::Clock::update() -> void
auto format = config_["format"] ? config_["format"].asString() : "{:%H:%M}";
label_.set_text(fmt::format(format, localtime));
}
waybar::modules::Clock::operator Gtk::Widget &() {
return label_;
}