feat(Label): use set_markup
This commit is contained in:
parent
b3559328f1
commit
bd62c4cbc5
|
@ -24,7 +24,7 @@
|
|||
// }
|
||||
// },
|
||||
"sway/mode": {
|
||||
"format": "{}"
|
||||
"format": "<span style=\"italic\">{}</span>"
|
||||
},
|
||||
"tray": {
|
||||
// "icon-size": 21,
|
||||
|
|
|
@ -136,7 +136,7 @@ auto waybar::modules::Battery::update() -> void
|
|||
} else {
|
||||
event_box_.show();
|
||||
label_.set_name("battery");
|
||||
label_.set_text(fmt::format(format, fmt::arg("capacity", capacity),
|
||||
label_.set_markup(fmt::format(format, fmt::arg("capacity", capacity),
|
||||
fmt::arg("icon", getIcon(capacity))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,5 +17,5 @@ waybar::modules::Clock::Clock(const Json::Value& config)
|
|||
auto waybar::modules::Clock::update() -> void
|
||||
{
|
||||
auto localtime = fmt::localtime(std::time(nullptr));
|
||||
label_.set_text(fmt::format(format_, localtime));
|
||||
label_.set_markup(fmt::format(format_, localtime));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ auto waybar::modules::Cpu::update() -> void
|
|||
auto cpu_load = getCpuLoad();
|
||||
auto [cpu_usage, tooltip] = getCpuUsage();
|
||||
label_.set_tooltip_text(tooltip);
|
||||
label_.set_text(fmt::format(format_,
|
||||
label_.set_markup(fmt::format(format_,
|
||||
fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage)));
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
|
|
|
@ -80,7 +80,7 @@ auto waybar::modules::Custom::update() -> void
|
|||
}
|
||||
|
||||
auto str = fmt::format(format_, text_);
|
||||
label_.set_text(str);
|
||||
label_.set_markup(str);
|
||||
if (text_ == tooltip_) {
|
||||
label_.set_tooltip_text(str);
|
||||
} else {
|
||||
|
|
|
@ -15,7 +15,7 @@ auto waybar::modules::Memory::update() -> void
|
|||
parseMeminfo();
|
||||
if (memtotal_ > 0 && memfree_ >= 0) {
|
||||
int used_ram_percentage = 100 * (memtotal_ - memfree_) / memtotal_;
|
||||
label_.set_text(fmt::format(format_, used_ram_percentage));
|
||||
label_.set_markup(fmt::format(format_, used_ram_percentage));
|
||||
auto used_ram_gigabytes = (memtotal_ - memfree_) / std::pow(1024, 2);
|
||||
label_.set_tooltip_text(fmt::format("{:.{}f}Gb used", used_ram_gigabytes, 1));
|
||||
label_.set_name("memory");
|
||||
|
|
|
@ -112,7 +112,7 @@ auto waybar::modules::Network::update() -> void
|
|||
}
|
||||
label_.get_style_context()->remove_class("disconnected");
|
||||
}
|
||||
label_.set_text(fmt::format(format,
|
||||
label_.set_markup(fmt::format(format,
|
||||
fmt::arg("essid", essid_),
|
||||
fmt::arg("signaldBm", signal_strength_dbm_),
|
||||
fmt::arg("signalStrength", signal_strength_),
|
||||
|
|
|
@ -36,7 +36,7 @@ auto waybar::modules::sway::Mode::update() -> void
|
|||
label_.hide();
|
||||
} else {
|
||||
label_.set_name("mode");
|
||||
label_.set_text(fmt::format(format_, mode_));
|
||||
label_.set_markup(fmt::format(format_, mode_));
|
||||
label_.set_tooltip_text(mode_);
|
||||
label_.show();
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void waybar::modules::sway::Window::worker()
|
|||
|
||||
auto waybar::modules::sway::Window::update() -> void
|
||||
{
|
||||
label_.set_text(fmt::format(format_, window_));
|
||||
label_.set_markup(fmt::format(format_, window_));
|
||||
label_.set_tooltip_text(window_);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue