dwm-clientmonoclesymbol-20220417-d93ff48.diff (1306B)
1 From 630859138bb960e2aea41d47e68c48ec020daf5c Mon Sep 17 00:00:00 2001 2 From: ben evolver <> 3 Date: Sun, 17 Apr 2022 08:07:24 -0500 4 Subject: [PATCH] add alternative symbols for nr. of active clients in monocle layout 5 6 --- 7 config.def.h | 4 ++++ 8 dwm.c | 2 +- 9 2 files changed, 5 insertions(+), 1 deletion(-) 10 11 diff --git a/config.def.h b/config.def.h 12 index a2ac963..f49dfdf 100644 13 --- a/config.def.h 14 +++ b/config.def.h 15 @@ -44,6 +44,10 @@ static const Layout layouts[] = { 16 { "[M]", monocle }, 17 }; 18 19 +/* custom symbols for nr. of clients in monocle layout */ 20 +/* when clients >= LENGTH(monocles), uses the last element */ 21 +static const char *monocles[] = { "[1]", "[2]", "[3]", "[4]", "[5]", "[6]", "[7]", "[8]", "[9]", "[9+]" }; 22 + 23 /* key definitions */ 24 #define MODKEY Mod1Mask 25 #define TAGKEYS(KEY,TAG) \ 26 diff --git a/dwm.c b/dwm.c 27 index 0fc328a..e47ba70 100644 28 --- a/dwm.c 29 +++ b/dwm.c 30 @@ -1116,7 +1116,7 @@ monocle(Monitor *m) 31 if (ISVISIBLE(c)) 32 n++; 33 if (n > 0) /* override layout symbol */ 34 - snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n); 35 + snprintf(m->ltsymbol, sizeof m->ltsymbol, "%s", monocles[MIN(n, LENGTH(monocles)) - 1]); 36 for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) 37 resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); 38 } 39 -- 40 2.35.1 41