commit: ef7edf1ff83aa2d87e465ba7c04d71872e6a2422
parent: cf17fcc96fc0c5a1fba5e7fdd66ab861431703d4
author: Chris Noxz <chris@noxz.tech>
date: Wed, 5 Feb 2020 11:17:49 +0100
Implement statuscolors
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -25,7 +25,11 @@ static const int color_ptrs[][4] = {
[SchemeTagsSel] = { 6, 5, 5, -1 },
[SchemeTitleNorm] = { 6, -1, -1, -1 },
[SchemeTitleSel] = { 6, -1, -1, -1 },
- [SchemeStatus] = { 2, 0, 0, -1 },
+
+ [SchemeStatusNorm] = { 2, 0, -1, -1 },
+ [SchemeStatusAct] = { 6, 0, -1, -1 },
+ [SchemeStatusDist] = { 11, 0, -1, -1 },
+ [SchemeStatusNoti] = { 0, 6, -1, -1 },
};
static char colors[][4][8] = {
/* fg bg border float */
@@ -35,7 +39,11 @@ static char colors[][4][8] = {
[SchemeTagsSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
[SchemeTitleNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
[SchemeTitleSel] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
- [SchemeStatus] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+
+ [SchemeStatusNorm] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeStatusAct] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeStatusDist] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
+ [SchemeStatusNoti] = { COL_DEF, COL_DEF, COL_DEF, COL_DEF },
};
/* tagging */
diff --git a/dwm.c b/dwm.c
@@ -63,7 +63,8 @@
enum { DispUi, DispCmdLine }; /* dispatch types */
enum { LayoutGrid, LayoutTiled, LayoutMonocle, LayoutFloating }; /* layouts, first is default */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
-enum { SchemeNorm, SchemeSel, SchemeTagsNorm, SchemeTagsSel, SchemeTitleNorm, SchemeTitleSel, SchemeStatus }; /* color schemes */
+enum { SchemeNorm, SchemeSel, SchemeTagsNorm, SchemeTagsSel, SchemeTitleNorm, SchemeTitleSel,
+ SchemeStatusNorm, SchemeStatusAct, SchemeStatusDist, SchemeStatusNoti }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@@ -849,13 +850,27 @@ drawbar(Monitor *m)
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
+ char *ts = stext;
+ char *tp = stext;
+ int tx = 0;
+ char ctmp;
Client *c;
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
- drw_setscheme(drw, scheme[SchemeStatus]);
+ drw_setscheme(drw, scheme[SchemeStatusNorm]);
sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
+ while (1) {
+ if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; }
+ ctmp = *ts;
+ *ts = '\0';
+ drw_text(drw, m->ww - sw + tx, 0, sw - tx, bh, 0, tp, 0);
+ tx += TEXTW(tp) -lrpad;
+ if (ctmp == '\0') { break; }
+ drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
+ *ts = ctmp;
+ tp = ++ts;
+ }
}
for (c = m->clients; c; c = c->next) {