summaryrefslogtreecommitdiff
path: root/dwm/patches/dwm-statuscolors-20181008-b69c870.diff
diff options
context:
space:
mode:
Diffstat (limited to 'dwm/patches/dwm-statuscolors-20181008-b69c870.diff')
-rw-r--r--dwm/patches/dwm-statuscolors-20181008-b69c870.diff94
1 files changed, 0 insertions, 94 deletions
diff --git a/dwm/patches/dwm-statuscolors-20181008-b69c870.diff b/dwm/patches/dwm-statuscolors-20181008-b69c870.diff
deleted file mode 100644
index 8c7869a..0000000
--- a/dwm/patches/dwm-statuscolors-20181008-b69c870.diff
+++ /dev/null
@@ -1,94 +0,0 @@
1From 35418d156fccb922710f6ca80a1f3972ba88b42f Mon Sep 17 00:00:00 2001
2From: Danny O'Brien <danny@spesh.com>
3Date: Mon, 8 Oct 2018 19:21:29 -0700
4Subject: [PATCH] Add colors to status message in bar.
5
6This patch matches the format used by
7https://dwm.suckless.org/patches/statuscolors/ -- An \x01 character
8switches to the normal foreground/color combo, \x02 switches to the
9color combo used for selected tags, \03 is set by default to black on
10yellow, \04 is white on red.
11
12These color settings are defined in the colors array in config.def.h.
13More can be added, but don't have more than 32, or you'll start hitting
14real ASCII.
15
16This applies cleanly on mainline dwm from commit 022d076 (Sat Jan 7
1717:21:29 2017 +0100) until at least b69c870 (Sat Jun 2 17:15:42 2018
18+020).
19
20---
21 config.def.h | 13 ++++++++++---
22 dwm.c | 18 ++++++++++++++++--
23 2 files changed, 26 insertions(+), 5 deletions(-)
24
25diff --git a/config.def.h b/config.def.h
26index 1c0b587..df92695 100644
27--- a/config.def.h
28+++ b/config.def.h
29@@ -12,10 +12,17 @@ static const char col_gray2[] = "#444444";
30 static const char col_gray3[] = "#bbbbbb";
31 static const char col_gray4[] = "#eeeeee";
32 static const char col_cyan[] = "#005577";
33+static const char col_black[] = "#000000";
34+static const char col_red[] = "#ff0000";
35+static const char col_yellow[] = "#ffff00";
36+static const char col_white[] = "#ffffff";
37+
38 static const char *colors[][3] = {
39- /* fg bg border */
40- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
41- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
42+ /* fg bg border */
43+ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
44+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
45+ [SchemeWarn] = { col_black, col_yellow, col_red },
46+ [SchemeUrgent]= { col_white, col_red, col_red },
47 };
48
49 /* tagging */
50diff --git a/dwm.c b/dwm.c
51index 4465af1..9d9d46f 100644
52--- a/dwm.c
53+++ b/dwm.c
54@@ -59,7 +59,7 @@
55
56 /* enums */
57 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
58-enum { SchemeNorm, SchemeSel }; /* color schemes */
59+enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent }; /* color schemes */
60 enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
61 NetWMFullscreen, NetActiveWindow, NetWMWindowType,
62 NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
63@@ -699,13 +699,27 @@ drawbar(Monitor *m)
64 int boxs = drw->fonts->h / 9;
65 int boxw = drw->fonts->h / 6 + 2;
66 unsigned int i, occ = 0, urg = 0;
67+ char *ts = stext;
68+ char *tp = stext;
69+ int tx = 0;
70+ char ctmp;
71 Client *c;
72
73 /* draw status first so it can be overdrawn by tags later */
74 if (m == selmon) { /* status is only drawn on selected monitor */
75 drw_setscheme(drw, scheme[SchemeNorm]);
76 sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
77- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
78+ while (1) {
79+ if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; }
80+ ctmp = *ts;
81+ *ts = '\0';
82+ drw_text(drw, m->ww - sw + tx, 0, sw - tx, bh, 0, tp, 0);
83+ tx += TEXTW(tp) -lrpad;
84+ if (ctmp == '\0') { break; }
85+ drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
86+ *ts = ctmp;
87+ tp = ++ts;
88+ }
89 }
90
91 for (c = m->clients; c; c = c->next) {
92--
932.19.1
94