diff -ru --exclude=config.mk dwm-vanilla-3.1/client.c dwm-append-windows-3.1/client.c --- dwm-vanilla-3.1/client.c 2007-01-16 10:41:35.000000000 +0000 +++ dwm-append-windows-3.1/client.c 2007-01-20 23:05:22.000000000 +0000 @@ -157,11 +157,27 @@ settags(c, getclient(trans)); if(!c->isfloat) c->isfloat = trans || c->isfixed; - if(clients) - clients->prev = c; - c->next = clients; + + if(apwl) { + Client *tc; + + for(tc = clients; tc && tc->next; tc = tc->next); + if(tc) { + tc->next = c; + c->prev = tc; + } + else + clients = c; + } + else { + if(clients) + clients->prev = c; + c->next = clients; + clients = c; + } c->snext = stack; - stack = clients = c; + stack = c; + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); XMapWindow(dpy, c->win); if(isvisible(c)) diff -ru --exclude=config.mk dwm-vanilla-3.1/config.default.h dwm-append-windows-3.1/config.default.h --- dwm-vanilla-3.1/config.default.h 2007-01-16 10:41:35.000000000 +0000 +++ dwm-append-windows-3.1/config.default.h 2007-01-20 23:05:22.000000000 +0000 @@ -7,7 +7,7 @@ #define DEFMODE dotile /* dofloat */ #define FLOATSYMBOL "><>" -#define TILESYMBOL "[]=" +#define _TILESYMBOL_ const char *TILESYMBOL[] = { "[<-]=", "[->]=", NULL }; #define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*" #define NORMBORDERCOLOR "#dddddd" @@ -29,6 +29,7 @@ { MODKEY, XK_Tab, focusnext, { 0 } }, \ { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \ { MODKEY, XK_Return, zoom, { 0 } }, \ + { MODKEY, XK_a, append, { .i = 1 } }, \ { MODKEY, XK_g, resizemaster, { .i = 15 } }, \ { MODKEY, XK_s, resizemaster, { .i = -15 } }, \ { MODKEY, XK_i, incnmaster, { .i = 1 } }, \ diff -ru --exclude=config.mk dwm-vanilla-3.1/draw.c dwm-append-windows-3.1/draw.c --- dwm-vanilla-3.1/draw.c 2007-01-16 10:41:35.000000000 +0000 +++ dwm-append-windows-3.1/draw.c 2007-01-20 23:53:45.000000000 +0000 @@ -97,6 +97,8 @@ /* extern */ +_TILESYMBOL_ + void drawstatus(void) { int i, x; @@ -110,8 +112,8 @@ drawtext(tags[i], dc.norm, sel && sel->tags[i], isoccupied(i)); dc.x += dc.w; } - dc.w = bmw; - drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.norm, False, False); + dc.w = getbmw(); + drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL[apwl], dc.norm, False, False); x = dc.x + dc.w; dc.w = textw(stext); dc.x = sw - dc.w; @@ -183,3 +185,14 @@ textw(const char *text) { return textnw(text, strlen(text)) + dc.font.height; } + +unsigned int +getbmw() +{ + /* instead of setting the extern bmw, just return what it should be this time.. thus + reducing code size. */ + /* arrange pointer _needs_ to be set */ + /* the external bmw variable still exists because it's used in event.c; should be + removable, though. thus adding functionality i want without affecting code size */ + return (arrange == dotile ? textw(TILESYMBOL[apwl]) : textw(FLOATSYMBOL)); +} diff -ru --exclude=config.mk dwm-vanilla-3.1/dwm.h dwm-append-windows-3.1/dwm.h --- dwm-vanilla-3.1/dwm.h 2007-01-16 10:41:35.000000000 +0000 +++ dwm-append-windows-3.1/dwm.h 2007-01-20 23:59:18.000000000 +0000 @@ -89,9 +89,11 @@ }; extern const char *tags[]; /* all tags */ +extern const char *TILESYMBOL[]; /* all symbols for tilemode */ extern char stext[256]; /* status text */ -extern int bh, bmw; /* bar height, bar mode label width */ +extern int bh; /* bar height */ extern int screen, sx, sy, sw, sh; /* screen geometry */ +extern int apwl; /* append window list boolean */ extern int wax, way, wah, waw; /* windowarea geometry */ extern unsigned int master, nmaster; /* master percent, number of master clients */ extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */ @@ -121,6 +123,7 @@ extern unsigned long getcolor(const char *colstr); /* return color of colstr */ extern void setfont(const char *fontstr); /* set the font for DC */ extern unsigned int textw(const char *text); /* return the width of text in px*/ +extern unsigned int getbmw(); /* get bar mode label width */ /* event.c */ extern void grabkeys(void); /* grab all keys defined in config.h */ @@ -160,3 +163,4 @@ extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ extern void view(Arg *arg); /* views the tag with arg's index */ extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */ +extern void append(Arg *arg); /* append new windows to the client's list or not */ diff -ru --exclude=config.mk dwm-vanilla-3.1/event.c dwm-append-windows-3.1/event.c --- dwm-vanilla-3.1/event.c 2007-01-16 10:41:35.000000000 +0000 +++ dwm-append-windows-3.1/event.c 2007-01-20 23:54:11.000000000 +0000 @@ -131,7 +131,7 @@ return; } } - if(ev->x < x + bmw) + if(ev->x < x + getbmw()) switch(ev->button) { case Button1: togglemode(NULL); diff -ru --exclude=config.mk dwm-vanilla-3.1/main.c dwm-append-windows-3.1/main.c --- dwm-vanilla-3.1/main.c 2007-01-16 10:41:35.000000000 +0000 +++ dwm-append-windows-3.1/main.c 2007-01-21 00:00:34.000000000 +0000 @@ -19,7 +19,7 @@ char stext[256]; Bool *seltag; -int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah; +int bh, screen, sx, sy, sw, sh, wax, way, waw, wah, apwl; unsigned int master, nmaster, ntags, numlockmask; Atom wmatom[WMLast], netatom[NetLast]; Bool running = True; @@ -134,7 +134,6 @@ sh = DisplayHeight(dpy, screen); master = MASTER; nmaster = NMASTER; - bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL); /* bar */ dc.h = bh = dc.font.height + 2; wa.override_redirect = 1; @@ -248,6 +247,7 @@ screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); otherwm = False; + apwl = False; XSetErrorHandler(xerrorstart); /* this causes an error if some other window manager is running */ XSelectInput(dpy, root, SubstructureRedirectMask); diff -ru --exclude=config.mk dwm-vanilla-3.1/view.c dwm-append-windows-3.1/view.c --- dwm-vanilla-3.1/view.c 2007-01-16 10:41:35.000000000 +0000 +++ dwm-append-windows-3.1/view.c 2007-01-20 23:05:22.000000000 +0000 @@ -267,3 +267,9 @@ focus(c); arrange(); } + +void +append(Arg *arg) { + apwl ^= arg->i; + drawstatus(); +}