aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2023-12-16 17:53:36 +0100
committerEddy Pedroni <epedroni@pm.me>2023-12-16 17:53:36 +0100
commit24ddb4b3399cf9abd5118081bbfcab8ae9046a72 (patch)
treea7458c6429e0db1653a8607de7bffe09360824f4
parente05bcf6982cc0b098a4b8276da5a80dd36f98e17 (diff)
Apply statuscolors-20220322-bece862 cleanly
-rw-r--r--config.def.h13
-rw-r--r--dwm.c18
2 files changed, 26 insertions, 5 deletions
diff --git a/config.def.h b/config.def.h
index e458a03..c80a9d1 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,10 +12,17 @@ static const char col_gray2[] = "#444444";
static const char col_gray3[] = "#bbbbbb";
static const char col_gray4[] = "#eeeeee";
static const char col_cyan[] = "#005577";
+static const char col_black[] = "#000000";
+static const char col_red[] = "#ff0000";
+static const char col_yellow[] = "#ffff00";
+static const char col_white[] = "#ffffff";
+
static const char *colors[][3] = {
- /* fg bg border */
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
+ /* fg bg border */
+ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
+ [SchemeSel] = { col_gray4, col_cyan, col_cyan },
+ [SchemeWarn] = { col_black, col_yellow, col_red },
+ [SchemeUrgent]= { col_white, col_red, col_red },
};
/* Display modes of the tab bar: never shown, always shown, shown only in */
diff --git a/dwm.c b/dwm.c
index 1ee6f6f..5fa6f3b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -59,7 +59,7 @@
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
-enum { SchemeNorm, SchemeSel }; /* color schemes */
+enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@@ -785,6 +785,10 @@ 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;
if (!m->showbar)
@@ -794,7 +798,17 @@ drawbar(Monitor *m)
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
+ while (1) {
+ if ((unsigned int)*ts > LENGTH(colors)) { ts++; continue ; }
+ ctmp = *ts;
+ *ts = '\0';
+ drw_text(drw, m->ww - tw + tx, 0, tw - 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) {