[wiki] [sites] New version of statuscolor patch || Danny O'Brien

From: <git_AT_suckless.org>
Date: Tue, 09 Oct 2018 05:08:23 +0200

commit 37dd1e0f1dbe7781d5f6b9a073450adb43c42eb8
Author: Danny O'Brien <danny_AT_spesh.com>
Date: Mon Oct 8 20:08:14 2018 -0700

    New version of statuscolor patch

diff --git a/dwm.suckless.org/patches/statuscolors/dwm-add-colors-to-status-message-2018-10-08.diff b/dwm.suckless.org/patches/statuscolors/dwm-add-colors-to-status-message-2018-10-08.diff
new file mode 100644
index 00000000..58c3ad10
--- /dev/null
+++ b/dwm.suckless.org/patches/statuscolors/dwm-add-colors-to-status-message-2018-10-08.diff
_AT_@ -0,0 +1,94 @@
+From 35418d156fccb922710f6ca80a1f3972ba88b42f Mon Sep 17 00:00:00 2001
+From: Danny O'Brien <danny_AT_spesh.com>
+Date: Mon, 8 Oct 2018 19:21:29 -0700
+Subject: [PATCH] Add colors to status message in bar.
+
+This patch matches the format used by
+https://dwm.suckless.org/patches/statuscolors/ -- An \x01 character
+switches to the normal foreground/color combo, \x02 switches to the
+color combo used for selected tags,  is set by default to black on
+yellow,  is white on red.
+
+These color settings are defined in the colors array in config.def.h.
+More can be added, but don't have more than 32, or you'll start hitting
+real ASCII.
+
+This applies cleanly on mainline dwm from commit 022d076 (Sat Jan 7
+17:21:29 2017 +0100) until at least 03b2610 (Sat Jun 2 17:15:42 2018
++020).
+
+---
+ config.def.h | 13 ++++++++++---
+ dwm.c | 18 ++++++++++++++++--
+ 2 files changed, 26 insertions(+), 5 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..df92695 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -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 },
+ };
+
+ /* tagging */
+diff --git a/dwm.c b/dwm.c
+index 4465af1..9d9d46f 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -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 */
+_AT_@ -699,13 +699,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[SchemeNorm]);
+ 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 = '++ drw_text(drw, m->ww - sw + tx, 0, sw - tx, bh, 0, tp, 0);
++ tx += TEXTW(tp) -lrpad;
++ if (ctmp == '++ drw_setscheme(drw, scheme[(unsigned int)(ctmp-1)]);
++ *ts = ctmp;
++ tp = ++ts;
++ }
+ }
+
+ for (c = m->clients; c; c = c->next) {
+--
+2.19.1
+
diff --git a/dwm.suckless.org/patches/statuscolors/index.md b/dwm.suckless.org/patches/statuscolors/index.md
index 72f75930..35ad5fa5 100644
--- a/dwm.suckless.org/patches/statuscolors/index.md
+++ b/dwm.suckless.org/patches/statuscolors/index.md
_AT_@ -60,3 +60,6 @@ An example status script snippet to take advantage of the colors:
 * [dwm-5.8.2-statuscolors.diff](dwm-5.8.2-statuscolors.diff)
 * [dwm-statuscolors-5.9.diff](dwm-statuscolors-5.9.diff)
 * [dwm-statuscolors-6.1.diff](dwm-statuscolors-6.1.diff)
+* [dwm-add-colors-to-status-message-2018-10-08.diff](dwm-add-colors-to-status-message-2018-10-08.diff)
+ : This patch applies cleanly on mainline dwm from Jan 7 2017 to at least Oct
+ 8 2018. It includes additional config.def.h color entries.
Received on Tue Oct 09 2018 - 05:08:23 CEST

This archive was generated by hypermail 2.3.0 : Tue Oct 09 2018 - 05:12:25 CEST