Re: [dwm] Bottom stack update

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Sat, 22 Sep 2007 21:44:29 +0200

On Sat, Sep 22, 2007 at 03:27:56PM -0400, James Turner wrote:
> Attached is an updated patch for the bottom stack layout. The setmhfact
> and bzoom functions can be removed once the normal setmwfact and zoom
> function are updated to use isarrange(floating) mentioned in a previous
> email. Let me know of any issues.

I pushed this change into hg tip. setmwfact and zoom use
isarrange(floating) instead - though this is not satisfactory,
because of possible different layouts like grid which
might now allow to change mwfact without effect..

Maybe a macro for this check might be the better choice, so the
user can decide, which layouts should have influence on zoom and
setmwfact, without the need to rename it...

Regards,
        Anselm

> --
> James Turner
> BSD Group Consulting
> http://www.bsdgroup.org

> --- bstack.c Wed Dec 31 19:00:00 1969
> +++ bstack.c Sat Sep 22 15:10:39 2007
> @@ -0,0 +1,73 @@
> +void
> +bstack(void) {
> + unsigned int i, n, nx, ny, nw, nh, mh, tw, th;
> + Client *c;
> +
> + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
> + n++;
> +
> + /* window geoms */
> + mh = (n > 1) ? (wah * mwfact) / 1 : wah / (n > 0 ? n : 1);
> + th = (n > 1) ? (wah * (1 - mwfact)) / 1 : 0;
> + tw = (n > 1) ? waw / (n - 1) : 0;
> +
> + for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
> + c->ismax = False;
> + nx = wax;
> + ny = way;
> + if(i < 1) {
> + ny += i * mh;
> + nw = waw - 2 * c->border;
> + nh = mh - 2 * c->border;
> + }
> + else {
> + nx += (i - 1) * tw;
> + ny += mh * 1;
> + if(i + 1 == n) { /* remainder */
> + nw = (wax + waw) - nx - 2 * c->border;
> + }
> + else {
> + nw = tw - 2 * c->border;
> + }
> + nh = th - 2 * c->border + 1;
> + }
> + resize(c, nx, ny, nw, nh, RESIZEHINTS);
> + }
> +}
> +
> +void
> +setmhfact(const char *arg) {
> + double delta;
> +
> + if(!isarrange(bstack))
> + return;
> + /* arg handling, manipulate mwfact */
> + if(arg == NULL)
> + mwfact = MWFACT;
> + else if(1 == sscanf(arg, "%lf", &delta)) {
> + if(arg[0] == '+' || arg[0] == '-')
> + mwfact += delta;
> + else
> + mwfact = delta;
> + if(mwfact < 0.1)
> + mwfact = 0.1;
> + else if(mwfact > 0.9)
> + mwfact = 0.9;
> + }
> + arrange();
> +}
> +
> +void
> +bzoom(const char *arg) {
> + Client *c;
> +
> + if(!sel || !isarrange(bstack) || sel->isfloating)
> + return;
> + if((c = sel) == nexttiled(clients))
> + if(!(c = nexttiled(c->next)))
> + return;
> + detach(c);
> + attach(c);
> + focus(c);
> + arrange();
> +}
> --- config.h Sat Sep 22 03:11:13 2007
> +++ config.h Sat Sep 22 15:11:09 2007
> @@ -21,14 +21,16 @@ Rule rules[] = {
> { "Acroread", NULL, True },
> };
>
> +#define RESIZEHINTS True /* False - respect size hints in tiled resizals */
> +#define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */
> /* layout(s) */
> +#include "bstack.c"
> Layout layouts[] = {
> /* symbol function */
> { "[]=", tile }, /* first entry is default */
> { "><>", floating },
> + { "TTT", bstack },
> };
> -#define RESIZEHINTS True /* False - respect size hints in tiled resizals */
> -#define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */
> #define SNAP 32 /* snap pixel */
>
> /* key definitions */
> @@ -47,8 +49,11 @@ Key keys[] = { \
> { MODKEY, XK_k, focusprev, NULL }, \
> { MODKEY, XK_h, setmwfact, "-0.05" }, \
> { MODKEY, XK_l, setmwfact, "+0.05" }, \
> + { MODKEY, XK_h, setmhfact, "-0.05" }, \
> + { MODKEY, XK_l, setmhfact, "+0.05" }, \
> { MODKEY, XK_m, togglemax, NULL }, \
> { MODKEY, XK_Return, zoom, NULL }, \
> + { MODKEY, XK_Return, bzoom, NULL }, \
> { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \
> { MODKEY|ShiftMask, XK_c, killclient, NULL }, \
> { MODKEY, XK_0, view, NULL }, \

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Sat Sep 22 2007 - 21:44:29 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:54:35 UTC