From 77f2f2270b249566b20713993f56799b6e517421 Mon Sep 17 00:00:00 2001 From: lhark Date: Mon, 16 Nov 2020 02:23:14 +0100 Subject: [PATCH] Update status2d with ^b^ background command --- dwm.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dwm.c b/dwm.c index 7438c6a..0047f89 100644 --- a/dwm.c +++ b/dwm.c @@ -886,12 +886,15 @@ drawstatusbar(Monitor *m, int bh, char* stext) { text = p; w += 2; /* 1px padding on both sides */ - ret = x = m->ww - w; + ret = m->ww - w; + x = m->ww - w - getsystraywidth(); drw_setscheme(drw, scheme[LENGTH(colors)]); drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; + drw->scheme[ColBg] = scheme[SchemeNorm][ColBg]; drw_rect(drw, x, 0, w, bh, 1, 1); x++; + int tw = w; /* process status text */ i = -1; @@ -913,8 +916,16 @@ drawstatusbar(Monitor *m, int bh, char* stext) { buf[7] = '\0'; drw_clr_create(drw, &drw->scheme[ColFg], buf); i += 7; + } else if (text[i] == 'b') { + char buf[8]; + memcpy(buf, (char*)text+i+1, 7); + buf[7] = '\0'; + drw_clr_create(drw, &drw->scheme[ColBg], buf); + i += 7; + //drw_rect(drw, x, 0, tw - x + m->ww - getsystraywidth(), bh, 1, 1); } else if (text[i] == 'd') { drw->scheme[ColFg] = scheme[SchemeNorm][ColFg]; + drw->scheme[ColBg] = scheme[SchemeNorm][ColBg]; } else if (text[i] == 'r') { int rx = atoi(text + ++i); while (text[++i] != ',');