Skip to content

Instantly share code, notes, and snippets.

@ahauser31
Last active May 4, 2021 05:02
Show Gist options
  • Save ahauser31/074c1774fe80b2aee358d46219d9acd4 to your computer and use it in GitHub Desktop.
Save ahauser31/074c1774fe80b2aee358d46219d9acd4 to your computer and use it in GitHub Desktop.
diff --git a/dwm.c b/dwm.c
index 664c527..7870df2 100644
--- a/dwm.c
+++ b/dwm.c
@@ -699,8 +699,9 @@ drawbar(Monitor *m)
int x, w, tw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
- unsigned int i, occ = 0, urg = 0;
+ unsigned int i, occ = 0, urg = 0, n = 0;
Client *c;
+ char ntext[8];
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
@@ -713,6 +714,8 @@ drawbar(Monitor *m)
occ |= c->tags;
if (c->isurgent)
urg |= c->tags;
+ if (ISVISIBLE(c))
+ n++;
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
@@ -728,6 +731,11 @@ drawbar(Monitor *m)
w = blw = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
+ /* Drawing client number indicator (same color as layout symbol) */
+ snprintf(ntext, sizeof ntext, "%u", n);
+ w = TEXTW(ntext);
+ x = drw_text(drw, x, 0, w, bh, lrpad / 2, ntext, 0);
+
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment