mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01: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:
@ -59,9 +59,9 @@ void Language::onEvent(const std::string& ev) {
|
||||
|
||||
if (config_.isMember("format-" + briefName)) {
|
||||
const auto propName = "format-" + briefName;
|
||||
layoutName = fmt::format(format_, config_[propName].asString());
|
||||
layoutName = fmt::format(fmt::runtime(format_), config_[propName].asString());
|
||||
} else {
|
||||
layoutName = fmt::format(format_, layoutName);
|
||||
layoutName = fmt::format(fmt::runtime(format_), layoutName);
|
||||
}
|
||||
|
||||
layoutName = waybar::util::sanitize_string(layoutName);
|
||||
@ -92,9 +92,9 @@ void Language::initLanguage() {
|
||||
|
||||
if (config_.isMember("format-" + briefName)) {
|
||||
const auto propName = "format-" + briefName;
|
||||
layoutName = fmt::format(format_, config_[propName].asString());
|
||||
layoutName = fmt::format(fmt::runtime(format_), config_[propName].asString());
|
||||
} else {
|
||||
layoutName = fmt::format(format_, searcher);
|
||||
layoutName = fmt::format(fmt::runtime(format_), searcher);
|
||||
}
|
||||
|
||||
layoutName = waybar::util::sanitize_string(layoutName);
|
||||
|
@ -34,7 +34,7 @@ auto Submap::update() -> void {
|
||||
if (submap_.empty()) {
|
||||
event_box_.hide();
|
||||
} else {
|
||||
label_.set_markup(fmt::format(format_, submap_));
|
||||
label_.set_markup(fmt::format(fmt::runtime(format_), submap_));
|
||||
if (tooltipEnabled()) {
|
||||
label_.set_tooltip_text(submap_);
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ auto Window::update() -> void {
|
||||
|
||||
if (!format_.empty()) {
|
||||
label_.show();
|
||||
label_.set_markup(
|
||||
fmt::format(format_, waybar::util::rewriteTitle(lastView, config_["rewrite"])));
|
||||
label_.set_markup(fmt::format(fmt::runtime(format_),
|
||||
waybar::util::rewriteTitle(lastView, config_["rewrite"])));
|
||||
} else {
|
||||
label_.hide();
|
||||
}
|
||||
|
Reference in New Issue
Block a user