Files
dots/dwm/.dwm/patches/dwm-status2d-xrdb-6.2.diff
2023-02-24 18:23:42 +01:00

101 lines
3.5 KiB
Diff

From bd7dd6d06e8b8c9dd6b595b2ce5f6e88b9565311 Mon Sep 17 00:00:00 2001
From: tdu <tdukv@protonmail.com>
Date: Wed, 26 Aug 2020 21:26:21 +0300
Subject: [PATCH] Use the 16 terminal colors from xrdb for status2d.
^C<num>^ - fg.
^B<num>^ - bg.
---
config.def.h | 34 ++++++++++++++++++++++++++++++++++
dwm.c | 22 ++++++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/config.def.h b/config.def.h
index 5db7d05..46bc6fe 100644
--- a/config.def.h
+++ b/config.def.h
@@ -13,6 +13,40 @@ static char normfgcolor[] = "#bbbbbb";
static char selfgcolor[] = "#eeeeee";
static char selbordercolor[] = "#005577";
static char selbgcolor[] = "#005577";
+static char termcol0[] = "#000000"; /* black */
+static char termcol1[] = "#ff0000"; /* red */
+static char termcol2[] = "#33ff00"; /* green */
+static char termcol3[] = "#ff0099"; /* yellow */
+static char termcol4[] = "#0066ff"; /* blue */
+static char termcol5[] = "#cc00ff"; /* magenta */
+static char termcol6[] = "#00ffff"; /* cyan */
+static char termcol7[] = "#d0d0d0"; /* white */
+static char termcol8[] = "#808080"; /* black */
+static char termcol9[] = "#ff0000"; /* red */
+static char termcol10[] = "#33ff00"; /* green */
+static char termcol11[] = "#ff0099"; /* yellow */
+static char termcol12[] = "#0066ff"; /* blue */
+static char termcol13[] = "#cc00ff"; /* magenta */
+static char termcol14[] = "#00ffff"; /* cyan */
+static char termcol15[] = "#ffffff"; /* white */
+static char *termcolor[] = {
+ termcol0,
+ termcol1,
+ termcol2,
+ termcol3,
+ termcol4,
+ termcol5,
+ termcol6,
+ termcol7,
+ termcol8,
+ termcol9,
+ termcol10,
+ termcol11,
+ termcol12,
+ termcol13,
+ termcol14,
+ termcol15,
+};
static char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
diff --git a/dwm.c b/dwm.c
index 87547f0..601dc1d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -784,6 +784,12 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
buf[7] = '\0';
drw_clr_create(drw, &drw->scheme[ColBg], buf);
i += 7;
+ } else if (text[i] == 'C') {
+ int c = atoi(text + ++i);
+ drw_clr_create(drw, &drw->scheme[ColFg], termcolor[c]);
+ } else if (text[i] == 'B') {
+ int c = atoi(text + ++i);
+ drw_clr_create(drw, &drw->scheme[ColBg], termcolor[c]);
} else if (text[i] == 'd') {
drw->scheme[ColFg] = scheme[SchemeNorm][ColFg];
drw->scheme[ColBg] = scheme[SchemeNorm][ColBg];
@@ -1163,6 +1169,22 @@ loadxrdb()
XRDB_LOAD_COLOR("dwm.selbordercolor", selbordercolor);
XRDB_LOAD_COLOR("dwm.selbgcolor", selbgcolor);
XRDB_LOAD_COLOR("dwm.selfgcolor", selfgcolor);
+ XRDB_LOAD_COLOR("color0", termcol0);
+ XRDB_LOAD_COLOR("color1", termcol1);
+ XRDB_LOAD_COLOR("color2", termcol2);
+ XRDB_LOAD_COLOR("color3", termcol3);
+ XRDB_LOAD_COLOR("color4", termcol4);
+ XRDB_LOAD_COLOR("color5", termcol5);
+ XRDB_LOAD_COLOR("color6", termcol6);
+ XRDB_LOAD_COLOR("color7", termcol7);
+ XRDB_LOAD_COLOR("color8", termcol8);
+ XRDB_LOAD_COLOR("color9", termcol9);
+ XRDB_LOAD_COLOR("color10", termcol10);
+ XRDB_LOAD_COLOR("color11", termcol11);
+ XRDB_LOAD_COLOR("color12", termcol12);
+ XRDB_LOAD_COLOR("color13", termcol13);
+ XRDB_LOAD_COLOR("color14", termcol14);
+ XRDB_LOAD_COLOR("color15", termcol15);
}
}
}
--
2.28.0