[dwm] fibonacci layout patch [update for dwm-4.9]

2008-05-15 Thread Madhu
Helu kids, the last fibonacci layout patch was for dwm-4.6:
herbst.homeunix.org/~jceb/dwm/4.6/current/dwm-4.6-fibonacci.diff
Preserving the logic of that patch, here is an updated fibonacci()
function which works with dwm-4.9 with the default `single' geometry.
It uses tilemaster() to draw the master window (so it can be resized
as usual), and leaves focus and stacking tasks to arrange(),
elsewhere.  Hopefully this can be tested and used to update the
patch for dwm-5.0 when it happens -- Guby, Madhu.

void
fibonacci(int shape) {
const float fract = 0.5;
unsigned int i, n = counttiled(), nx, ny, nw, nh;
Client *c;

if (n == 0)
return;

c = tilemaster(n);
if (--n == 0)
return;

nx = tx;
ny = ty;
nw = tw;
nh = th;

for(i = 0, c = nexttiled(c-next); c; c = nexttiled(c-next)) {
if((i % 2  nw / 2  2 * c-bw) || (!(i % 2)  nh / 2  2 * 
c-bw))
{
if((i+1)   n) {
if(i % 2)
nw *= fract;
else
nh *= fract;
if((i % 4) == 2  !shape)
ny += nh;
else if((i % 4) == 3  !shape)
nx += nw;
}
if((i % 4) == 0) {
if(shape)
nx += nw;
else
nx -= nw;
}
else if((i % 4) == 1)
ny += nh;
else if((i % 4) == 2)
nx += nw;
else if((i % 4) == 3) {
if(shape)
ny += nh;
else
ny -= nh;
}
if (i == 0)
nx = tx;
i++;
}
tileresize(c, nx, ny, nw - 2 * c-bw, nh - 2 * c-bw);
}
}



Re: [dwm] wildcard in client rules tags ref

2008-05-15 Thread Anselm R. Garbe
On Tue, May 13, 2008 at 09:06:22PM -0700, Eric Davis wrote:
 DWM used to support regular expressions in the tags ref for client
 rules.  I agree that the feature was overkill but it was nice to be able
 to say * so a client is on all tags.  I used this for background
 notification popups from scripts with gxmessage.
 
 Is it possible to add a simple glob indicator back to DWM that specifies
 all tags?  Or is there another way to do this that I overlooked...?

See attached patch, however I'm not sure I like this approach
for the mainstream dwm.

If you want the behavior it is possible with the following
approach already in mainstream dwm, but you might not like it:

{ NULL, gxmessage, NULL, tags[0], True },
{ NULL, gxmessage, NULL, tags[1], True },
{ NULL, gxmessage, NULL, tags[2], True },
{ NULL, gxmessage, NULL, tags[3], True },
...
{ NULL, gxmessage, NULL, tags[8], True },

Kind regards,
-- 
 Anselm R. Garbe  http://www.suckless.org/  GPG key: 0D73F361
diff -r 58a67fab8143 -r b9bb1d036bd0 dwm.c
--- a/dwm.c	Wed May 14 11:24:35 2008 +0100
+++ b/dwm.c	Thu May 15 10:47:26 2008 +0100
@@ -240,7 +240,7 @@ Window root, barwin;
 
 void
 applyrules(Client *c) {
-	unsigned int i;
+	unsigned int i, j;
 	Bool matched = False;
 	Rule *r;
 	XClassHint ch = { 0 };
@@ -254,7 +254,11 @@ applyrules(Client *c) {
 		 (!r-instance || (ch.res_name  strstr(ch.res_name, r-instance {
 			c-isfloating = r-isfloating;
 			if(r-tag) {
-c-tags[idxoftag(r-tag)] = True;
+if(r-tag[0] == '*'  r-tag[1] == 0)
+	for(j = 0; j  LENGTH(tags); i++)
+		c-tags[j] = True;
+else
+	c-tags[idxoftag(r-tag)] = True;
 matched = True;
 			}
 		}


Re: [dwm] a bottomstack and togglebar

2008-05-15 Thread Andy Nagels
A bstack plugin would totally make my day ^^

The togglebar functionality can also be accomplished with DEFGEOM:

DEFGEOM(nobar,  -bw,  0, sw,  0, 0, sw, sh, wx, wy, 0.55*sw, wh, mx+mw,
wy, ww-mw, wh,  wx, wy, ww, wh)

Greetings
Rockwolf

On Tue, 13 May 2008, Szabolcs Nagy wrote:

 a possible bottomstack or togglebar for current tip with a modified 
 updategeom()
 
 showbar: bar is visible (or invisible)
 topbar: bar position is at top (or bottom)
 verticalsplit: master/stack split is vertical (or horizontal)
 topleftmaster: master is on top/left (or bottom/right)
 
 these can be macros in config.h so compiler can optimize away the ugly
 conditions or can be ints so eg togglebar() can be implemented as
 int showbar = 1;
 void up(void) {updategeom(); updatebar(); arrange();}
 void togglebar(const char *arg) {showbar = !showbar; up();}
 
 
 void
 updategeom(void) {
   /* bar geometry */
   bx = 0;
   by = showbar ? (topbar ? 0 : sh - bh) : -bh;
   bw = sw;
 
   /* window area geometry */
   wx = sx;
   wy = showbar  topbar ? sy + bh : sy;
   ww = sw;
   wh = showbar ? sh - bh : sh;
 
   /* master area geometry */
   mw = verticalsplit ? mfact * ww : ww;
   mh = verticalsplit ? wh : mfact * wh;
   mx = verticalsplit  !topleftmaster ? wx + ww - mw : wx;
   my = !verticalsplit  !topleftmaster ? wy + wh - mh : wy;
 
   /* tile area geometry */
   tx = verticalsplit  topleftmaster ? wx + mw : wx;
   ty = !verticalsplit  topleftmaster ? wy + mh : wy;
   tw = verticalsplit ? ww - mw : ww;
   th = verticalsplit ? wh : wh - mh;
 }
 
---

-- 
 Andy Nagels 
 
 Astridlaan 29   
 
 2580 Putte  
 
 tel.: 015/756822

 mobile: 0474/827578
 
 e-mail (privat):
 [EMAIL PROTECTED]
 
+

This mail was signed using GnuPG... 
 
 You can get my public key like this 
 with gpg:   
 
 gpg --recv-keys 0x5475F368  
 if you use one of the following 
 keyservers in your gpg.conf:
 
 hkp://keyserver.veridis.com:11371/  
 hkp://subkeys.pgp.net/  
 
 or you can search for my name or
 e-mail address on   
 
 http://keyserver.veridis.com:11371/ 
 http://subkeys.pgp.net/ 


pgpKPwBz6Npky.pgp
Description: PGP signature


Re: [dwm] wildcard in client rules tags ref

2008-05-15 Thread Eric Davis
On Thu, May 15, 2008 at 11:56:02AM +0200, Anselm R. Garbe wrote:
 On Tue, May 13, 2008 at 09:06:22PM -0700, Eric Davis wrote:
  DWM used to support regular expressions in the tags ref for client
  rules.  I agree that the feature was overkill but it was nice to be able
  to say * so a client is on all tags.  I used this for background
  notification popups from scripts with gxmessage.
  
  Is it possible to add a simple glob indicator back to DWM that specifies
  all tags?  Or is there another way to do this that I overlooked...?
 
 See attached patch, however I'm not sure I like this approach
 for the mainstream dwm.
 
 If you want the behavior it is possible with the following
 approach already in mainstream dwm, but you might not like it:
 
 { NULL, gxmessage, NULL, tags[0], True },
 { NULL, gxmessage, NULL, tags[1], True },
 { NULL, gxmessage, NULL, tags[2], True },
 { NULL, gxmessage, NULL, tags[3], True },
   ...
 { NULL, gxmessage, NULL, tags[8], True },
 

Sometimes the simplest approaches are greatly overlooked!  Having the
multiple tag rules works great and I think is a good solution.

Note that, for me, you're patch caused dwm to hang.  It wouldn't take
any keyboard input and no gxmessage windows were shown... but dwm did
respond to HUP and came back to life.

Another solution which might be even better is to use dzen.

Thanks,
- e




Re: [dwm] wildcard in client rules tags ref

2008-05-15 Thread yy
2008/5/15 Eric Davis [EMAIL PROTECTED]:
 On Thu, May 15, 2008 at 11:56:02AM +0200, Anselm R. Garbe wrote:
 On Tue, May 13, 2008 at 09:06:22PM -0700, Eric Davis wrote:
  DWM used to support regular expressions in the tags ref for client
  rules.  I agree that the feature was overkill but it was nice to be able
  to say * so a client is on all tags.  I used this for background
  notification popups from scripts with gxmessage.
 
  Is it possible to add a simple glob indicator back to DWM that specifies
  all tags?  Or is there another way to do this that I overlooked...?

 See attached patch, however I'm not sure I like this approach
 for the mainstream dwm.

 If you want the behavior it is possible with the following
 approach already in mainstream dwm, but you might not like it:

 { NULL, gxmessage, NULL, tags[0], True },
 { NULL, gxmessage, NULL, tags[1], True },
 { NULL, gxmessage, NULL, tags[2], True },
 { NULL, gxmessage, NULL, tags[3], True },
   ...
 { NULL, gxmessage, NULL, tags[8], True },


 Sometimes the simplest approaches are greatly overlooked!  Having the
 multiple tag rules works great and I think is a good solution.

 Note that, for me, you're patch caused dwm to hang.  It wouldn't take
 any keyboard input and no gxmessage windows were shown... but dwm did
 respond to HUP and came back to life.

 Another solution which might be even better is to use dzen.

 Thanks,
 - e




Of course it crashed, did you correct the typo?  The i++ in the for
loop should be j++

-- 


- yiyus || JGL .