xkeyboard: Fix indicator spacing (#2306)

* Fix xkeyboard module spacing between the layout and indicators when indicators are empty.

* Simplify the empty label check.

* Remove permanently enabled SCROLL_LOCK, sorry.

* Another mistake.

* Update src/modules/xkeyboard.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update src/modules/xkeyboard.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update.

* Fix xkeyboard module spacing between the layout and indicators, when indicators are empty. And fix the spacing between indicators when some are empty.

* Add issue #2292 to fixed.

* Update CHANGELOG.md

Co-authored-by: Filip Banák <6111455-Filip62@users.noreply.gitlab.com>
Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
This commit is contained in:
Filip Banák 2020-12-17 20:49:10 +01:00 committed by GitHub
parent fd556525a8
commit 6f13fe93a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -47,6 +47,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
KB/s (as before), 1 for MB/s and 2 for GB/s.
### Fixed
- Trailing space after the layout label when indicators are empty and made sure right amount
of spacing is added between the indicator labels, in the xkeyboard module.
([`#2292`](https://github.com/polybar/polybar/issues/2292))
- Parser error if click command contained `}`
([`#2040`](https://github.com/polybar/polybar/issues/2040))

View File

@ -191,10 +191,12 @@ namespace modules {
} else if (tag == TAG_LABEL_INDICATOR && !m_indicators.empty()) {
size_t n{0};
for (auto&& indicator : m_indicators) {
if (n++) {
builder->space(m_formatter->get(DEFAULT_FORMAT)->spacing);
if (*indicator.second) {
if (n++) {
builder->space(m_formatter->get(DEFAULT_FORMAT)->spacing);
}
builder->node(indicator.second);
}
builder->node(indicator.second);
}
return n > 0;
} else {