hide-vacant-tags: fix tag 0 is hiding all
This commit is contained in:
parent
ea9dbfe022
commit
624e92927b
1 changed files with 37 additions and 17 deletions
|
@ -5,30 +5,50 @@ diff --git a/src/bar.cpp b/src/bar.cpp
|
||||||
index fab5a8f..38e7b5f 100644
|
index fab5a8f..38e7b5f 100644
|
||||||
--- a/src/bar.cpp
|
--- a/src/bar.cpp
|
||||||
+++ b/src/bar.cpp
|
+++ b/src/bar.cpp
|
||||||
@@ -240,12 +240,22 @@ void Bar::render()
|
@@ -240,13 +240,36 @@ void Bar::render()
|
||||||
|
|
||||||
void Bar::renderTags()
|
void Bar::renderTags()
|
||||||
{
|
{
|
||||||
+ bool focused;
|
+ // Check if all tags are active (Mod+0)
|
||||||
|
+ bool allActive = true;
|
||||||
for (auto &tag : _tags) {
|
for (auto &tag : _tags) {
|
||||||
- setColorScheme(
|
+ if (tag.state & TagState::Active){
|
||||||
- tag.state & TagState::Active ? colorActive : colorInactive,
|
+ if (!allActive){
|
||||||
- tag.state & TagState::Urgent);
|
+ allActive = true;
|
||||||
- renderComponent(tag.component);
|
+ break;
|
||||||
+ focused = false;
|
|
||||||
auto indicators = std::min(tag.numClients, static_cast<int>(_bufs->height/2));
|
|
||||||
+ for (auto ind = 0; ind < indicators; ind++) {
|
|
||||||
+ if (tag.focusedClient){
|
|
||||||
+ focused = true;
|
|
||||||
+ }
|
+ }
|
||||||
|
+ allActive = false;
|
||||||
+ }
|
+ }
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ if (tag.state & TagState::Active || focused){
|
+ bool renderThis;
|
||||||
+ setColorScheme(
|
+ for (auto &tag : _tags) {
|
||||||
+ tag.state & TagState::Active ? colorActive : colorInactive,
|
+ renderThis = false;
|
||||||
+ tag.state & TagState::Urgent);
|
setColorScheme(
|
||||||
+ renderComponent(tag.component);
|
tag.state & TagState::Active ? colorActive : colorInactive,
|
||||||
+ }
|
tag.state & TagState::Urgent);
|
||||||
|
- renderComponent(tag.component);
|
||||||
|
+ // Reder active tag if it's the only one active
|
||||||
|
+ if (!allActive && tag.state & TagState::Active)
|
||||||
|
+ renderThis = true;
|
||||||
|
auto indicators = std::min(tag.numClients, static_cast<int>(_bufs->height/2));
|
||||||
for (auto ind = 0; ind < indicators; ind++) {
|
for (auto ind = 0; ind < indicators; ind++) {
|
||||||
|
+ // render tags having indicators
|
||||||
|
+ if (tag.focusedClient == -1)
|
||||||
|
+ renderThis = true;
|
||||||
|
+ // render tags having the focused client
|
||||||
|
+ if (tag.focusedClient == 0){
|
||||||
|
+ renderThis = true;
|
||||||
|
+ }
|
||||||
auto w = ind == tag.focusedClient ? 7 : 1;
|
auto w = ind == tag.focusedClient ? 7 : 1;
|
||||||
cairo_move_to(_painter, tag.component.x, ind*2+0.5);
|
cairo_move_to(_painter, tag.component.x, ind*2+0.5);
|
||||||
|
cairo_rel_line_to(_painter, w, 0);
|
||||||
|
@@ -254,6 +277,8 @@ void Bar::renderTags()
|
||||||
|
cairo_set_line_width(_painter, 1);
|
||||||
|
cairo_stroke(_painter);
|
||||||
|
}
|
||||||
|
+ if (renderThis)
|
||||||
|
+ renderComponent(tag.component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue