From 133fb2668556041439a03c61f29cd23d56ed928d Mon Sep 17 00:00:00 2001 From: Bakkeby Date: Mon, 10 Jan 2022 13:50:15 +0100 Subject: [PATCH 2/2] tagicons with separate icon for selected tags Example patch ref. https://www.reddit.com/r/suckless/comments/ln0t41/use_icon_instead_of_rectangle_as/ --- config.def.h | 5 +++-- dwm.c | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index 7e63669..84d80c4 100644 --- a/config.def.h +++ b/config.def.h @@ -21,9 +21,10 @@ static const char *colors[][3] = { /* tagging: refer to https://github.com/bakkeby/patches/wiki/tagicons */ static const char *tags[NUMTAGS] = { NULL }; /* left for compatibility reasons, i.e. code that checks LENGTH(tags) */ static char *tagicons[][NUMTAGS] = { - [IconsDefault] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }, + [IconsDefault] = { "○" }, [IconsVacant] = { NULL }, - [IconsOccupied] = { NULL }, + [IconsOccupied] = { "☉" }, + [IconsSelected] = { "◉" }, }; static const Rule rules[] = { diff --git a/dwm.c b/dwm.c index 63b800f..f6fb72a 100644 --- a/dwm.c +++ b/dwm.c @@ -71,6 +71,7 @@ enum { IconsDefault, IconsVacant, IconsOccupied, + IconsSelected, IconsLast }; /* icon sets */ @@ -1733,7 +1734,9 @@ tagicon(Monitor *m, int tag) char *icon; for (c = m->clients; c && (!(c->tags & 1 << tag)); c = c->next); // for (c = m->clients; c && (!(c->tags & 1 << tag) || HIDDEN(c)); c = c->next); // awesomebar / wintitleactions compatibility - if (c && tagicons[IconsOccupied][0] != NULL) + if (m->tagset[m->seltags] & 1 << tag && tagicons[IconsSelected][0] != NULL) + icon = geticon(m, tag, IconsSelected); + else if (c && tagicons[IconsOccupied][0] != NULL) icon = geticon(m, tag, IconsOccupied); else { icon = geticon(m, tag, m->iconset); -- 2.19.1