dwm

my heavily-patched and customized dwm build
git clone git://git.kocotian.pl/dwm.git
Log | Files | Refs | README | LICENSE

commit 21e2d07c92e165f2485e9e37ce936c54b78b7040
parent 085bdf36383587c53eb53c3537d880d11e37959d
Author: kocotian <kocotian@kocotian.pl>
Date:   Sun,  3 Jan 2021 13:47:22 +0100

finally working color status with working lines. great

Diffstat:
Mconfig.def.h | 49+++++++++++++++++++++++++++++++++++++++++++++----
Mdwm.c | 56+++++++++++++++++++++++++++++++++++++-------------------
2 files changed, 82 insertions(+), 23 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -20,6 +20,35 @@ static const char col_gray3[] = "#aaaaaa"; static const char col_gray4[] = "#ffffff"; static const char col_acc1[] = "#a46600"; static const char col_acc2[] = "#d79921"; + +/* static const char col_stat0[] = "#000000"; */ +/* static const char col_stat1[] = "#cc241d"; */ +/* static const char col_stat2[] = "#98971a"; */ +/* static const char col_stat3[] = "#d79921"; */ +/* static const char col_stat4[] = "#458588"; */ +/* static const char col_stat5[] = "#b16286"; */ +/* static const char col_stat6[] = "#689d6a"; */ +/* static const char col_stat7[] = "#a89984"; */ + +/* static const char col_stat0[] = "#928374"; */ +/* static const char col_stat1[] = "#fb4934"; */ +/* static const char col_stat2[] = "#b8bb26"; */ +/* static const char col_stat3[] = "#fabd2f"; */ +/* static const char col_stat4[] = "#83a598"; */ +/* static const char col_stat5[] = "#d3869b"; */ +/* static const char col_stat6[] = "#8ec07c"; */ +/* static const char col_stat7[] = "#ebdbb2"; */ + +/* gruvbox */ +static const char col_stat0[] = "#000000"; +static const char col_stat1[] = "#fb4934"; +static const char col_stat2[] = "#98971a"; +static const char col_stat3[] = "#d79921"; +static const char col_stat4[] = "#458588"; +static const char col_stat5[] = "#b16286"; +static const char col_stat6[] = "#689d6a"; +static const char col_stat7[] = "#a89984"; + static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, @@ -27,14 +56,26 @@ static const char *colors[][3] = { [SchemeStatus] = { col_gray3, col_gray1, "#000000" }, /* Status */ [SchemeTagsNorm] = { col_gray3, col_gray1, "#000000" }, /* Tagbar l unselected */ [SchemeTagsSel] = { col_gray4, col_gray2, "#000000" }, /* Tagbar l selected */ - [SchemeTagLnNorm] = { col_gray2, col_gray2, "#000000" }, /* Line normal */ - [SchemeTagLnOcc] = { col_acc1, col_acc1, "#000000" }, /* Line occupied */ - [SchemeTagLnSel] = { col_acc2, col_acc2, "#000000" }, /* Line selected */ + [SchemeTagLnNorm] = { col_gray2, col_gray2, "#000000" }, /* Top Line normal */ + [SchemeTagLnOcc] = { col_acc1, col_acc1, "#000000" }, /* Top Line occupied */ + [SchemeTagLnSel] = { col_acc2, col_acc2, "#000000" }, /* Top Line selected */ [SchemeInfoNorm] = { col_gray3, col_gray1, "#000000" }, /* Infbar m unselected */ [SchemeInfoSel] = { col_gray3, col_gray1, "#000000" }, /* Infbar m selected */ + + /* Terminal colors, see drw.c for customizing @term */ [SchemeTermNorm] = { col_gray3, col_gray1, "@term" }, [SchemeTermSel] = { col_gray4, col_acc2, col_acc2 }, - /* Terminal colors, see drw.c for customizing @term */ + + /* Statusbar colors */ + [StatusLn] = { col_gray2, col_gray1, "#000000" }, + [StatusBlack] = { col_stat0, col_gray1, "#000000" }, + [StatusRed] = { col_stat1, col_gray1, "#000000" }, + [StatusGreen] = { col_stat2, col_gray1, "#000000" }, + [StatusYellow] = { col_stat3, col_gray1, "#000000" }, + [StatusBlue] = { col_stat4, col_gray1, "#000000" }, + [StatusMagenta] = { col_stat5, col_gray1, "#000000" }, + [StatusCyan] = { col_stat6, col_gray1, "#000000" }, + [StatusWhite] = { col_stat7, col_gray1, "#000000" }, }; /* tagging */ diff --git a/dwm.c b/dwm.c @@ -69,7 +69,9 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { SchemeNorm, SchemeSel, SchemeStatus, SchemeTagsSel, SchemeTagsNorm, SchemeTagLnSel, SchemeTagLnOcc, SchemeTagLnNorm, - SchemeInfoSel, SchemeInfoNorm, SchemeTermSel, SchemeTermNorm }; /* color schemes */ + SchemeInfoSel, SchemeInfoNorm, SchemeTermSel, SchemeTermNorm, + StatusLn, StatusBlack, StatusRed, StatusGreen, StatusYellow, + StatusBlue, StatusMagenta, StatusCyan, StatusWhite }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ @@ -931,6 +933,7 @@ copyvalidchars(char *text, char *rawtext) while(rawtext[++i]) { if ((unsigned char)rawtext[i] >= ' ') { text[j++] = rawtext[i]; + if (rawtext[i] == 127) puts("COPYING 127"); } } text[j] = '\0'; @@ -1031,7 +1034,7 @@ drawbar(Monitor *m) int boxw = drw->fonts->h / 6 + 2; unsigned int i, occ = 0, urg = 0; char qtext[2049], *qptr, *ntext = 0, tmpch, drawn = 0; - int xoffset = 0; + int xoffset = 0, qscheme = SchemeStatus; Client *c; /* draw status first so it can be overdrawn by tags later */ @@ -1047,18 +1050,28 @@ drawbar(Monitor *m) --qptr; while (*(++qptr)) { if (*qptr == 127) { - drw_setscheme(drw, scheme[SchemeStatus]); - tmpch = *qptr; - *qptr = '\0'; - drw_text(drw, (m->ww - tw) + xoffset, 0, drw_fontset_getwidth(drw, (ntext)), bh, 0, ntext, 0); - drw_setscheme(drw, scheme[SchemeTagLnSel]); - drw_rect(drw, (m->ww - tw) + xoffset + 1, 0, drw_fontset_getwidth(drw, (ntext)) - 2, 2, 1, 1); - xoffset += drw_fontset_getwidth(drw, (ntext)); - *qptr = tmpch; - if (tmpch) - ++qptr; - ntext = qptr; - drawn = 1; + ++qptr; + if (*qptr == 127) { + drw_setscheme(drw, scheme[qscheme]); + tmpch = *qptr; + *qptr = '\0'; + drw_text(drw, (m->ww - tw) + xoffset, 0, drw_fontset_getwidth(drw, (ntext)), bh, 0, ntext, 0); + if (qscheme == SchemeStatus) + drw_setscheme(drw, scheme[StatusLn]); + drw_rect(drw, (m->ww - tw) + xoffset + 1, 0, drw_fontset_getwidth(drw, (ntext)) - 2, 2, 1, 0); + qscheme = SchemeStatus; + drw_setscheme(drw, scheme[qscheme]); + xoffset += drw_fontset_getwidth(drw, (ntext)); + *qptr = tmpch; + if (tmpch) + ++qptr; + ntext = qptr; + qscheme = SchemeStatus; + drawn = 1; + } else if (*qptr >= '0' && *qptr <= '7') { + qscheme = StatusBlack + (*qptr - '0'); + *qptr = 127; + } } } if (!drawn) { @@ -1115,7 +1128,6 @@ drawbar(Monitor *m) if (m == selmon) { /* extra status is only drawn on selected monitor */ drw_setscheme(drw, scheme[SchemeNorm]); - /* drw_text(drw, 0, 0, mons->ww, bh, 0, estext, 0); */ strcpy(qtext, estext); qptr = qtext; @@ -1128,19 +1140,25 @@ drawbar(Monitor *m) } while (*(++qptr)) { if (*qptr == 127) { - if (*(++qptr) == 127) { - drw_setscheme(drw, scheme[SchemeStatus]); + ++qptr; + if (*qptr == 127) { + drw_setscheme(drw, scheme[qscheme]); tmpch = *qptr; *qptr = '\0'; drw_text(drw, 0 + xoffset, 0, mons->ww - xoffset, bh, 0, ntext, 0); - drw_setscheme(drw, scheme[SchemeTagLnSel]); - drw_rect(drw, 0 + xoffset + 1, bh - 2, drw_fontset_getwidth(drw, (ntext)) - 2, 2, 1, 1); + if (qscheme == SchemeStatus) + drw_setscheme(drw, scheme[StatusLn]); + drw_rect(drw, 0 + xoffset + 1, bh - 2, drw_fontset_getwidth(drw, (ntext)) - 2, 2, 1, 0); xoffset += drw_fontset_getwidth(drw, (ntext)); *qptr = tmpch; if (tmpch) ++qptr; ntext = qptr; + qscheme = SchemeStatus; drawn = 1; + } else if (*qptr >= '0' && *qptr <= '7') { + qscheme = StatusBlack + (*qptr - '0'); + *qptr = 127; } } }