I've defined two symbols for the tile and append modes:

#define TILESYMBOL              "[<="
#define APPENDSYMBOL            "[>="

So it looks cleaner for me, instead of "const char *..[]={"[<=",...}"

The rest of the code is similar. ARG, what do you think about this?

Could this feature be included into the main stream?

--pancake


> On Thu, Jan 18, 2007 at 03:40:31PM +0100, Oliver Heins wrote:
>> Hi Tener,
>>
>> Tener Hades <[EMAIL PROTECTED]>
>> writes:
>> > i've changed TILESYMBOL the same way the bottom stack patch does to
>> > notify of which mode you're in.
>> >
>> >    "[->]=" appends the stack (your patch).
>> >    "[<-]=" prepends the stack (dwm default).
>> >
>> > apart from all the declaration that needs, i also added a call
>> > to drawstatus() at the end of append().
>>
>> can you post the modified patch?
>>
>> Thanks,
>>  olli
>
> I can try.
>
> this is untested. i had to rewrite most of it, 'cus my dwm is moded to
> hell.. but i know it compiles. _should_ work.
>
>
> [/tener]
> --
> Xgwdto{ gphaiit pd dfreh_ ufhnj jq om dph]yc}a}o
>
diff -r c3c57faef013 client.c
--- a/client.c	Fri Jan 19 15:05:07 2007 +0100
+++ b/client.c	Fri Jan 19 15:27:32 2007 +0100
@@ -157,11 +157,27 @@ manage(Window w, XWindowAttributes *wa) 
 	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 -r c3c57faef013 config.default.h
--- a/config.default.h	Fri Jan 19 15:05:07 2007 +0100
+++ b/config.default.h	Fri Jan 19 15:37:11 2007 +0100
@@ -8,7 +8,8 @@ const char *tags[] = { "1", "2", "3", "4
 #define BORDERPX		1
 #define DEFMODE			dotile		/* dofloat */
 #define FLOATSYMBOL		"><>"
-#define TILESYMBOL		"[]="
+#define TILESYMBOL		"[<="
+#define APPENDSYMBOL		"[>="
 
 #define FONT			"-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
 #define NORMBORDERCOLOR		"#dddddd"
@@ -30,6 +31,7 @@ static Key key[] = { \
 	{ MODKEY,			XK_Tab,		focusnext,	{ 0 } }, \
 	{ MODKEY|ShiftMask,		XK_Tab,		focusprev,	{ 0 } }, \
 	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
+	{ MODKEY,			XK_a,		toggleappend,   { .i = 1 } }, \
 	{ MODKEY,			XK_g,		resizemaster,	{ .i = 15 } }, \
 	{ MODKEY,			XK_s,		resizemaster,	{ .i = -15 } }, \
 	{ MODKEY,			XK_i,		incnmaster,	{ .i = 1 } }, \
diff -r c3c57faef013 draw.c
--- a/draw.c	Fri Jan 19 15:05:07 2007 +0100
+++ b/draw.c	Fri Jan 19 15:29:24 2007 +0100
@@ -111,7 +111,7 @@ drawstatus(void) {
 		dc.x += dc.w;
 	}
 	dc.w = bmw;
-	drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.norm, False, False);
+	drawtext(arrange == dofloat ? FLOATSYMBOL : apwl ? APPENDSYMBOL : TILESYMBOL, dc.norm, False, False);
 	x = dc.x + dc.w;
 	dc.w = textw(stext);
 	dc.x = sw - dc.w;
diff -r c3c57faef013 dwm.h
--- a/dwm.h	Fri Jan 19 15:05:07 2007 +0100
+++ b/dwm.h	Fri Jan 19 15:27:32 2007 +0100
@@ -91,6 +91,7 @@ extern char stext[256];				/* status tex
 extern char stext[256];				/* status text */
 extern int bh, bmw;				/* bar height, bar mode label width */
 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 */
@@ -159,3 +160,4 @@ extern void toggleview(Arg *arg);		/* to
 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 toggleappend(Arg *arg);		/* append new windows to the client's list or not */
diff -r c3c57faef013 main.c
--- a/main.c	Fri Jan 19 15:05:07 2007 +0100
+++ b/main.c	Fri Jan 19 15:27:32 2007 +0100
@@ -19,7 +19,7 @@
 
 char stext[256];
 Bool *seltag;
-int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah;
+int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah, apwl;
 unsigned int master, nmaster, ntags, numlockmask;
 Atom wmatom[WMLast], netatom[NetLast];
 Bool running = True;
@@ -248,6 +248,7 @@ main(int argc, char *argv[]) {
 	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 -r c3c57faef013 view.c
--- a/view.c	Fri Jan 19 15:05:07 2007 +0100
+++ b/view.c	Fri Jan 19 15:31:17 2007 +0100
@@ -267,3 +267,9 @@ zoom(Arg *arg) {
 	focus(c);
 	arrange();
 }
+
+void
+toggleappend(Arg *arg) {
+	apwl ^= arg->i;
+	drawstatus();
+}

Reply via email to