From d40cc6f23a7dba1736dadd0fe180c2bed0831785 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 30 Dec 2019 13:55:49 +0100 Subject: [PATCH] fix(Battery): replace spaces w/ underscores --- src/modules/battery.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index 61ed50a4..d5cd8fd5 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -163,7 +163,12 @@ auto waybar::modules::Battery::update() -> void { } label_.set_tooltip_text(tooltip_text); } + // Transform to lowercase std::transform(status.begin(), status.end(), status.begin(), ::tolower); + // Replace space with underscore + std::transform(status.begin(), status.end(), status.begin(), [](char ch) { + return ch == ' ' ? '_' : ch; + }); auto format = format_; auto state = getState(capacity, true); if (!old_status_.empty()) {