refactor(modules): migrate state modules to ALabel tooltip helper
Migrate cpu, cpu_usage, cpu_frequency and memory to the generic updateLabelAndTooltip/ForState helper so label and tooltip rendering go through the dedup-aware setters and shared tooltip-format resolution. Add store-accepting overloads of the helper to ALabel for modules that build a dynamic fmt argument store (per-core cpu stats). cpu keeps its tooltip-format-<state> selection via the state overload; the others keep their existing tooltip-format-only behavior.
This commit is contained in:
@@ -49,16 +49,7 @@ auto waybar::modules::CpuUsage::update() -> void {
|
||||
store.push_back(fmt::arg(arg_names.back().c_str(), core_icon));
|
||||
}
|
||||
store.push_back(fmt::arg("icons", all_icons));
|
||||
label_.set_markup(fmt::vformat(format, store));
|
||||
|
||||
if (tooltipEnabled()) {
|
||||
if (config_["tooltip-format"].isString()) {
|
||||
tooltip = config_["tooltip-format"].asString();
|
||||
label_.set_tooltip_markup(fmt::vformat(tooltip, store));
|
||||
} else {
|
||||
label_.set_tooltip_markup(tooltip);
|
||||
}
|
||||
}
|
||||
updateLabelAndTooltip(format, tooltip, store);
|
||||
}
|
||||
|
||||
// Call parent update
|
||||
|
||||
Reference in New Issue
Block a user