defaultlayoutpermonitor.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
defaultlayoutpermonitor.diff (1687B) | |
--- | |
1 diff --git a/config.def.h b/config.def.h | |
2 index a2ac963..7c87de8 100644 | |
3 --- a/config.def.h | |
4 +++ b/config.def.h | |
5 @@ -37,6 +37,11 @@ static const int nmaster = 1; /* number of cli… | |
6 static const int resizehints = 1; /* 1 means respect size hints in t… | |
7 static const int lockfullscreen = 1; /* 1 will force focus on the fulls… | |
8 | |
9 +static const int lpm[] = { | |
10 + /* Index of preferred layout], if LENGTH(lpm)<#monitors -> defa… | |
11 + 0, 1 | |
12 +}; | |
13 + | |
14 static const Layout layouts[] = { | |
15 /* symbol arrange function */ | |
16 { "[]=", tile }, /* first entry is default */ | |
17 diff --git a/dwm.c b/dwm.c | |
18 index a96f33c..64cec29 100644 | |
19 --- a/dwm.c | |
20 +++ b/dwm.c | |
21 @@ -142,6 +142,7 @@ typedef struct { | |
22 } Rule; | |
23 | |
24 /* function declarations */ | |
25 +static void applydefaultlayouts(); | |
26 static void applyrules(Client *c); | |
27 static int applysizehints(Client *c, int *x, int *y, int *w, int *h, in… | |
28 static void arrange(Monitor *m); | |
29 @@ -276,6 +277,21 @@ static Window root, wmcheckwin; | |
30 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; | |
31 | |
32 /* function implementations */ | |
33 +void | |
34 +applydefaultlayouts() | |
35 +{ | |
36 + Monitor *m; | |
37 + int i = 0; | |
38 + for (m = mons; m; m = m->next) { | |
39 + if (i < LENGTH(lpm)) { | |
40 + m->lt[0] = &layouts[lpm[i]]; | |
41 + m->lt[1] = &layouts[(lpm[i] + 1)/ % LENGTH(layouts)]; | |
42 + strncpy(m->ltsymbol, layouts[i].symbol, sizeof m->ltsymbol); | |
43 + } | |
44 + i++; | |
45 + } | |
46 +} | |
47 + | |
48 void | |
49 applyrules(Client *c) | |
50 { | |
51 @@ -1911,6 +1927,7 @@ updategeom(void) | |
52 cleanupmon(m); | |
53 } | |
54 } | |
55 + applydefaultlayouts(); | |
56 free(unique); | |
57 } else | |
58 #endif /* XINERAMA */ |