somebar/contrib/hide-vacant-tags.patch

35 lines
1.1 KiB
Diff

From: medanisjbara anis2834133766619@gmail.com
Date: Mon, 14 Nov 2022 22:52:00
Description: somebar equivalent of https://dwm.suckless.org/patches/hide_vacant_tags
diff --git a/src/bar.cpp b/src/bar.cpp
index fab5a8f..38e7b5f 100644
--- a/src/bar.cpp
+++ b/src/bar.cpp
@@ -240,12 +240,22 @@ void Bar::render()
void Bar::renderTags()
{
+ bool focused;
for (auto &tag : _tags) {
- setColorScheme(
- tag.state & TagState::Active ? colorActive : colorInactive,
- tag.state & TagState::Urgent);
- renderComponent(tag.component);
+ 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;
+ }
+ }
+
+ if (tag.state & TagState::Active || focused){
+ setColorScheme(
+ tag.state & TagState::Active ? colorActive : colorInactive,
+ tag.state & TagState::Urgent);
+ renderComponent(tag.component);
+ }
for (auto ind = 0; ind < indicators; ind++) {
auto w = ind == tag.focusedClient ? 7 : 1;
cairo_move_to(_painter, tag.component.x, ind*2+0.5);