--- Heyho, this patch allows for a flexible amount of different colorschemes in config.h without having to edit dwm.c as well. Applying this upstream would help patches like urgentborder and statuscolors with the new drw mechanics. This patch has no benefit to core dwm at all, but since it's an improvement for the ecosystem, you might want to consider merging it to the dwm source. --Markus config.def.h | 2 +- dwm.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config.def.h b/config.def.h index fd77a07..ba9a240 100644 --- a/config.def.h +++ b/config.def.h _AT_@ -12,7 +12,7 @@ static const char col_gray2[] = "#444444"; static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; static const char col_cyan[] = "#005577"; -static const char *colors[SchemeLast][3] = { +static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, diff --git a/dwm.c b/dwm.c index 421bf27..25ef526 100644 --- a/dwm.c +++ b/dwm.c _AT_@ -60,7 +60,7 @@ /* enums */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ -enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */ +enum { SchemeNorm, SchemeSel }; /* color schemes */ enum { NetSupported, NetWMName, NetWMState, NetWMFullscreen, NetActiveWindow, NetWMWindowType, NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ _AT_@ -263,7 +263,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { static Atom wmatom[WMLast], netatom[NetLast]; static int running = 1; static Cur *cursor[CurLast]; -static Scm scheme[SchemeLast]; +static Scm *scheme; static Display *dpy; static Drw *drw; static Monitor *mons, *selmon; _AT_@ -483,7 +483,7 @@ cleanup(void) cleanupmon(mons); for (i = 0; i < CurLast; i++) drw_cur_free(drw, cursor[i]); - for (i = 0; i < SchemeLast; i++) + for (i = 0; i < LENGTH(colors); i++) free(scheme[i]); drw_free(drw); XSync(dpy, False); _AT_@ -1549,6 +1549,7 @@ setmfact(const Arg *arg) void setup(void) { + int i; XSetWindowAttributes wa; /* clean up any zombies immediately */ _AT_@ -1583,8 +1584,9 @@ setup(void) cursor[CurResize] = drw_cur_create(drw, XC_sizing); cursor[CurMove] = drw_cur_create(drw, XC_fleur); /* init appearance */ - scheme[SchemeNorm] = drw_scm_create(drw, colors[SchemeNorm], 3); - scheme[SchemeSel] = drw_scm_create(drw, colors[SchemeSel], 3); + scheme = ecalloc(LENGTH(colors), sizeof(Scm)); + for (i = 0; i < LENGTH(colors); i++) + scheme[i] = drw_scm_create(drw, colors[i], 3); /* init bars */ updatebars(); updatestatus(); -- 2.7.3Received on Wed Oct 26 2016 - 20:30:13 CEST
This archive was generated by hypermail 2.3.0 : Wed Oct 26 2016 - 20:36:15 CEST