Re: [dwm] Update: bottomstack patch for latest 4.4 tip
On Sun, Aug 12, 2007 at 07:57:15PM +0200, Anselm R. Garbe wrote: > On Sun, Aug 12, 2007 at 10:12:14AM -0400, James Turner wrote: > > I went ahead and created a new patch that patches tile.c rather then > > creating an all new bstack layout. You can find it here: > > http://calminferno.net/files/dwm-4.4-bstack-tile.diff or attached. > > Well I accept you decision, but I think it might be worth to > consider to design a bigtile layout as a tile.c replacement, > which contains your bstack feature, the NMASTER revival, and > maybe other things. I think that should be the direction, it > would even make maintenance of patches much more simplier. > > So consider to design the bstack patch as a tile replacement > rather than as a tile-addon/extension... Sorry, my English is a nightmare today ;) -- Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Re: [dwm] Update: bottomstack patch for latest 4.4 tip
On Sun, Aug 12, 2007 at 10:12:14AM -0400, James Turner wrote: > I went ahead and created a new patch that patches tile.c rather then > creating an all new bstack layout. You can find it here: > http://calminferno.net/files/dwm-4.4-bstack-tile.diff or attached. Well I accept you decision, but I think it might be worth to consider to design a bigtile layout as a tile.c replacement, which contains your bstack feature, the NMASTER revival, and maybe other things. I think that should be the direction, it would even make maintenance of patches much more simplier. So consider to design the bstack patch as a tile replacement rather than as a tile-addon/extension... Regards, -- Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Re: [dwm] Update: bottomstack patch for latest 4.4 tip
On Sun, Aug 12, 2007 at 08:42:47AM -0400, James Turner wrote: > On Sun, Aug 12, 2007 at 12:53:46PM +0200, Anselm R. Garbe wrote: > > On Sat, Aug 11, 2007 at 08:09:54PM -0400, James Turner wrote: > > > Well the zoom function seems to work, but increasing the master area > > > does not. I changed part of the incmaster function within tile.c to > > > if(lt->arrange == floating) return; but I still can't increase the > > > master in the bottom stack layout mode. Any ideas? > > > > > > Well I decided against making master global. I pushed a > > changeset recently with following decisions: > > > > MASTER is renamed to MWFACT (master width factor) - which is > > more precise. > > > > master in tile.c is renamed to mwfact, incmaster is renamed to > > addtomwfact - which is also more precise. > > > > So this change also points out, that your bstack patch should > > contain something like MHFACT (master height factor) as counter > > part. Except of zoom(), which you can re-use from tile, I > > propose you clone the addtomwfact() behavior as follows for > > bstack: > > > > > > /* static */ > > > > static double mhfact = MHFACT; > > > > /* extern */ > > > > void > > addtomhfact(const char *arg) { > > double delta; > > > > if(lt->arrange != bstack) > > return; > > > > /* arg handling, manipulate mhfact */ > > if(arg && (1 == sscanf(arg, "%lf", &delta))) { > > if(delta + mhfact > 0.1 && delta + mhfact < 0.9) > > mhfact += delta; > > } > > lt->arrange(); > > } > > > > > > And in config.h you add something like this (besides cloning > > MHFACT similiar to MWFACT): > > > > > > { MODKEY, XK_h, addtomwfact,"-0.05" }, \ > > { MODKEY, XK_l, addtomhfact,"0.05" } , \ > > { MODKEY, XK_h, addtomwfact,"-0.05" }, \ > > { MODKEY, XK_l, addtomhfact,"0.05" } , \ > > > > > > This is somewhat cumbersome for bstack, but the only other > > option would be to design bstack as patch to tile.c. > > > > Regards, > > -- > > Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361 > > Because of the nature of bstack, would it make more sense to just patch > tile.c rather than make it it's own layout and clone the addtowfact > function? Since changes are still happening I would like to take this > time to make sure the patch is done the so called "correct" way. > Thanks. > > -- > James Turner > BSD Group Consulting > http://www.bsdgroup.org I went ahead and created a new patch that patches tile.c rather then creating an all new bstack layout. You can find it here: http://calminferno.net/files/dwm-4.4-bstack-tile.diff or attached. -- James Turner BSD Group Consulting http://www.bsdgroup.org --- config.arg.hSun Aug 12 05:19:58 2007 +++ config.arg.hSun Aug 12 04:45:43 2007 @@ -30,6 +30,7 @@ static Layout layout[] = { \ /* symbol function */ \ { "[]=",tile }, /* first entry is default */ \ { "><>",floating }, \ + { "TTT",bstack }, \ }; #define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */ #define SNAP 32 /* snap pixel */ --- config.default.hSun Aug 12 05:19:58 2007 +++ config.default.hSun Aug 12 04:45:57 2007 @@ -31,6 +31,7 @@ static Layout layout[] = { \ /* symbol function */ \ { "[]=",tile }, /* first entry is default */ \ { "><>",floating }, \ + { "TTT",bstack }, \ }; #define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */ #define SNAP 32 /* snap pixel */ --- tile.c Sun Aug 12 05:19:58 2007 +++ tile.c Sun Aug 12 05:20:19 2007 @@ -12,7 +12,7 @@ void addtomwfact(const char *arg) { double delta; - if(lt->arrange != tile) + if(lt->arrange == floating) return; /* arg handling, manipulate mwfact */ @@ -63,6 +63,53 @@ tile(void) { resize(c, nx, ny, nw, nh, False); if(n > 1 && th != wah) ny += nh + 2 * c->border; + i++; + } + else + ban(c); + focus(NULL); + restack(); +} + +void +bstack(void) { + unsigned int i, n, nx, ny, nw, nh, mw, 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); + mw = waw; + th = (n > 1) ? (wah * (1 - mwfact)) / 1 : 0; + tw = (n > 1) ? waw / (n - 1) : 0; + + for(i = 0, c = clients; c; c = c->next) + if(isvisible(c)) { + unban(c); + if(c->isfloating
Re: [dwm] Update: bottomstack patch for latest 4.4 tip
On Sun, Aug 12, 2007 at 12:53:46PM +0200, Anselm R. Garbe wrote: > On Sat, Aug 11, 2007 at 08:09:54PM -0400, James Turner wrote: > > Well the zoom function seems to work, but increasing the master area > > does not. I changed part of the incmaster function within tile.c to > > if(lt->arrange == floating) return; but I still can't increase the > > master in the bottom stack layout mode. Any ideas? > > > Well I decided against making master global. I pushed a > changeset recently with following decisions: > > MASTER is renamed to MWFACT (master width factor) - which is > more precise. > > master in tile.c is renamed to mwfact, incmaster is renamed to > addtomwfact - which is also more precise. > > So this change also points out, that your bstack patch should > contain something like MHFACT (master height factor) as counter > part. Except of zoom(), which you can re-use from tile, I > propose you clone the addtomwfact() behavior as follows for > bstack: > > > /* static */ > > static double mhfact = MHFACT; > > /* extern */ > > void > addtomhfact(const char *arg) { > double delta; > > if(lt->arrange != bstack) > return; > > /* arg handling, manipulate mhfact */ > if(arg && (1 == sscanf(arg, "%lf", &delta))) { > if(delta + mhfact > 0.1 && delta + mhfact < 0.9) > mhfact += delta; > } > lt->arrange(); > } > > > And in config.h you add something like this (besides cloning > MHFACT similiar to MWFACT): > > > { MODKEY, XK_h, addtomwfact,"-0.05" }, \ > { MODKEY, XK_l, addtomhfact,"0.05" } , \ > { MODKEY, XK_h, addtomwfact,"-0.05" }, \ > { MODKEY, XK_l, addtomhfact,"0.05" } , \ > > > This is somewhat cumbersome for bstack, but the only other > option would be to design bstack as patch to tile.c. > > Regards, > -- > Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361 Because of the nature of bstack, would it make more sense to just patch tile.c rather than make it it's own layout and clone the addtowfact function? Since changes are still happening I would like to take this time to make sure the patch is done the so called "correct" way. Thanks. -- James Turner BSD Group Consulting http://www.bsdgroup.org
Re: [dwm] Update: bottomstack patch for latest 4.4 tip
On Sat, Aug 11, 2007 at 08:09:54PM -0400, James Turner wrote: > Well the zoom function seems to work, but increasing the master area > does not. I changed part of the incmaster function within tile.c to > if(lt->arrange == floating) return; but I still can't increase the > master in the bottom stack layout mode. Any ideas? Well I decided against making master global. I pushed a changeset recently with following decisions: MASTER is renamed to MWFACT (master width factor) - which is more precise. master in tile.c is renamed to mwfact, incmaster is renamed to addtomwfact - which is also more precise. So this change also points out, that your bstack patch should contain something like MHFACT (master height factor) as counter part. Except of zoom(), which you can re-use from tile, I propose you clone the addtomwfact() behavior as follows for bstack: /* static */ static double mhfact = MHFACT; /* extern */ void addtomhfact(const char *arg) { double delta; if(lt->arrange != bstack) return; /* arg handling, manipulate mhfact */ if(arg && (1 == sscanf(arg, "%lf", &delta))) { if(delta + mhfact > 0.1 && delta + mhfact < 0.9) mhfact += delta; } lt->arrange(); } And in config.h you add something like this (besides cloning MHFACT similiar to MWFACT): { MODKEY, XK_h, addtomwfact,"-0.05" }, \ { MODKEY, XK_l, addtomhfact,"0.05" } , \ { MODKEY, XK_h, addtomwfact,"-0.05" }, \ { MODKEY, XK_l, addtomhfact,"0.05" } , \ This is somewhat cumbersome for bstack, but the only other option would be to design bstack as patch to tile.c. Regards, -- Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Re: [dwm] Update: bottomstack patch for latest 4.4 tip
> On Sat, Aug 11, 2007 at 08:09:54PM -0400, James Turner wrote: > > Well the zoom function seems to work, but increasing the master area > > does not. I changed part of the incmaster function within tile.c to > > if(lt->arrange == floating) return; but I still can't increase the > > master in the bottom stack layout mode. Any ideas? I was wondering about this just yesterday. 1. you can implement your own master logic in your bstack.c like tile does. 2. you can bind the commands you'll need to modify these to the same key in config.h 3. no way to safe code here but i still like it better. cu - robert figura --
Re: [dwm] Update: bottomstack patch for latest 4.4 tip
On Sat, Aug 11, 2007 at 08:09:54PM -0400, James Turner wrote: > Well the zoom function seems to work, but increasing the master area > does not. I changed part of the incmaster function within tile.c to > if(lt->arrange == floating) return; but I still can't increase the > master in the bottom stack layout mode. Any ideas? The problem here is, that master is declared static in tile.o, so whenever you call incmaster it is only used in tile(). In bstack() you use the locally declared master in bstack.c instead ,) This all is due the fact that bstack is more a patch to tile than a separate layout. One solution I see would be to declare master globally in tile.h, - but this would make your patch dependend from tile... hmm. Let me think about this issue somewhat more. Regards, -- Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Re: [dwm] Update: bottomstack patch for latest 4.4 tip
Well the zoom function seems to work, but increasing the master area does not. I changed part of the incmaster function within tile.c to if(lt->arrange == floating) return; but I still can't increase the master in the bottom stack layout mode. Any ideas? On Aug 11, 2007, at 6:58 PM, James Turner wrote: Quick note just in case, use patch -p0 < dwm-4.4-bstack.diff within the dwm source dir to apply. On Aug 11, 2007, at 6:53 PM, James Turner wrote: I've gone ahead and updated the bottom stack patch to work with the new 4.4 tip. I just ported the portrait layout since that's all I use. Please test this against the latest tip. One question for you C hackers, how to I get the incmaster and zoom functions with in the tile.c to work with my new bstack.c? Also any suggestions ore always welcome. Patch here: http://calminferno.net/files/dwm-4.4-bstack.diff and attached. -- James Turner BSD Group Consulting http://www.bsdgroup.org -- James Turner BSD Group Consulting http://www.bsdgroup.org -- James Turner BSD Group Consulting http://www.bsdgroup.org
Re: [dwm] Update: bottomstack patch for latest 4.4 tip
Quick note just in case, use patch -p0 < dwm-4.4-bstack.diff within the dwm source dir to apply. On Aug 11, 2007, at 6:53 PM, James Turner wrote: I've gone ahead and updated the bottom stack patch to work with the new 4.4 tip. I just ported the portrait layout since that's all I use. Please test this against the latest tip. One question for you C hackers, how to I get the incmaster and zoom functions with in the tile.c to work with my new bstack.c? Also any suggestions ore always welcome. Patch here: http://calminferno.net/files/dwm-4.4-bstack.diff and attached. -- James Turner BSD Group Consulting http://www.bsdgroup.org -- James Turner BSD Group Consulting http://www.bsdgroup.org
[dwm] Update: bottomstack patch for latest 4.4 tip
I've gone ahead and updated the bottom stack patch to work with the new 4.4 tip. I just ported the portrait layout since that's all I use. Please test this against the latest tip. One question for you C hackers, how to I get the incmaster and zoom functions with in the tile.c to work with my new bstack.c? Also any suggestions ore always welcome. Patch here: http://calminferno.net/files/dwm-4.4-bstack.diff and attached. -- James Turner BSD Group Consulting http://www.bsdgroup.org --- bstack.cWed Dec 31 19:00:00 1969 +++ bstack.cSat Aug 11 14:40:27 2007 @@ -0,0 +1,56 @@ +/* See LICENSE file for copyright and license details. */ +#include "dwm.h" + +/* static */ + +static double master = MASTER; + +/* extern */ + +void +bstack(void) { + unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; + Client *c; + + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) + n++; + + /* window geoms */ + mh = (n > 1) ? (wah * master) / 1 : wah / (n > 0 ? n : 1); + mw = waw; + th = (n > 1) ? (wah * (1 - master)) / 1 : 0; + tw = (n > 1) ? waw / (n - 1) : 0; + + for(i = 0, c = clients; c; c = c->next) +if(isvisible(c)) { + unban(c); + if(c->isfloating) +continue; + c->ismax = False; + nx = wax; + ny = way; + if(i < 1) { +ny += i * mh; +nw = mw - 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, False); + i++; +} +else + ban(c); + if(!sel || !isvisible(sel)) +focus(NULL); + restack(); +} --- bstack.hWed Dec 31 19:00:00 1969 +++ bstack.hSat Aug 11 13:30:37 2007 @@ -0,0 +1,4 @@ +/* See LICENSE file for copyright and license details. */ + +/* bstack.c */ +void bstack(void); /* arranges all windows bottom stacked */ --- config.arg.hSat Aug 11 11:38:26 2007 +++ config.arg.hSat Aug 11 12:00:41 2007 @@ -26,11 +26,13 @@ static Rule rule[] = { \ /* layout(s) */ #include "tile.h" #include "float.h" +#include "bstack.h" #define LAYOUTS \ static Layout layout[] = { \ /* symbol function */ \ { "[]=",tile }, /* first entry is default */ \ { "><>",floating }, \ + { "TTT",bstack }, \ }; #define MASTER 0.6 /* 0.1 .. 0.9 */ #define SNAP 32 /* snap pixel */ --- config.default.hSat Aug 11 11:38:26 2007 +++ config.default.hSat Aug 11 12:00:19 2007 @@ -27,11 +27,13 @@ static Rule rule[] = { \ /* layout(s) */ #include "tile.h" #include "float.h" +#include "bstack.h" #define LAYOUTS \ static Layout layout[] = { \ /* symbol function */ \ { "[]=",tile }, /* first entry is default */ \ { "><>",floating }, \ + { "TTT",bstack }, \ }; #define MASTER 0.6 /* 0.1 .. 0.9 */ #define SNAP 32 /* snap pixel */ --- config.mk Sat Aug 11 11:38:26 2007 +++ config.mk Sat Aug 11 11:59:46 2007 @@ -4,7 +4,7 @@ VERSION = 4.4 # Customize below to fit your system # layouts -SRC = float.c tile.c +SRC = float.c tile.c bstack.c # paths PREFIX = /usr/local