Re: [dwm] remembering client order in each tag

From: Anselm R. Garbe <>
Date: Thu, 7 Sep 2006 11:44:52 +0200

On Thu, Sep 07, 2006 at 11:29:34AM +0200, Sander van Dijk wrote:
> On 9/7/06, Anselm R. Garbe <> wrote:
> >> This is almost okay, especially when you have more than two clients.
> >> However, with only two clients that overlap (say the editor and plot
> >> window I mentioned before) this can be annoying.
> >>
> >> However, I am not going to insist on fixing this.
> >
> >I see what you notice. I'll think further about it. I believe
> >there must be a solution which is not coincident.
> You're still fixing it in the wrong place. The order of clients in the
> clientlist has nothing to do with z-ordering. When dwm switches to a
> view that doesn't contain the previously focused client, it
> (arrange(), to be specific) focuses and raises a new client. That's
> correct behavior, but what's currently suboptimal is it's client
> picking policy. Right now, it just picks the first visible client in
> clients. What it should do instead is:
> a: pick the first tiled client (= mastertile) if there is one.
> b: pick the topmost in z-order client (which makes more sense than
> picking the first one in the clientlist in floating mode anyway) if
> there is one.
> c: else focus the root-window.

This focus policy is fine with me, however there is no
information about the topmost z-order client if the clientlist
does not contain any information about this. Thus b) is a
nice-to-have but ugly to achieve requirement. Actually one would
need to query the X window tree to get the top most client which
really sucks and is quite inperformant. I see a solution to keep
track of this info in a more elegant way. If we'd extend Client
with a pointer:

        Client *snext;

We'd have a single linked list which could keep track of focus
history. on any focus, a client must be pop'ed on this stack.
focusnext/focusprev won't be affected, this stack would only be
used in arrange() to focus the top-most client.

What do you think?


 Anselm R. Garbe  ><><  ><><  GPG key: 0D73F361
Received on Thu Sep 07 2006 - 11:44:52 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:31:04 UTC