dwm

my build of dwm
git clone git://git.ckyln.com/~cem/dwm.git
Log | Files | Refs | README | LICENSE

commit e3cee1cafa1dc85403db5bc381ceb2814fea9d1d
parent d0817b41a25080ca9d2e592f68b8fb20e49b6724
Author: Cem Keylan <cem@ckyln.com>
Date:   Mon, 20 Jan 2020 22:14:25 +0300

add statusbar patch

Diffstat:
Mconfig.def.h | 14+++++++++++---
Mdwm.c | 18++++++++++++++++--
2 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -20,10 +20,18 @@ static char normfgcolor[] = "#bbbbbb"; static char selfgcolor[] = "#eeeeee"; static char selbordercolor[] = "#005577"; static char selbgcolor[] = "#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 col_green[] = "#52d017"; static const char *colors[][3] = { - /* fg bg border */ - [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor}, - [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor}, + /* fg bg border */ + [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor}, + [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor}, + [SchemeWarn] = { col_black, col_yellow, col_red }, + [SchemeUrgent]= { col_white, col_red, col_red }, + [SchemeSuccess]= { col_white, col_green, col_green }, }; /* tagging */ diff --git a/dwm.c b/dwm.c @@ -75,7 +75,7 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel }; /* color schemes */ +enum { SchemeNorm, SchemeSel, SchemeWarn, SchemeUrgent, SchemeSuccess }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ @@ -730,13 +730,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 = '\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) {