feat(ALabel): Toggleable labels

This commit is contained in:
Alexis
2018-08-27 01:36:25 +02:00
parent e9478f548e
commit 53956d9d18
13 changed files with 75 additions and 63 deletions

View File

@ -1,7 +1,7 @@
#include "modules/clock.hpp"
waybar::modules::Clock::Clock(const Json::Value& config)
: ALabel(config)
: ALabel(config, "{:%H:%M}")
{
label_.set_name("clock");
uint32_t interval = config_["interval"] ? config_["inveral"].asUInt() : 60;
@ -17,6 +17,5 @@ waybar::modules::Clock::Clock(const Json::Value& config)
auto waybar::modules::Clock::update() -> void
{
auto localtime = fmt::localtime(std::time(nullptr));
auto format = config_["format"] ? config_["format"].asString() : "{:%H:%M}";
label_.set_text(fmt::format(format, localtime));
label_.set_text(fmt::format(format_, localtime));
}