sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 456cab5eb268774276e944c4b8d0015567b7b81f
parent 1518dba7f66887938cb1785e419404d05886c466
Author: Daniel Raloff <dan@raloff.net>
Date:   Wed, 25 Mar 2015 06:58:52 -0700

Added statuscolors patch for current git version of dwm

Diffstat:
Adwm.suckless.org/patches/dwm-6.1-statuscolors.diff | 206+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/statuscolors.md | 1+
2 files changed, 207 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff b/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff @@ -0,0 +1,206 @@ +Only in dwm: config.def.h +diff -up dwm/drw.c dwm_git_colors/drw.c +--- dwm/drw.c 2015-03-24 10:00:33.865796838 -0700 ++++ dwm_git_colors/drw.c 2015-03-24 09:56:59.542647284 -0700 +@@ -202,13 +202,38 @@ drw_setscheme(Drw *drw, ClrScheme *schem + drw->scheme = scheme; + } + ++int ++drw_colored_text(Drw *drw, ClrScheme *scheme, int numcolors, int x, int y, unsigned int w, unsigned int h, char *text) { ++ if(!drw || !drw->fontcount || !drw->scheme) ++ return 0; ++ ++ char *buf = text, *ptr = buf, c =1; ++ int i; ++ ++ while(*ptr) { ++ for(i = 0; *ptr < 0 || *ptr > numcolors; i++, ptr++); ++ if(!*ptr) ++ break; ++ c = *ptr; ++ *ptr = 0; ++ if(i) { ++ x = drw_text(drw, x, y, w, h, buf, 0); ++ } ++ *ptr = c; ++ drw_setscheme(drw, &scheme[c-1]); ++ buf = ++ptr; ++ } ++ drw_text(drw, x, y, w, h, buf, 0); ++ return x; ++} ++ + void +-drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert) { ++drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty) { + int dx; + + if(!drw || !drw->fontcount || !drw->scheme) + return; +- XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->bg->pix : drw->scheme->fg->pix); ++ XSetForeground(drw->dpy, drw->gc, drw->scheme->fg->pix); + dx = (drw->fonts[0]->ascent + drw->fonts[0]->descent + 2) / 4; + if(filled) + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x+1, y+1, dx+1, dx+1); +@@ -217,7 +242,7 @@ drw_rect(Drw *drw, int x, int y, unsigne + } + + int +-drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert) { ++drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int pad) { + char buf[1024]; + int tx, ty, th; + Extnts tex; +@@ -242,7 +267,7 @@ drw_text(Drw *drw, int x, int y, unsigne + if (!drw || !drw->scheme) { + return 0; + } else if (render) { +- XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->fg->pix : drw->scheme->bg->pix); ++ XSetForeground(drw->dpy, drw->gc, drw->scheme->bg->pix); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h); + } + +@@ -294,10 +319,10 @@ drw_text(Drw *drw, int x, int y, unsigne + for(i = len; i && i > len - 3; buf[--i] = '.'); + + if (render) { +- th = curfont->ascent + curfont->descent; +- ty = y + (h / 2) - (th / 2) + curfont->ascent; ++ th = pad ? (curfont->ascent + curfont->descent) : 0; ++ ty = y + ((h + curfont->ascent - curfont->descent) / 2); + tx = x + (h / 2); +- XftDrawStringUtf8(d, invert ? &drw->scheme->bg->rgb : &drw->scheme->fg->rgb, curfont->xfont, tx, ty, (XftChar8 *)buf, len); ++ XftDrawStringUtf8(d, &drw->scheme->fg->rgb, curfont->xfont, tx, ty, (XftChar8 *)buf, len); + } + + x += tex.w; +diff -up dwm/drw.h dwm_git_colors/drw.h +--- dwm/drw.h 2015-03-24 10:00:33.865796838 -0700 ++++ dwm_git_colors/drw.h 2015-03-24 09:22:03.216317586 -0700 +@@ -67,8 +67,9 @@ void drw_setfont(Drw *drw, Fnt *font); + void drw_setscheme(Drw *drw, ClrScheme *scheme); + + /* Drawing functions */ +-void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert); +-int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert); ++int drw_colored_text(Drw *drw, ClrScheme *scheme, int numcolors, int x, int y, unsigned int w, unsigned int h, char *text); ++void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty); ++int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int pad); + + /* Map functions */ + void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h); +Binary files dwm/drw.o and dwm_git_colors/drw.o differ +Binary files dwm/dwm and dwm_git_colors/dwm differ +diff -up dwm/dwm.c dwm_git_colors/dwm.c +--- dwm/dwm.c 2015-03-24 10:02:59.752217939 -0700 ++++ dwm_git_colors/dwm.c 2015-03-24 09:23:22.826334134 -0700 +@@ -51,6 +51,7 @@ + * MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy))) + #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) + #define LENGTH(X) (sizeof X / sizeof X[0]) ++#define MAXCOLORS 9 + #define MOUSEMASK (BUTTONMASK|PointerMotionMask) + #define WIDTH(X) ((X)->w + 2 * (X)->bw) + #define HEIGHT(X) ((X)->h + 2 * (X)->bw) +@@ -261,7 +263,7 @@ static void (*handler[LASTEvent]) (XEven + static Atom wmatom[WMLast], netatom[NetLast]; + static Bool running = True; + static Cur *cursor[CurLast]; +-static ClrScheme scheme[SchemeLast]; ++static ClrScheme scheme[MAXCOLORS]; + static Display *dpy; + static Drw *drw; + static Monitor *mons, *selmon; +@@ -703,14 +716,14 @@ drawbar(Monitor *m) { + x = 0; + for(i = 0; i < LENGTH(tags); i++) { + w = TEXTW(tags[i]); +- drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]); +- drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i); ++ drw_setscheme(drw, &scheme[(m->tagset[m->seltags] & 1 << i) ? 1 : (urg & 1 << i ? 2:0)]); ++ drw_text(drw, x, 0, w, bh, tags[i], 1); + drw_rect(drw, x, 0, w, bh, m == selmon && selmon->sel && selmon->sel->tags & 1 << i, +- occ & 1 << i, urg & 1 << i); ++ occ & 1 << i); + x += w; + } + w = blw = TEXTW(m->ltsymbol); +- drw_setscheme(drw, &scheme[SchemeNorm]); ++ drw_setscheme(drw, &scheme[0]); + drw_text(drw, x, 0, w, bh, m->ltsymbol, 0); + x += w; + xx = x; +@@ -721,19 +734,19 @@ drawbar(Monitor *m) { + x = xx; + w = m->ww - xx; + } +- drw_text(drw, x, 0, w, bh, stext, 0); ++ drw_colored_text(drw, scheme, NUMCOLORS, x, 0, w, bh, stext); + } + else + x = m->ww; + if((w = x - xx) > bh) { + x = xx; + if(m->sel) { +- drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]); +- drw_text(drw, x, 0, w, bh, m->sel->name, 0); +- drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0); ++ drw_setscheme(drw, &scheme[m == selmon ? 1 : 0]); ++ drw_text(drw, x, 0, w, bh, m->sel->name, 1); ++ drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating); + } + else { +- drw_setscheme(drw, &scheme[SchemeNorm]); ++ drw_setscheme(drw, &scheme[0]); + drw_text(drw, x, 0, w, bh, NULL, 0); + } + } +@@ -791,7 +804,7 @@ focus(Client *c) { + detachstack(c); + attachstack(c); + grabbuttons(c, True); +- XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix); ++ XSetWindowBorder(dpy, c->win, scheme[1].border->pix); + setfocus(c); + } + else { +@@ -1039,7 +1052,7 @@ manage(Window w, XWindowAttributes *wa) + + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); +- XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->pix); ++ XSetWindowBorder(dpy, w, scheme[0].border->pix); + configure(c); /* propagates border_width, if size doesn't change */ + updatewindowtype(c); + updatesizehints(c); +@@ -1531,12 +1544,12 @@ setup(void) { + cursor[CurResize] = drw_cur_create(drw, XC_sizing); + cursor[CurMove] = drw_cur_create(drw, XC_fleur); + /* init appearance */ +- scheme[SchemeNorm].border = drw_clr_create(drw, normbordercolor); +- scheme[SchemeNorm].bg = drw_clr_create(drw, normbgcolor); +- scheme[SchemeNorm].fg = drw_clr_create(drw, normfgcolor); +- scheme[SchemeSel].border = drw_clr_create(drw, selbordercolor); +- scheme[SchemeSel].bg = drw_clr_create(drw, selbgcolor); +- scheme[SchemeSel].fg = drw_clr_create(drw, selfgcolor); ++ for(int i = 0; i < NUMCOLORS; i++){ ++ scheme[i].border = drw_clr_create(drw, colors[i][0]); ++ scheme[i].fg = drw_clr_create(drw, colors[i][1]); ++ scheme[i].bg = drw_clr_create(drw, colors[i][2]); ++ } ++ + /* init bars */ + updatebars(); + updatestatus(); +@@ -1685,7 +1698,7 @@ unfocus(Client *c, Bool setfocus) { + if(!c) + return; + grabbuttons(c, False); +- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->pix); ++ XSetWindowBorder(dpy, c->win, scheme[0].border->pix); + if(setfocus) { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); +Binary files dwm/dwm.o and dwm_git_colors/dwm.o differ +Common subdirectories: dwm/.git and dwm_git_colors/.git diff --git a/dwm.suckless.org/patches/statuscolors.md b/dwm.suckless.org/patches/statuscolors.md @@ -59,3 +59,4 @@ An example status script snippet to take advantage of the colors: * [dwm-5.7.2-statuscolors.diff](historical/dwm-5.7.2-statuscolors.diff) * [dwm-5.8.2-statuscolors.diff](historical/dwm-5.8.2-statuscolors.diff) * [dwm-5.9-statuscolors.diff](dwm-5.9-statuscolors.diff) + * [dwm-6.1-statuscolors.diff](dwm-6.1-statuscolors.diff)