dwm-4.4.1-nmaster.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-4.4.1-nmaster.diff (3122B) | |
--- | |
1 diff -r 795c26a59016 config.default.h | |
2 --- a/config.default.h Sun Aug 26 12:54:20 2007 +0200 | |
3 +++ b/config.default.h Sun Aug 26 15:06:20 2007 +0200 | |
4 @@ -33,6 +33,7 @@ static Layout layouts[] = { \ | |
5 { "><>", floating }, \ | |
6 }; | |
7 #define MWFACT 0.6 /* master width factor… | |
8 +#define NMASTER 1 /* clients in master ar… | |
9 #define SNAP 32 /* snap pixel */ | |
10 | |
11 /* key definitions */ | |
12 @@ -48,6 +49,8 @@ Key keys[] = { \ | |
13 { MODKEY, XK_k, focusprev… | |
14 { MODKEY, XK_h, setmwfact… | |
15 { MODKEY, XK_l, setmwfact… | |
16 + { MODKEY|ShiftMask, XK_h, incnmas… | |
17 + { MODKEY|ShiftMask, XK_l, incnmas… | |
18 { MODKEY, XK_m, togglemax… | |
19 { MODKEY, XK_Return, zoom, … | |
20 { MODKEY|ShiftMask, XK_space, togglefloat… | |
21 diff -r 795c26a59016 tile.c | |
22 --- a/tile.c Sun Aug 26 12:54:20 2007 +0200 | |
23 +++ b/tile.c Sun Aug 26 15:06:20 2007 +0200 | |
24 @@ -5,8 +5,29 @@ | |
25 /* static */ | |
26 | |
27 static double mwfact = MWFACT; | |
28 +static unsigned int nmaster = NMASTER; | |
29 | |
30 /* extern */ | |
31 + | |
32 +void | |
33 +incnmaster(const char *arg) { | |
34 + int i; | |
35 + | |
36 + if(!isarrange(tile)) | |
37 + return; | |
38 + if(!arg) | |
39 + nmaster = NMASTER; | |
40 + else { | |
41 + i = atoi(arg); | |
42 + if((nmaster + i) < 1 || wah / (nmaster + i) <= 2 * BORD… | |
43 + return; | |
44 + nmaster += i; | |
45 + } | |
46 + if(sel) | |
47 + arrange(); | |
48 + else | |
49 + drawstatus(); | |
50 +} | |
51 | |
52 void | |
53 setmwfact(const char *arg) { | |
54 @@ -32,28 +53,33 @@ setmwfact(const char *arg) { | |
55 | |
56 void | |
57 tile(void) { | |
58 - unsigned int i, n, nx, ny, nw, nh, mw, th; | |
59 + unsigned int i, n, nx, ny, nw, nh, mw, mh, th; | |
60 Client *c; | |
61 | |
62 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) | |
63 n++; | |
64 | |
65 /* window geoms */ | |
66 - mw = (n == 1) ? waw : mwfact * waw; | |
67 - th = (n > 1) ? wah / (n - 1) : 0; | |
68 - if(n > 1 && th < bh) | |
69 + mh = (n <= nmaster) ? wah / (n > 0 ? n : 1) : wah / nmaster; | |
70 + mw = (n <= nmaster) ? waw : mwfact * waw; | |
71 + th = (n > nmaster) ? wah / (n - nmaster) : 0; | |
72 + if(n > nmaster && th < bh) | |
73 th = wah; | |
74 | |
75 nx = wax; | |
76 ny = way; | |
77 for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i… | |
78 c->ismax = False; | |
79 - if(i == 0) { /* master */ | |
80 + if(i < nmaster) { /* master */ | |
81 + ny = way + i * mh; | |
82 nw = mw - 2 * c->border; | |
83 - nh = wah - 2 * c->border; | |
84 + nh = mh; | |
85 + if(i + 1 == (n < nmaster ? n : nmaster)) /* rem… | |
86 + nh = wah - mh * i; | |
87 + nh -= 2 * c->border; | |
88 } | |
89 else { /* tile window */ | |
90 - if(i == 1) { | |
91 + if(i == nmaster) { | |
92 ny = way; | |
93 nx += mw; | |
94 } | |
95 @@ -64,7 +90,7 @@ tile(void) { | |
96 nh = th - 2 * c->border; | |
97 } | |
98 resize(c, nx, ny, nw, nh, False); | |
99 - if(n > 1 && th != wah) | |
100 + if(n > nmaster && th != wah) | |
101 ny += nh + 2 * c->border; | |
102 } | |
103 } | |
104 diff -r 795c26a59016 tile.h | |
105 --- a/tile.h Sun Aug 26 12:54:20 2007 +0200 | |
106 +++ b/tile.h Sun Aug 26 15:06:20 2007 +0200 | |
107 @@ -1,6 +1,7 @@ | |
108 /* See LICENSE file for copyright and license details. */ | |
109 | |
110 /* tile.c */ | |
111 +void incnmaster(const char *arg); /* increments nmaster value */ | |
112 void setmwfact(const char *arg); /* sets master width factor */ | |
113 void tile(void); /* arranges all windows tiled */ | |
114 void zoom(const char *arg); /* zooms the focused client … |