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 -pu --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-18 09:31:31.000000000 +0000
@@ -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 -pu --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-18 09:35:14.000000000 
+0000
@@ -7,7 +7,7 @@ const char *tags[] = { "1", "2", "3", "4
 
 #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 @@ static Key key[] = { \
        { 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 -pu --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-18 09:36:58.000000000 +0000
@@ -97,6 +97,8 @@ drawtext(const char *text, unsigned long
 
 /* extern */
 
+_TILESYMBOL_
+
 void
 drawstatus(void) {
        int i, x;
@@ -111,7 +113,7 @@ drawstatus(void) {
                dc.x += dc.w;
        }
        dc.w = bmw;
-       drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.norm, False, 
False);
+       drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL[apwl], dc.norm, 
False, False);
        x = dc.x + dc.w;
        dc.w = textw(stext);
        dc.x = sw - dc.w;
diff -pu --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-18 09:47:49.000000000 +0000
@@ -89,9 +89,11 @@ struct Client {
 };
 
 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 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 */
@@ -160,3 +162,4 @@ extern void togglemode(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 append(Arg *arg);                  /* append new windows to the 
client's list or not */
diff -pu --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-18 09:38:33.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, 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;
@@ -134,7 +134,7 @@ setup(void) {
        sh = DisplayHeight(dpy, screen);
        master = MASTER;
        nmaster = NMASTER;
-       bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : 
textw(FLOATSYMBOL);
+       bmw = textw(TILESYMBOL[0]) > textw(FLOATSYMBOL) ? textw(TILESYMBOL[0]) 
: textw(FLOATSYMBOL);
        /* bar */
        dc.h = bh = dc.font.height + 2;
        wa.override_redirect = 1;
@@ -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 -pu --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-18 09:48:15.000000000 +0000
@@ -267,3 +267,9 @@ zoom(Arg *arg) {
        focus(c);
        arrange();
 }
+
+void
+append(Arg *arg) {
+  apwl ^= arg->i;
+  drawstatus();
+}

Reply via email to