commit 803142f7e744f6688465afe25a38bb692b2be1a2
parent c0cb48ffb0a856a557df14cb7084752c63e67700
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Tue, 11 Aug 2020 21:08:35 -0500
Added alttagsdecoration
Diffstat:
3 files changed, 83 insertions(+), 1 deletion(-)
diff --git a/README b/README
@@ -42,7 +42,7 @@ patches!
(1). https://dwm.suckless.org/patches/
- CURRENT PROGRESS: 6/172 patches supported
+ CURRENT PROGRESS: 7/172 patches supported
1/172 patches unsupported
USUPPORTED PATCHES:
diff --git a/alttagsdecoration/USAGE b/alttagsdecoration/USAGE
@@ -0,0 +1,27 @@
+alttagsdecoration - Replace default occupied tag indicator with custom strings
+Source: https://dwm.suckless.org/patches/alttagsdecoration/dwm-alttagsdecoration-2020010304-cb3f58a.diff
+Original Author: Luigi Foscari <luigi.foscari[at]gmail.com>
+
+Description from source:
+ """
+ This patches provides the ability to use an alternative text for tags which contain at least one
+ window. This patch replaces the standard behavious of drawing a little box on the top left edge of
+ the tag box.
+ """
+
+== YOU MUST ==
+(1). Place the patch file in /etc/portage/patches/x11-wm/dwm/ and run 'emerge dwm'
+(2). Add the following line to your savedconfig file:
+
+ static const char *alttags[] = { "<01>", "<02>", "<03>", "<04>", "<05>" };
+
+ Note that the actual contents of the tag indicator strings can be whatever you want.
+
+== YOU PROBABLY SHOULD ==
+No further action is required.
+
+== PATCH MODIFICATIONS ==
+(1). Removed lines relating to config.def.h
+
+== INCOMPATIBILITIES ==
+(1). This patch is known to be incompatible with the 'alternativetags' patch.
diff --git a/alttagsdecoration/alttagsdecoration.patch b/alttagsdecoration/alttagsdecoration.patch
@@ -0,0 +1,55 @@
+diff --git a/dwm.c b/dwm.c
+index 4465af1..a394159 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -416,7 +416,7 @@ attachstack(Client *c)
+ void
+ buttonpress(XEvent *e)
+ {
+- unsigned int i, x, click;
++ unsigned int i, x, click, occ;
+ Arg arg = {0};
+ Client *c;
+ Monitor *m;
+@@ -430,9 +430,13 @@ buttonpress(XEvent *e)
+ focus(NULL);
+ }
+ if (ev->window == selmon->barwin) {
+- i = x = 0;
++ i = x = occ = 0;
++ /* Bitmask of occupied tags */
++ for (c = m->clients; c; c = c->next)
++ occ |= c->tags;
++
+ do
+- x += TEXTW(tags[i]);
++ x += TEXTW(occ & 1 << i ? alttags[i] : tags[i]);
+ while (ev->x >= x && ++i < LENGTH(tags));
+ if (i < LENGTH(tags)) {
+ click = ClkTagBar;
+@@ -699,6 +703,7 @@ drawbar(Monitor *m)
+ int boxs = drw->fonts->h / 9;
+ int boxw = drw->fonts->h / 6 + 2;
+ unsigned int i, occ = 0, urg = 0;
++ const char *tagtext;
+ Client *c;
+
+ /* draw status first so it can be overdrawn by tags later */
+@@ -715,13 +720,10 @@ drawbar(Monitor *m)
+ }
+ x = 0;
+ for (i = 0; i < LENGTH(tags); i++) {
+- w = TEXTW(tags[i]);
+- drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
+- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
+- if (occ & 1 << i)
+- drw_rect(drw, x + boxs, boxs, boxw, boxw,
+- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
+- urg & 1 << i);
++ tagtext = occ & 1 << i ? alttags[i] : tags[i];
++ w = TEXTW(tagtext);
++ drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
++ drw_text(drw, x, 0, w, bh, lrpad / 2, tagtext, urg & 1 << i);
+ x += w;
+ }
+ w = blw = TEXTW(m->ltsymbol);