refactor: call parent update

This commit is contained in:
Alex
2020-04-12 18:30:21 +02:00
parent 0f0765e517
commit b40cdcb5bd
17 changed files with 39 additions and 53 deletions

View File

@ -10,11 +10,6 @@ waybar::modules::Cpu::Cpu(const std::string& id, const Json::Value& config)
}
auto waybar::modules::Cpu::update() -> void {
// Run user-provided update handler if configured
if (config_["on-update"].isString()) {
AModule::update();
}
// TODO: as creating dynamic fmt::arg arrays is buggy we have to calc both
auto cpu_load = getCpuLoad();
auto [cpu_usage, tooltip] = getCpuUsage();
@ -23,6 +18,8 @@ auto waybar::modules::Cpu::update() -> void {
}
label_.set_markup(fmt::format(format_, fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage)));
getState(cpu_usage);
// Call parent update
ALabel::update();
}
uint16_t waybar::modules::Cpu::getCpuLoad() {