~raphi/public-inbox

somebar: patch to show square tag indicator like dwm v1 APPLIED

Henrique Possatto: 1
 patch to show square tag indicator like dwm

 1 files changed, 34 insertions(+), 0 deletions(-)
#911869 archlinux.yml success
#911870 freebsd.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~raphi/public-inbox/patches/37771/mbox | git am -3
Learn more about email & git

[PATCH somebar] patch to show square tag indicator like dwm Export this patch

---
 contrib/dwm-like-tag-indicator.patch | 34 ++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 contrib/dwm-like-tag-indicator.patch

diff --git a/contrib/dwm-like-tag-indicator.patch b/contrib/dwm-like-tag-indicator.patch
new file mode 100644
index 0000000..c4458e9
--- /dev/null
+++ b/contrib/dwm-like-tag-indicator.patch
@@ -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

-- 
2.39.0
somebar/patches: SUCCESS in 1m0s

[patch to show square tag indicator like dwm][0] from [Henrique Possatto][1]

[0]: https://lists.sr.ht/~raphi/public-inbox/patches/37771
[1]: mailto:henriquempossatto@gmail.com

✓ #911869 SUCCESS somebar/patches/archlinux.yml https://builds.sr.ht/~raphi/job/911869
✓ #911870 SUCCESS somebar/patches/freebsd.yml   https://builds.sr.ht/~raphi/job/911870
Thanks
To git.sr.ht:~raphi/somebar
   7d8c2f8..ea9dbfe  master -> master