implemented class:inst:title matching
d6a6eca7
3 file(s) · +8 −8
| 46 | 46 | ||
| 47 | 47 | #define RULES \ |
|
| 48 | 48 | static Rule rule[] = { \ |
|
| 49 | - | /* class:instance regex tags regex isfloat */ \ |
|
| 49 | + | /* class:instance:title regex tags regex isfloat */ \ |
|
| 50 | 50 | { "Firefox.*", "net", False }, \ |
|
| 51 | 51 | { "Gimp.*", NULL, True}, \ |
|
| 52 | 52 | { "MPlayer.*", NULL, True}, \ |
| 47 | 47 | { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ |
|
| 48 | 48 | }; |
|
| 49 | 49 | ||
| 50 | - | /* Query class:instance for regex matching info with following command: |
|
| 51 | - | * xprop | awk -F'"' '/^WM_CLASS/ { printf "%s:%s\n", $4, $2 }'*/ |
|
| 50 | + | /* Query class:instance:title for regex matching info with following command: |
|
| 51 | + | * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/{ printf("%s\n",$2) }' */ |
|
| 52 | 52 | #define RULES \ |
|
| 53 | 53 | static Rule rule[] = { \ |
|
| 54 | - | /* class:instance regex tags regex isfloat */ \ |
|
| 54 | + | /* class:instance:title regex tags regex isfloat */ \ |
|
| 55 | 55 | { "Firefox.*", "2", False }, \ |
|
| 56 | 56 | { "Gimp.*", NULL, True}, \ |
|
| 57 | 57 | }; |
| 78 | 78 | void |
|
| 79 | 79 | settags(Client *c) |
|
| 80 | 80 | { |
|
| 81 | - | char classinst[256]; |
|
| 81 | + | char prop[512]; |
|
| 82 | 82 | unsigned int i, j; |
|
| 83 | 83 | regmatch_t tmp; |
|
| 84 | 84 | Bool matched = False; |
|
| 85 | 85 | XClassHint ch; |
|
| 86 | 86 | ||
| 87 | 87 | if(XGetClassHint(dpy, c->win, &ch)) { |
|
| 88 | - | snprintf(classinst, sizeof(classinst), "%s:%s", |
|
| 88 | + | snprintf(prop, sizeof(prop), "%s:%s:%s", |
|
| 89 | 89 | ch.res_class ? ch.res_class : "", |
|
| 90 | - | ch.res_name ? ch.res_name : ""); |
|
| 90 | + | ch.res_name ? ch.res_name : "", c->name); |
|
| 91 | 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 | 93 | c->isfloat = rule[i].isfloat; |
|
| 94 | 94 | for(j = 0; rreg[i].tregex && j < ntags; j++) { |
|
| 95 | 95 | if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { |