diff options
| author | Anselm R. Garbe <arg@10kloc.org> | 2006-08-23 12:08:37 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <arg@10kloc.org> | 2006-08-23 12:08:37 +0200 |
| commit | d6a6eca71d760fb3b61e35b187b9b9fd51092c71 (patch) | |
| tree | 40416b29fb7df46aa8f35a4201a49dd73d66840b | |
| parent | applied zero_to_five patch (diff) | |
| download | dwm-d6a6eca71d760fb3b61e35b187b9b9fd51092c71.tar.gz dwm-d6a6eca71d760fb3b61e35b187b9b9fd51092c71.zip | |
implemented class:inst:title matching
| -rw-r--r-- | config.arg.h | 2 | ||||
| -rw-r--r-- | config.default.h | 6 | ||||
| -rw-r--r-- | tag.c | 8 |
3 files changed, 8 insertions, 8 deletions
diff --git a/config.arg.h b/config.arg.h index d346856..70c245f 100644 --- a/config.arg.h +++ b/config.arg.h | |||
| @@ -46,7 +46,7 @@ static Key key[] = { \ | |||
| 46 | 46 | ||
| 47 | #define RULES \ | 47 | #define RULES \ |
| 48 | static Rule rule[] = { \ | 48 | static Rule rule[] = { \ |
| 49 | /* class:instance regex tags regex isfloat */ \ | 49 | /* class:instance:title regex tags regex isfloat */ \ |
| 50 | { "Firefox.*", "net", False }, \ | 50 | { "Firefox.*", "net", False }, \ |
| 51 | { "Gimp.*", NULL, True}, \ | 51 | { "Gimp.*", NULL, True}, \ |
| 52 | { "MPlayer.*", NULL, True}, \ | 52 | { "MPlayer.*", NULL, True}, \ |
diff --git a/config.default.h b/config.default.h index 453da71..c0102b0 100644 --- a/config.default.h +++ b/config.default.h | |||
| @@ -47,11 +47,11 @@ static Key key[] = { \ | |||
| 47 | { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ | 47 | { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | /* Query class:instance for regex matching info with following command: | 50 | /* Query class:instance:title for regex matching info with following command: |
| 51 | * xprop | awk -F'"' '/^WM_CLASS/ { printf "%s:%s\n", $4, $2 }'*/ | 51 | * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/{ printf("%s\n",$2) }' */ |
| 52 | #define RULES \ | 52 | #define RULES \ |
| 53 | static Rule rule[] = { \ | 53 | static Rule rule[] = { \ |
| 54 | /* class:instance regex tags regex isfloat */ \ | 54 | /* class:instance:title regex tags regex isfloat */ \ |
| 55 | { "Firefox.*", "2", False }, \ | 55 | { "Firefox.*", "2", False }, \ |
| 56 | { "Gimp.*", NULL, True}, \ | 56 | { "Gimp.*", NULL, True}, \ |
| 57 | }; | 57 | }; |
| @@ -78,18 +78,18 @@ initrregs() | |||
| 78 | void | 78 | void |
| 79 | settags(Client *c) | 79 | settags(Client *c) |
| 80 | { | 80 | { |
| 81 | char classinst[256]; | 81 | char prop[512]; |
| 82 | unsigned int i, j; | 82 | unsigned int i, j; |
| 83 | regmatch_t tmp; | 83 | regmatch_t tmp; |
| 84 | Bool matched = False; | 84 | Bool matched = False; |
| 85 | XClassHint ch; | 85 | XClassHint ch; |
| 86 | 86 | ||
| 87 | if(XGetClassHint(dpy, c->win, &ch)) { | 87 | if(XGetClassHint(dpy, c->win, &ch)) { |
| 88 | snprintf(classinst, sizeof(classinst), "%s:%s", | 88 | snprintf(prop, sizeof(prop), "%s:%s:%s", |
| 89 | ch.res_class ? ch.res_class : "", | 89 | ch.res_class ? ch.res_class : "", |
| 90 | ch.res_name ? ch.res_name : ""); | 90 | ch.res_name ? ch.res_name : "", c->name); |
| 91 | for(i = 0; !matched && i < len; i++) | 91 | for(i = 0; !matched && i < len; i++) |
| 92 | if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) { | 92 | if(rreg[i].clregex && !regexec(rreg[i].clregex, prop, 1, &tmp, 0)) { |
| 93 | c->isfloat = rule[i].isfloat; | 93 | c->isfloat = rule[i].isfloat; |
| 94 | for(j = 0; rreg[i].tregex && j < ntags; j++) { | 94 | for(j = 0; rreg[i].tregex && j < ntags; j++) { |
| 95 | if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { | 95 | if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { |
