patch to show square tag indicator like dwm

This commit is contained in:
Henrique Possatto 2022-12-26 18:12:36 -03:00 committed by Raphael Robatsch
parent 7d8c2f8b8c
commit ea9dbfe022

View file

@ -0,0 +1,34 @@
From: Henrique Possatto <henriquempossatto@gmail.com>
Date: Mon, 26 Dec 2022 18:01:35 -0300
Subject: [PATCH somebar] patch to show square tag indicator like dwm
diff --git a/src/bar.cpp b/src/bar.cpp
index 507ce62..4fda8b0 100644
--- a/src/bar.cpp
+++ b/src/bar.cpp
@@ -245,12 +245,17 @@ void Bar::renderTags()
tag.state & TagState::Active ? colorActive : colorInactive,
tag.state & TagState::Urgent);
renderComponent(tag.component);
- auto indicators = std::min(tag.numClients, static_cast<int>(_bufs->height/2));
- 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);
- cairo_rel_line_to(_painter, w, 0);
- cairo_close_path(_painter);
+
+ if(!tag.numClients)
+ continue;
+
+ int s = barfont.height / 9;
+ int w = barfont.height / 6 + 2;
+ if (tag.focusedClient != -1) {
+ cairo_rectangle(_painter, tag.component.x + s, s, w, w);
+ cairo_fill(_painter);
+ } else {
+ cairo_rectangle(_painter, (double)(tag.component.x + s) + 0.5, (double)(s) + 0.5, w, w);
cairo_set_line_width(_painter, 1);
cairo_stroke(_painter);
}
--
2.39.0