mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Clean (#31)
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
#include "modules/clock.hpp"
|
||||
|
||||
waybar::modules::Clock::Clock(Json::Value config)
|
||||
: ALabel(std::move(config))
|
||||
waybar::modules::Clock::Clock(const Json::Value& config)
|
||||
: ALabel(config)
|
||||
{
|
||||
label_.set_name("clock");
|
||||
uint32_t interval = config_["interval"] ? config_["inveral"].asUInt() : 60;
|
||||
thread_.sig_update.connect(sigc::mem_fun(*this, &Clock::update));
|
||||
thread_ = [this, interval] {
|
||||
auto now = waybar::chrono::clock::now();
|
||||
thread_.emit();
|
||||
dp.emit();
|
||||
auto timeout = std::chrono::floor<std::chrono::seconds>(now
|
||||
+ std::chrono::seconds(interval));
|
||||
thread_.sleep_until(timeout);
|
||||
|
Reference in New Issue
Block a user