From 542f70efa3efd23e0305b0f728ae0389fdea4962 Mon Sep 17 00:00:00 2001 From: Jean-Luc Bastarache Date: Thu, 4 Nov 2021 11:55:16 -0400 Subject: [PATCH] fix(ipc): don't format empty strings (#2549) * fix(ipc): don't format empty strings * Add a description of the change to `CHANGELOG.md` * Rephrasing --- CHANGELOG.md | 3 +++ src/modules/ipc.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 21b1f65e..36893cf0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -168,6 +168,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `include-directory` and `include-file` now support relative paths. The paths are relative to the folder of the file where those directives appear. ([`#2523`](https://github.com/polybar/polybar/issues/2523)) +- `custom/ipc`: Empty output strings are no longer formatted. This prevents + extraneous spaces and separators from appearing in the bar when the output of + an ipc module is empty. ### Fixed - `custom/script`: Concurrency issues with fast-updating tailed scripts. diff --git a/src/modules/ipc.cpp b/src/modules/ipc.cpp index 20ff4d59..246d876a 100644 --- a/src/modules/ipc.cpp +++ b/src/modules/ipc.cpp @@ -90,6 +90,9 @@ namespace modules { // the format prefix/suffix also gets wrapper // with the cmd handlers string output{module::get_output()}; + if (output.empty()) { + return ""; + } for (auto&& action : m_actions) { if (!action.second.empty()) {