You are not logged in.

#1 2009-03-16 19:10:50

landwell
Member
Registered: 2008-11-24
Posts: 11

dwm default layout

Is it possible to change the default tiling layout of dwm? What I'd like to do is have the master window occupy the top half of the screen -- essentially rotate the default layout  90 degrees clockwise.

Offline

#2 2009-03-16 19:17:41

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: dwm default layout

Yup, there's a patch for that called bottom stack.

Offline

#3 2009-03-16 19:20:32

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: dwm default layout

If you are using a dwm version circa 4.7, I've got an old bstack.diff laying around.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#4 2009-03-16 19:52:17

landwell
Member
Registered: 2008-11-24
Posts: 11

Re: dwm default layout

Runiq wrote:

Yup, there's a patch for that called bottom stack.

Thanks; I looked right past it this morning.

Offline

#5 2009-03-17 02:54:13

landwell
Member
Registered: 2008-11-24
Posts: 11

Re: dwm default layout

Got the patch applied, but the install failed with:

cleaning
dwm build options:
CFLAGS   = -std=c99 -pedantic -Wall -Os -I. -I/usr/include -I/usr/X11R6/include -DVERSION="5.4.1" 
LDFLAGS  = -s -L/usr/lib -lc -L/usr/X11R6/lib -lX11 
CC       = cc
CC dwm.c
In file included from config.h:35,
                 from dwm.c:242:
bstack.c: In function 'bstack':
bstack.c:13: error: too few arguments to function 'resize'
bstack.c:27: error: too few arguments to function 'resize'
make: *** [dwm.o] Error 1

Is there a workaround for this? I can't locate it searching the forums, or with google. I'm also a Debian user, came to this forum since dwm is pretty popular with this group.

Offline

#6 2009-03-17 11:20:05

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: dwm default layout

Are you patching against the correct version?  Patches are against a specific version of the code.  If the code has changed, you have to dig in and modify the patch to work with the new code.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#7 2009-03-17 11:54:08

dusanx
Member
Registered: 2008-11-28
Posts: 132

Re: dwm default layout

I have bottom stack layout added to my config.h, makes upgrades cleaner and no need for diff. Let me know if you want me to paste relevant code.


Gnome -> Openbox -> Awesome -> XMonad -> dwm .
http://github.com/dusanx/uzbl/

Offline

#8 2009-03-17 17:41:49

landwell
Member
Registered: 2008-11-24
Posts: 11

Re: dwm default layout

@dusanx

Please paste the code your using.

Pretty sure I patched dwm-5.4 with the dwm-5.4-bstack.diff patch (am I missing something?) so I'll try patching again, but may need to give your code a shot.

Thanks.

Last edited by landwell (2009-03-17 17:43:52)

Offline

#9 2009-03-17 17:55:11

dusanx
Member
Registered: 2008-11-28
Posts: 132

Re: dwm default layout

No problem.

#1: Add this (there should be custom functions... comment already, just add function declaration below):
/* custom functions declarations */
static void bstack(void);

#2: Add bstack to layouts:
static Layout layouts[] = {
    /* symbol     arrange function */
    { "[]=",      tile },    /* first entry is default */
    { "><>",      NULL },    /* no layout function means floating behavior */
    { "[M]",      monocle },
    { "TTT",      bstack },
};

#3: Paste complete bstack function below /* custom functions */ header:
/* custom functions */
void
bstack(void) {
    int x, y, h, w, mh;
    unsigned int i, n;
    Client *c;

    for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
    if(n == 0)
        return;

    c = nexttiled(clients);
    mh = mfact * wh;
    adjustborder(c, n == 1 ? 0 : borderpx);
    resize(c, wx, wy, ww - 2 * c->bw, (n == 1 ? wh : mh) - 2 * c->bw, resizehints);

    if(--n == 0)
        return;

    x = wx;
    y = (wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : wy + mh;
    w = ww / n;
    h = (wy + mh > c->y + c->h) ? wy + wh - y : wh - mh;
    if(h < bh)
        h = wh;

    for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
        adjustborder(c, borderpx);
        resize(c, x, y, ((i + 1 == n) ? wx + ww - x : w) - 2 * c->bw,
               h - 2 * c->bw, resizehints);
        if(w != ww)
            x = c->x + WIDTH(c);
    }
}

If something goes wrong here is my complete config.h:
http://pastebin.com/f7d7d4f2f

I always like to add something to config.h and keep dwm.c clean for upgrades.


Gnome -> Openbox -> Awesome -> XMonad -> dwm .
http://github.com/dusanx/uzbl/

Offline

#10 2009-03-17 23:34:19

landwell
Member
Registered: 2008-11-24
Posts: 11

Re: dwm default layout

Thanks; pasting in your code worked.

Offline

Board footer

Powered by FluxBB