Re: [dev] [dwm] default window attaching behaviour

From: Mateusz Okulus <>
Date: Mon, 29 Nov 2021 13:23:22 +0100

On 21/11/29 06:25PM, dther wrote:
> I've been thinking about dwm's default behaviours, and one of them
> that's always confused me is how newly attached windows, by default,
> launch as the "master". Why is this the case? Intuitively, when I begin
> working, I launch the most important program first, and launch new
> programs as I need them. I'd imagine at least 50% of people follow this
> strategy of launching new windows as well. In general, older windows
> are more "important". Why displace not only the master client,
> but the *entire stack*, for the window least likely to remain useful?
> I realise that this is a problem that can be easily solved with a patch
> (and, in fact, I use attachbelow for this reason), but given how common
> (I imagine) the above strategy is, my question is-
> would it be reasonable for dwm's master branch include some way to toggle
> an alternative "attachbottom" strategy?
> I'd also like to know if I'm correct about my assumptions.
> Do give thoughts if your "window initialisation"
> thought process is completely different from mine.

As you say you launch new programs as you need them. This means the
launched program should have highest priority because you want to use it
right now.

Older windows are more long lived and important, but in the moment you
want your attention on the new window. It'll be probably a short lived
one too, so you want to open it, do something with it, then close it.

I'm not quite sure what do you mean by displacing the entire stack. I'd
assume you mean the fact that windows are displayed from to bottom of
the stack, so when you add a new windows all windows shift by one place.
This might be confusing, but only if you open the window for later use.

You'd need to be more specific about your use cases. The way I use it is
to launch long lived windows first, and then when I need to change
volume or change music I have a hotkey that opens a terminal with
appropriate program. I want it to be the master, so I can make some
quick changes and close it, and get back to what I was doing. If it
launched at the bottom I'd need to switch to it, make it fullscreen or
new master manually and shortly after close it.

If you mean instead the process of initial initialization of several
long lived programs then attaching to bottom might be helpful. If I
wanted to have a terminal with vim and some other application always
opened I'd probably do it in this order and then I'd need to swap them.

I personally treat tags as workspaces and rarely have more than one
window per tag. I prefer to use tmux, vim windows etc. If I didn't use
tmux, I'd need to have ~6 terminals opened in one "workspace". I'd
probably open them from first to last, but then dwm would place them
from last to first. It would probably get annoying quickly, and I'd
switch it as you did. If I wanted to launch a short lived program I
wouldn't have a problem with additional key chord to go from master to
last window. Even with a bigger screen I'd probably need to make it a
new master or fullscreen it, but it wouldn't be so bad, if done rarely.

I'd guess most people don't start that many windows per view, so the
benefit of new programs being new masters outweighs the reversed order
when launching many programs at once initially.

If my assumptions are correct, I'd reconsider if you really need that
many programs opened in one view. I'd split programs between tags and
use solutions like tmux or built-in windows.

All that being said, it was probably just for consistency. You'd
expect new windows to go on the top of the stack, not the bottom.
Whether it'd be better for most workflows probably wasn't even


Received on Mon Nov 29 2021 - 13:23:22 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 29 2021 - 14:24:08 CET