dwm-rainbowtags-6.1.diff - sites - public wiki contents of suckless.org
HTML git clone git://git.suckless.org/sites
DIR Log
DIR Files
DIR Refs
---
dwm-rainbowtags-6.1.diff (2487B)
---
1 From 5b45f88e87c772f7bc18c86f4de7ab3bac8c39c9 Mon Sep 17 00:00:00 2001
2 From: Jared <7060603@hotmail.ca>
3 Date: Fri, 26 Feb 2021 02:59:07 -0500
4 Subject: [PATCH] rainbowtags: Unique ClrScheme for each tag when selected
5
6 Allow selected tags to be unique colours. tagselfg contains the foreground
7 colors, and tagselbg contains the background colors.
8 ---
9 config.def.h | 3 +++
10 dwm.c | 11 ++++++++++-
11 2 files changed, 13 insertions(+), 1 deletion(-)
12
13 diff --git a/config.def.h b/config.def.h
14 index 7054c06..0abf2f5 100644
15 --- a/config.def.h
16 +++ b/config.def.h
17 @@ -19,6 +19,9 @@ static const int topbar = 1; /* 0 means bottom bar */
18 /* tagging */
19 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
20
21 +static const char *tagselfg[] = { "#ffffff", "#ffffff", "#000000", "#000000", "#ffffff", "#ffffff", "#ffffff", "#000000", "#ffffff" };
22 +static const char *tagselbg[] = { "#ff0000", "#ff7f00", "#ffff00", "#00ff00", "#0000ff", "#4b0082", "#9400d3", "#ffffff", "#000000" };
23 +
24 static const Rule rules[] = {
25 /* xprop(1):
26 * WM_CLASS(STRING) = instance, class
27 diff --git a/dwm.c b/dwm.c
28 index 0362114..53d7ead 100644
29 --- a/dwm.c
30 +++ b/dwm.c
31 @@ -273,6 +273,8 @@ static Window root;
32 /* compile-time check if all tags fit into an unsigned int bit array. */
33 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
34
35 +static ClrScheme tagscheme[LENGTH(tags)];
36 +
37 /* function implementations */
38 void
39 applyrules(Client *c)
40 @@ -718,7 +720,7 @@ drawbar(Monitor *m)
41 x = 0;
42 for (i = 0; i < LENGTH(tags); i++) {
43 w = TEXTW(tags[i]);
44 - drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
45 + drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &tagscheme[i] : &scheme[SchemeNorm]);
46 drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
47 drw_rect(drw, x + 1, 1, dx, dx, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
48 occ & 1 << i, urg & 1 << i);
49 @@ -1586,6 +1588,13 @@ setup(void)
50 scheme[SchemeSel].border = drw_clr_create(drw, selbordercolor);
51 scheme[SchemeSel].bg = drw_clr_create(drw, selbgcolor);
52 scheme[SchemeSel].fg = drw_clr_create(drw, selfgcolor);
53 +
54 + for (unsigned int i = 0; i < LENGTH(tags); i++) {
55 + tagscheme[i].bg = drw_clr_create(drw, tagselbg[i]);
56 + tagscheme[i].fg = drw_clr_create(drw, tagselfg[i]);
57 + tagscheme[i].border = drw_clr_create(drw, selbordercolor);
58 + }
59 +
60 /* init bars */
61 updatebars();
62 updatestatus();
63 --
64 2.30.1
65