mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat(modules): generic label module to allow max-length on all labels
This commit is contained in:
@ -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_;
|
||||
}
|
||||
|
Reference in New Issue
Block a user