Re: [dwm] Border hater, border lover

From: Sunnan <sunnan_AT_handgranat.org>
Date: Sun, 03 Aug 2008 13:36:58 +0200

Well, I've experienced some buggy behavior and I have no idea what the
problem might be and if it's because of this hack or not. The
behaviour is that sometimes I'll have two clients visible (one per tag
and both tags visible) and then both try to be master, one taking up
mh (I'm using bstack) and one taking up wh-mh but both starting at the
top of the screen.

Anyway, I found a nicer-looking (???) way to code my original
suggestion; instead of:
        if(n==1)
          resize(c, wx-c->bw, wy-c->bw, ww, wh, False);
        else
          resize(c, wx, wy, ww - 2 * c->bw, mh - 2 * c->bw, resizehints);

        if(--n == 0)
                return;

The two checks can be folded into one, like this:

        if (--n == 0) {
          resize(c, wx-c->bw, wy-c->bw, ww, wh, resizehints);
          return;
        }
        resize(c, wx, wy, ww - 2 * c->bw, mh - 2 * c->bw, resizehints);

the guard clause allowing us to eliminate the else.
The weird behavior is the same with both versions, though... wonder
what I've done wrong.

Btw, there's a huge amount of "- 2 * c->bw" in dwm; maybe this could
be extracted to a function or macro?

I've got a lisp background so I never want two sexps looking the same;
and when I try to write C (with mediocre results) I tend to think of
the syntax tree nodes as sexps, too.

I'd love it if this automatic border toggling becomes mainstream,
though! Thanks for your attention.

Sunnan

At Sun, 3 Aug 2008 10:56:20 +0100,
Anselm R Garbe wrote:
>
> You remember me that I considered this for mainstream dwm a while ago,
> but forgot about it. Since all tiled windows are restacked under the
> bar window, I don't see any flaws in this solution. The usual way of
> doing it, would be to set the c->bw to 0 in such a case, but some
> clients perform poorly with this, so I really like this particular
> solution.
>
> Any objections in making this mainstream?
>
> Kind regards,
> Anselm
>
> 2008/8/2 Sunnan <sunnan_AT_handgranat.org>:
> > I didn't want to set border size to 0 because I do like them when I
> > have more then one client on the screen at the same time, but I don't
> > want them when I just have one.
> >
> > So I suggest something like this:
> >
> > in monocle:
> > resize(c, wx-c->bw, wy-c->bw, ww, wh, False);
> >
> > (as per Alexander Polakov's suggestion that I found in this list's archives.)
> >
> > in tile:
> > if(n==1)
> > resize(c, wx-c->bw, wy-c->bw, ww, wh, False);
> > else
> > resize(c, wx, wy, mw - 2 * c->bw, wh - 2 * c->bw, resizehints);
> >
> > in bstack:
> > (I love bstack (maybe because I hate widescreen) and I hardly ever use the regular tile mode.)
> >
> > if(n==1)
> > resize(c, wx-c->bw, wy-c->bw, ww, wh, False);
> > else
> > resize(c, wx, wy, ww - 2 * c->bw, mh - 2 * c->bw, resizehints);
> >
> > Ugh, I'd rather fold those if/elses back into one with ternaries, but
> > then we'd need three conditionals instead of one. (Which the compiler
> > would probably catch, anyway...)
> >
> > So, in closing:
> > I love dwm (just switched to the main branch from good old
> > dwm-4.6-rfigura once I realized that bstack was available as a patch) and
> > this is my first post to this list.
> >
> > I hope that this functionality can go into main; it doesn't increase
> > the mental load on the user (like toggleborders or a config option
> > would) since it happens automatically, but if you don't like it, I'll
> > understand.
> >
> > Sunnan
>
Received on Sun Aug 03 2008 - 11:36:58 UTC

This archive was generated by hypermail 2.2.0 : Sun Aug 03 2008 - 11:48:04 UTC