index.md - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
index.md (1937B) | |
--- | |
1 Remove application defaults from config.h | |
2 ========================================= | |
3 The rules array is initialized, by default, to treat windows of class `G… | |
4 and `Firefox` in a special way. If, like me, you don't want any applicat… | |
5 be treated in a special way, you must be careful when editing the rules … | |
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 isfl… | |
13 { "Gimp", NULL, NULL, 0, True… | |
14 { "Firefox", NULL, NULL, 1 << 8, True… | |
15 }; | |
16 | |
17 For instance, Gimp and Firefox will be labeled as floating windows, even… | |
18 layout selected is Monocle or Tiled. In particular, the tag mask will at… | |
19 Firefox to tag '9'. | |
20 | |
21 If we don't want any window class to be treated in a special way, we nee… | |
22 initialize rules with at least one element: | |
23 | |
24 static Rule rules[] = { | |
25 /* class instance title tags mask isfl… | |
26 { NULL, NULL, NULL, 0, Fals… | |
27 }; | |
28 | |
29 The code in dwm.c will check that the `class` element is not NULL before… | |
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… | |
38 && (!r->instance || (ch.res_name && strs… | |
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… | |
45 rule that does not match will apply to all window classes. Therefore, th… | |
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. |