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 .



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 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] wildcard in client rules tags ref

2008-05-13 Thread Szabolcs Nagy
On 5/14/08, Szabolcs Nagy <[EMAIL PROTECTED]> wrote:
> On 5/14/08, Eric Davis <[EMAIL PROTECTED]> wrote:
> > to say "*" so a client is on all tags.  I used this for background
>
> so class=NULL or class="" matches everything

ah sorry this is not what you want
never mind

you are right tags should match exactly



Re: [dwm] wildcard in client rules tags ref

2008-05-13 Thread Szabolcs Nagy
On 5/14/08, Eric Davis <[EMAIL PROTECTED]> wrote:
> 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.

apply rules now roughly works like:

if (!rule->class || strstr(client->class, rule->class) ..) {
[match]
}

so if class is set in the rule then any substring is matched

so class=NULL or class="" matches everything
(actually class="" matches only if client->class is set, so class=NULL
is better)



[dwm] wildcard in client rules tags ref

2008-05-13 Thread Eric Davis
Hi All,

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...?

Thanks,
- e