index.md (1937B)
1 Remove application defaults from config.h 2 ========================================= 3 The rules array is initialized, by default, to treat windows of class `Gimp` 4 and `Firefox` in a special way. If, like me, you don't want any application to 5 be treated in a special way, you must be careful when editing the rules array 6 initialization code. 7 8 The original code describes what each value represents within the Rule 9 structure. 10 11 static Rule rules[] = { 12 /* class instance title tags mask isfloating monitor */ 13 { "Gimp", NULL, NULL, 0, True, -1 }, 14 { "Firefox", NULL, NULL, 1 << 8, True, -1 }, 15 }; 16 17 For instance, Gimp and Firefox will be labeled as floating windows, even if the 18 layout selected is Monocle or Tiled. In particular, the tag mask will attach 19 Firefox to tag '9'. 20 21 If we don't want any window class to be treated in a special way, we need to 22 initialize rules with at least one element: 23 24 static Rule rules[] = { 25 /* class instance title tags mask isfloating monitor */ 26 { NULL, NULL, NULL, 0, False, -1 }, 27 }; 28 29 The code in dwm.c will check that the `class` element is not NULL before any 30 matching is done. 31 32 /* rule matching */ 33 XGetClassHint(dpy, c->win, &ch); 34 for(i = 0; i < LENGTH(rules); i++) { 35 r = &rules[i]; 36 if((!r->title || strstr(c->name, r->title)) 37 && (!r->class || (ch.res_class && strstr(ch.res_class, r->class))) 38 && (!r->instance || (ch.res_name && strstr(ch.res_name, r->instance)))) { 39 c->isfloating = r->isfloating; 40 c->tags |= r->tags & TAGMASK; 41 } 42 } 43 44 This code assumes the rules array has at least one element, and that the first 45 rule that does not match will apply to all window classes. Therefore, the rule 46 we just made, is the default rule for all new windows and therefore it is 47 important you set the `tags mask` and `isfloating` elements correctly.