modules: Revert button to label

This commit is contained in:
Simon Plakolb
2022-11-24 12:28:52 +01:00
parent 74fa131ebe
commit 5e9bbe5c76
43 changed files with 270 additions and 265 deletions

View File

@ -10,7 +10,7 @@
#endif
waybar::modules::Cpu::Cpu(const std::string& id, const Json::Value& config)
: AButton(config, "cpu", id, "{usage}%", 10) {
: ALabel(config, "cpu", id, "{usage}%", 10) {
thread_ = [this] {
dp.emit();
thread_.sleep_for(interval_);
@ -23,7 +23,7 @@ auto waybar::modules::Cpu::update() -> void {
auto [cpu_usage, tooltip] = getCpuUsage();
auto [max_frequency, min_frequency, avg_frequency] = getCpuFrequency();
if (tooltipEnabled()) {
button_.set_tooltip_text(tooltip);
label_.set_tooltip_text(tooltip);
}
auto format = format_;
auto total_usage = cpu_usage.empty() ? 0 : cpu_usage[0];
@ -52,11 +52,11 @@ auto waybar::modules::Cpu::update() -> void {
auto icon_format = fmt::format("icon{}", core_i);
store.push_back(fmt::arg(icon_format.c_str(), getIcon(cpu_usage[i], icons)));
}
label_->set_markup(fmt::vformat(format, store));
label_.set_markup(fmt::vformat(format, store));
}
// Call parent update
AButton::update();
ALabel::update();
}
double waybar::modules::Cpu::getCpuLoad() {