dwm-meillo

changeset 336:2a65e8b3d21a

implemented class:inst:title matching
author Anselm R. Garbe <arg@10kloc.org>
date Wed, 23 Aug 2006 12:08:37 +0200
parents aca8281c7415
children c4c9e2dad45c
files config.arg.h config.default.h tag.c
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/config.arg.h	Wed Aug 23 12:03:25 2006 +0200
     1.2 +++ b/config.arg.h	Wed Aug 23 12:08:37 2006 +0200
     1.3 @@ -46,7 +46,7 @@
     1.4  
     1.5  #define RULES \
     1.6  static Rule rule[] = { \
     1.7 -	/* class:instance regex		tags regex	isfloat */ \
     1.8 +	/* class:instance:title regex	tags regex	isfloat */ \
     1.9  	{ "Firefox.*",			"net",		False }, \
    1.10  	{ "Gimp.*",			NULL,		True}, \
    1.11  	{ "MPlayer.*",			NULL,		True}, \
     2.1 --- a/config.default.h	Wed Aug 23 12:03:25 2006 +0200
     2.2 +++ b/config.default.h	Wed Aug 23 12:08:37 2006 +0200
     2.3 @@ -47,11 +47,11 @@
     2.4  	{ MODKEY|ShiftMask,		XK_q,		quit,		{ 0 } }, \
     2.5  };
     2.6  
     2.7 -/* Query class:instance for regex matching info with following command:
     2.8 - * xprop | awk -F'"' '/^WM_CLASS/ { printf "%s:%s\n", $4, $2 }'*/
     2.9 +/* Query class:instance:title for regex matching info with following command:
    2.10 + * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/{ printf("%s\n",$2) }' */
    2.11  #define RULES \
    2.12  static Rule rule[] = { \
    2.13 -	/* class:instance regex		tags regex	isfloat */ \
    2.14 +	/* class:instance:title regex	tags regex	isfloat */ \
    2.15  	{ "Firefox.*",			"2",		False }, \
    2.16  	{ "Gimp.*",			NULL,		True}, \
    2.17  };
     3.1 --- a/tag.c	Wed Aug 23 12:03:25 2006 +0200
     3.2 +++ b/tag.c	Wed Aug 23 12:08:37 2006 +0200
     3.3 @@ -78,18 +78,18 @@
     3.4  void
     3.5  settags(Client *c)
     3.6  {
     3.7 -	char classinst[256];
     3.8 +	char prop[512];
     3.9  	unsigned int i, j;
    3.10  	regmatch_t tmp;
    3.11  	Bool matched = False;
    3.12  	XClassHint ch;
    3.13  
    3.14  	if(XGetClassHint(dpy, c->win, &ch)) {
    3.15 -		snprintf(classinst, sizeof(classinst), "%s:%s",
    3.16 +		snprintf(prop, sizeof(prop), "%s:%s:%s",
    3.17  				ch.res_class ? ch.res_class : "",
    3.18 -				ch.res_name ? ch.res_name : "");
    3.19 +				ch.res_name ? ch.res_name : "", c->name);
    3.20  		for(i = 0; !matched && i < len; i++)
    3.21 -			if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) {
    3.22 +			if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) {
    3.23  				c->isfloat = rule[i].isfloat;
    3.24  				for(j = 0; rreg[i].tregex && j < ntags; j++) {
    3.25  					if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) {