Re: [dwm] An "overlapped tiled" layout

From: Monsieur Pinocchio <cchinopio_AT_gmail.com>
Date: Sun, 8 Jun 2008 06:38:58 -0400

Oh... forgot to mention. This is over dwm-4.9.

-- 
Pinocchio
On Sun, Jun 8, 2008 at 6:36 AM, Monsieur Pinocchio <cchinopio_AT_gmail.com>
wrote:
> Hi,
>    I thought I would experiment with a new layout concept. I call it the
> "overlapped tiled" layout :) or in short tileo. I required some changes to
> restack() to make it work... though I hope this only makes restack()
> cleaner.
>    The basic concept it to overlap the windows in the stack so that
> 1) they can have a size larger than (th / n)
> 2) the windows before and after it in the stack are overlapped and stacked
> (as per X11 stacking) below the focused window in the stack area.
> The main benefit is to be able to increase the size of the focused window
> in the stack without moving them on another tag. The height of the windows
> in the stack is a constant value of th*0.8. The windows in the stack are
> overlapped like a deck of cards. The focused window is raised.
> I generally like using it in conjunction with the regular tilev() layout
> with shortcuts to switch quickly to either layout. It really helps if you
> have a large number of windows in the stack area.
>
> Here is the patch... I think the patch simplifies the restack() function so
> that should be useful to upstream in itself. Any comments are most welcome:
>
> diff -r 414f32ca9701 dwm.c
> --- a/dwm.c    Mon Mar 24 14:31:02 2008 +0000
> +++ b/dwm.c    Sun Jun 08 06:11:15 2008 -0400
> @@ -187,6 +187,7 @@ void tileh(void);
>  void tileh(void);
>  void tilehstack(unsigned int n);
>  Client *tilemaster(unsigned int n);
> +void tileo(void);
>  void tileresize(Client *c, int x, int y, int w, int h);
>  void tilev(void);
>  void tilevstack(unsigned int n);
> @@ -1308,17 +1309,13 @@ restack(void) {
>      if(sel->isfloating || lt->isfloating)
>          XRaiseWindow(dpy, sel->win);
>      if(!lt->isfloating) {
> -        wc.stack_mode = Below;
> +        wc.stack_mode = Above;
>          wc.sibling = barwin;
> -        if(!sel->isfloating) {
> -            XConfigureWindow(dpy, sel->win, CWSibling|CWStackMode, &wc);
> -            wc.sibling = sel->win;
> -        }
>          for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
> -            if(c == sel)
> -                continue;
>              XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
>              wc.sibling = c->win;
> +            if(c == sel)
> +                wc.stack_mode = Below;
>          }
>      }
>      XSync(dpy, False);
> @@ -1668,6 +1665,37 @@ tilemaster(unsigned int n) {
>  }
>
>  void
> +tileo(void) {
> +    int y, h;
> +    unsigned int i, n = counttiled();
> +    Client *c;
> +    const double ratio = 0.8;
> +
> +    if(n == 0)
> +        return;
> +    c = tilemaster(n);
> +    if(--n == 0)
> +        return;
> +
> +    y = ty;
> +    if(n > 1)
> +        h = (1-ratio) * th / (n-1);
> +    else
> +        h = th;
> +    if(h < bh)
> +        h = th;
> +
> +    for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
> +        if(i + 1 == n) /* remainder */
> +            tileresize(c, tx, y, tw - 2 * c->bw, (ty + th) - y - 2 *
> c->bw);
> +        else
> +            tileresize(c, tx, y, tw - 2 * c->bw, ratio * th - 2 * c->bw);
> +        if(h != th)
> +            y = c->y + h;
> +    }
> +}
> +
> +void
>  tileresize(Client *c, int x, int y, int w, int h) {
>      resize(c, x, y, w, h, RESIZEHINTS);
>      if((RESIZEHINTS) && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w
> > w)))
>
>
> --
> Pinocchio
Received on Sun Jun 08 2008 - 12:39:00 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:47:31 UTC