mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-14 15:12:31 +02:00
fix: compilation errors with cpp_std=c++20
There were two main issues with fmtlib and C++20 mode: - `fmt::format` defaults to compile-time argument checking and requires using `fmt::runtime(format_string)` to bypass that. - `std::format` implementation introduces conflicting declarations and we have to specify the namespace for all `format`/`format_to` calls.
This commit is contained in:
@ -63,21 +63,15 @@ auto waybar::modules::IdleInhibitor::update() -> void {
|
||||
}
|
||||
|
||||
std::string status_text = status ? "activated" : "deactivated";
|
||||
label_.set_markup(fmt::format(format_, fmt::arg("status", status_text),
|
||||
label_.set_markup(fmt::format(fmt::runtime(format_), fmt::arg("status", status_text),
|
||||
fmt::arg("icon", getIcon(0, status_text))));
|
||||
label_.get_style_context()->add_class(status_text);
|
||||
if (tooltipEnabled()) {
|
||||
label_.set_tooltip_markup(
|
||||
status ? fmt::format(config_["tooltip-format-activated"].isString()
|
||||
? config_["tooltip-format-activated"].asString()
|
||||
: "{status}",
|
||||
fmt::arg("status", status_text),
|
||||
fmt::arg("icon", getIcon(0, status_text)))
|
||||
: fmt::format(config_["tooltip-format-deactivated"].isString()
|
||||
? config_["tooltip-format-deactivated"].asString()
|
||||
: "{status}",
|
||||
fmt::arg("status", status_text),
|
||||
fmt::arg("icon", getIcon(0, status_text))));
|
||||
auto config = config_[status ? "tooltip-format-activated" : "tooltip-format-deactivated"];
|
||||
auto tooltip_format = config.isString() ? config.asString() : "{status}";
|
||||
label_.set_tooltip_markup(fmt::format(fmt::runtime(tooltip_format),
|
||||
fmt::arg("status", status_text),
|
||||
fmt::arg("icon", getIcon(0, status_text))));
|
||||
}
|
||||
// Call parent update
|
||||
ALabel::update();
|
||||
|
Reference in New Issue
Block a user