mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Added clock tooltip with optional alternate format
This commit is contained in:
@ -21,5 +21,16 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
|
||||
auto waybar::modules::Clock::update() -> void
|
||||
{
|
||||
auto localtime = fmt::localtime(std::time(nullptr));
|
||||
label_.set_markup(fmt::format(format_, localtime));
|
||||
auto text = fmt::format(format_, localtime);
|
||||
label_.set_markup(text);
|
||||
|
||||
if (tooltipEnabled()) {
|
||||
if (config_["tooltip-format"].isString()) {
|
||||
auto tooltip_format = config_["tooltip-format"].asString();
|
||||
auto tooltip_text = fmt::format(tooltip_format, localtime);
|
||||
label_.set_tooltip_text(tooltip_text);
|
||||
} else {
|
||||
label_.set_tooltip_text(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user