Top stack in dwm?

Folks, I have the bottomstack (bstack) function in dwm, but I use topstack. I do it in a roundabout way (ie, use secondary as master). Is it an easy hack (in dwm.c) to have topstack functionality? I opened dwm.c and looked at the bstack function, it is not trivial to modify it for topstack. If someone has a fix, pl. post, will appreciate.

Do love all!

1 Like

This isn’t a technical question. Please post in the correct place. It keeps the forum tidy.

static void tstack(Monitor *m)
{
	Client *c;
	unsigned int i, n;
	int w, h, mh, mx, tx, tw;

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

	if (n > m->nmaster) {
		mh = m->nmaster ? m->mfact * m->wh : 0;
		tw = m->ww / (n - m->nmaster);
	} else {
		mh = m->wh;
		tw = m->ww;
	}

	for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
		if (i < m->nmaster) {
			w = (m->ww - mx) / (MIN(n, m->nmaster) - i);
			resize(c, m->wx + mx, (m->wy + m->wh) - mh, w - (2 * c->bw), mh - (2 * c->bw), 0);
			mx += WIDTH(c);
		} else {
			h = m->wh - mh;
			resize(c, tx, m->wy, tw - (2 * c->bw), h - (2 * c->bw), 0);
			if (tw != m->ww)
				tx += WIDTH(c);
		}
	}
}
1 Like

So this should not be in basic help and support? What category should I move it to? (or have you moved it already?, I am unable to tell)…

EDIT: So I think you’ve already moved it since it shows a pen (or pencil rather since it has an eraser at the back) in front of your name w/ this post. OK, thanks! Sorry it took me a while to figure out what had happened.

Thanks Nateji!

UPDATE: I applied the “patch” to dwm.c and made changes to config. There is a problem. The new layout DOES move the bottom stack to the top. HOWEVER, it “overlays” the existing window in the master. It does not move the master downwards. Makes the master unusuable (since most of it is covered). Also the bottom of the screen remains vacant. I guess what is missing is the master should move down to accomodate the top stack.

Single character typo, should be good now.

1 Like

Confirmed. Thanks again!