mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Revert "feat(Cpu): dynamic fmt args"
This reverts commit 2d9bcb1a2df916e4a6846659ce91c5cd8038097e.
This commit is contained in:
parent
717a07d584
commit
f8c06b27ae
@ -13,20 +13,13 @@ waybar::modules::Cpu::Cpu(const std::string& id, const Json::Value& config)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Cpu::update() -> void {
|
auto waybar::modules::Cpu::update() -> void {
|
||||||
std::vector<fmt::basic_format_arg<fmt::format_context>> args;
|
// TODO: as creating dynamic fmt::arg arrays is buggy we have to calc both
|
||||||
if (format_.find("{load}") != std::string::npos) {
|
auto cpu_load = getCpuLoad();
|
||||||
auto cpu_load = getCpuLoad();
|
auto [cpu_usage, tooltip] = getCpuUsage();
|
||||||
args.emplace_back(fmt::internal::make_arg<fmt::format_context>(fmt::arg("load", cpu_load)));
|
if (tooltipEnabled()) {
|
||||||
|
label_.set_tooltip_text(tooltip);
|
||||||
}
|
}
|
||||||
if (format_.find("{usage}") != std::string::npos) {
|
label_.set_markup(fmt::format(format_, fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage)));
|
||||||
auto [cpu_usage, tooltip] = getCpuUsage();
|
|
||||||
args.emplace_back(fmt::internal::make_arg<fmt::format_context>(fmt::arg("usage", cpu_usage)));
|
|
||||||
if (tooltipEnabled()) {
|
|
||||||
label_.set_tooltip_text(tooltip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
label_.set_markup(
|
|
||||||
fmt::vformat(format_, fmt::basic_format_args<fmt::format_context>(args.data(), args.size())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t waybar::modules::Cpu::getCpuLoad() {
|
uint16_t waybar::modules::Cpu::getCpuLoad() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user