summaryrefslogtreecommitdiff
path: root/somebar/contrib/dwm-like-tag-indicator.patch
blob: c4458e97e8244bdf75c0ab2229c6e96a8680c501 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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