Re: [dev] Re: [dwm] A general approach to master-slave layouts

From: lolilolicon <>
Date: Tue, 1 Nov 2011 00:11:23 +0800

On Mon, Oct 31, 2011 at 10:19 PM, Thomas Dahms <> wrote:
> That looks interesting. I have one suggestion for a simplification:
> I guess you can get rid of the functions combining the master and
> slave layouts by modifying setlayout() to take three arguments (the
> two layouts and the direction of master/slave splitting). This way you
> could combine any two layouts in the key binding section of config.h.

I don't think we can do this with the current Arg. I also don't see the
benefit of this over defining the layouts. If the user wants to combine
two layout algorithms, he can always define a layout in as few as three
lines in config.h. Please elaborate if I misunderstand.

Also, the code is so far in no way in conflict with the dwm code. This
general approach is also more flexible. For example, the example `ntile'
layout can replace `tile' in dwm.c, and `monocle' in dwm.c can be defined
via `apply_lt` using `lt_monocle`.

Actually, `apply_lt` can be removed, since `apply_mslts` does the same
thing when nmaster == 0. I'm thinking of making nmaster a member of
the Layout structure, instead of the current Monitor. This way, we can
make all windows slaves in the `grid' layout, while having two masters
when we switch to `tile'. The same applies to mfact- the `ncol' layout
certainly needs a bigger mfact than `tile', for example. Finally, neither
nmaster nor mfact makes sense in non-master-slave layouts (if you still
use those, that is ;). Oh, and it would be nice if mfact increased when
nmaster increased in the `ncol' layout, too. Maybe another function
as a member of Layout, which would be executed to set mfact as a hook
whenever nmaster changes?

Since the current tile, monocle, and proposed bstack layouts are each a
special case of the mslts approach, and mslts is more powerful (and I do
think is simpler and easier to read), and if you care, mslts will likely
decrease the SLOC due to removal of duplicated code, I think mslts could
be accepted into mainline. What do you think?

> --
> Thomas Dahms
Received on Mon Oct 31 2011 - 17:11:23 CET

This archive was generated by hypermail 2.3.0 : Mon Oct 31 2011 - 17:12:03 CET