about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--config.arg.h14
-rw-r--r--config.default.h10
-rw-r--r--dwm.118
-rw-r--r--layout.c53
4 files changed, 60 insertions, 35 deletions
diff --git a/config.arg.h b/config.arg.h
index 2a1a784..de3a623 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -32,7 +32,7 @@ static Layout layout[] = { \
 };
 #define NMASTER			1	/* clients in master area */
 #define HRATIO			.8	/* horizontal ratio of tile */
-#define VRATIO			.8	/* vertical ratio of tile */
+#define VRATIO			.9	/* vertical ratio of tile */
 #define SNAP			32	/* snap pixel */
 
 /* key definitions */
@@ -47,14 +47,14 @@ static Key key[] = { \
 		"exec urxvtcd -tr -bg '#222' -fg '#eee' -cr '#eee' +sb -fn '"FONT"'" }, \
 	{ MODKEY,			XK_space,	setlayout,	NULL }, \
 	{ MODKEY,			XK_b,		togglebar,	NULL }, \
-	{ MODKEY,			XK_h,		incvratio,	".1" }, \
-	{ MODKEY,			XK_h,		inchratio,	".1" }, \
-	{ MODKEY,			XK_l,		incvratio,	"-.1" }, \
-	{ MODKEY,			XK_l,		inchratio,	"-.1" }, \
-	{ MODKEY|ShiftMask,		XK_j,		incnmaster,	"1" }, \
-	{ MODKEY|ShiftMask,		XK_k,		incnmaster,	"-1" }, \
+	{ MODKEY,			XK_h,		incnmaster,	"1" }, \
+	{ MODKEY,			XK_l,		incnmaster,	"-1" }, \
 	{ MODKEY,			XK_j,		focusclient,	"1" }, \
 	{ MODKEY,			XK_k,		focusclient,	"-1" }, \
+	{ MODKEY|ShiftMask,		XK_h,		inchratio,	".1" }, \
+	{ MODKEY|ShiftMask,		XK_l,		inchratio,	"-.1" }, \
+	{ MODKEY|ShiftMask,		XK_j,		incvratio,	"-.1" }, \
+	{ MODKEY|ShiftMask,		XK_k,		incvratio,	".1" }, \
 	{ MODKEY,			XK_m,		togglemax,	NULL }, \
 	{ MODKEY,			XK_Return,	zoom,		NULL }, \
 	{ MODKEY|ShiftMask,		XK_space,	togglefloating,	NULL }, \
diff --git a/config.default.h b/config.default.h
index 9ea02a9..eaba9fb 100644
--- a/config.default.h
+++ b/config.default.h
@@ -45,12 +45,14 @@ static Key key[] = { \
 	{ MODKEY,			XK_p,		spawn, 		"exe=`dmenu_path | dmenu` && exec $exe" }, \
 	{ MODKEY,			XK_space,	setlayout,	NULL }, \
 	{ MODKEY,			XK_b,		togglebar,	NULL }, \
-	{ MODKEY,			XK_h,		incvratio,	".1" }, \
-	{ MODKEY,			XK_l,		incvratio,	"-.1" }, \
-	{ MODKEY|ShiftMask,		XK_j,		incnmaster,	"1" }, \
-	{ MODKEY|ShiftMask,		XK_k,		incnmaster,	"-1" }, \
+	{ MODKEY,			XK_h,		incnmaster,	"1" }, \
+	{ MODKEY,			XK_l,		incnmaster,	"-1" }, \
 	{ MODKEY,			XK_j,		focusclient,	"1" }, \
 	{ MODKEY,			XK_k,		focusclient,	"-1" }, \
+	{ MODKEY|ShiftMask,		XK_h,		inchratio,	".1" }, \
+	{ MODKEY|ShiftMask,		XK_l,		inchratio,	"-.1" }, \
+	{ MODKEY|ShiftMask,		XK_j,		incvratio,	"-.1" }, \
+	{ MODKEY|ShiftMask,		XK_k,		incvratio,	".1" }, \
 	{ MODKEY,			XK_m,		togglemax,	NULL }, \
 	{ MODKEY,			XK_Return,	zoom,		NULL }, \
 	{ MODKEY|ShiftMask,		XK_space,	togglefloating,	NULL }, \
diff --git a/dwm.1 b/dwm.1
index 054f945..b1b04eb 100644
--- a/dwm.1
+++ b/dwm.1
@@ -68,17 +68,23 @@ Focus next window.
 .B Mod1\-k
 Focus previous window.
 .TP
-.B Mod1\-Shift\-j
+.B Mod1\-l
 Increase the number of windows in the master area (tiled layout only).
 .TP
-.B Mod1\-Shift\-k
+.B Mod1\-h
 Decrease the number of windows in the master area (tiled layout only).
 .TP
-.B Mod1\-l
-Increase master area width (tiled layout only).
+.B Mod1\-Shift\-j
+Increase vertical tile ratio, effects tile heights (tiled layout only).
 .TP
-.B Mod1\-h
-Decrease master area width (tiled layout only).
+.B Mod1\-Shift\-k
+Decrease vertical tile ratio, effects tile heights (tiled layout only).
+.TP
+.B Mod1\-Shift\-l
+Increase horizontal tile ratio, effects master area width (tiled layout only).
+.TP
+.B Mod1\-Shift\-h
+Decrease horizontal tile ratio, effects master area width (tiled layout only).
 .TP
 .B Mod1\-m
 Toggles maximization of current window (floating layout only).
diff --git a/layout.c b/layout.c
index b475d35..2016917 100644
--- a/layout.c
+++ b/layout.c
@@ -25,21 +25,27 @@ spow(double x, double y)
 
 static void
 tile(void) {
-	double mscale = 0, tscale = 0, sum = 0;
+	Bool mmaxtile = False, smaxtile = False; /* fallback tiling */
+	double mscale = 0, sscale = 0, sum = 0;
 	unsigned int i, n, nx, ny, nw, nh, mw, tw;
 	Client *c;
 
+	/* preparation */
 	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
 		n++;
-
+	nx = wax;
+	ny = way;
 	mw = (n <= nmaster) ? waw :  waw / (1 + hratio);
 	tw = waw - mw;
-
 	if(n > 0) {
-		if(n < nmaster) {
+		if(n <= nmaster) {
 			for(i = 0; i < n; i++)
 				sum += spow(vratio, i);
 			mscale = wah / sum;
+			if(vratio >= 1)
+				mmaxtile = bh > (mscale * spow(vratio, 0));
+			else
+				mmaxtile = bh > (mscale * spow(vratio, n - 1));
 		}
 		else {
 			for(i = 0; i < nmaster; i++)
@@ -47,11 +53,18 @@ tile(void) {
 			mscale = wah / sum;
 			for(sum = 0, i = 0; i < (n - nmaster); i++)
 				sum += spow(vratio, i);
-			tscale = wah / sum;
+			sscale = wah / sum;
+			if(vratio >= 1) {
+				mmaxtile = bh > (mscale * spow(vratio, 0));
+				smaxtile = bh > (sscale * spow(vratio, 0));
+			}
+			else {
+				mmaxtile = bh > (mscale * spow(vratio, nmaster - 1));
+				smaxtile = bh > (sscale * spow(vratio, n - nmaster - 1));
+			}
 		}
 	}
-	nx = wax;
-	ny = way;
+	/* tiling */
 	for(i = 0, c = clients; c; c = c->next)
 		if(isvisible(c)) {
 			unban(c);
@@ -60,25 +73,29 @@ tile(void) {
 			c->ismax = False;
 			if(i < nmaster) { /* master window */
 				nw = mw - 2 * c->border;
-				if(i + 1 == n || i + 1 == nmaster)
-					nh = (way + wah) - ny - (2 * c->border);
+				if(mmaxtile) {
+					ny = way;
+					nh = wah - 2 * c->border;
+				}
+				else if(i + 1 == (n < nmaster ? n : nmaster))
+					nh = (way + wah) - ny - 2 * c->border;
 				else
-					nh = (mscale * spow(vratio, i)) - (2 * c->border);
+					nh = (mscale * spow(vratio, i)) - 2 * c->border;
 			}
 			else { /* tile window */
+				nw = tw - 2 * c->border;
 				if(i == nmaster) {
 					ny = way;
 					nx = wax + mw;
 				}
-				nw = tw - 2 * c->border;
-				if(i + 1 == n)
-					nh = (way + wah) - ny - (2 * c->border);
+				if(smaxtile) {
+					ny = way;
+					nh = wah - 2 * c->border;
+				}
+				else if(i + 1 == n)
+					nh = (way + wah) - ny - 2 * c->border;
 				else
-					nh = (tscale * spow(vratio, i - nmaster)) - (2 * c->border);
-			}
-			if(nh < bh) {
-				nh = bh;
-				ny = way + wah - nh;
+					nh = (sscale * spow(vratio, i - nmaster)) - 2 * c->border;
 			}
 			resize(c, nx, ny, nw, nh, False);
 			ny += nh;
n' href='/acidbong/suckless/dwm/blame/draw.c?id=dbf7e03996032a6def3b8e97468b78d6da9e8c88'>^
650a1fb ^


8a34fa5 ^
9e8b325 ^
8a34fa5 ^
4d67199 ^
28a5219 ^



4d67199 ^
28a5219 ^
4d67199 ^
650a1fb ^
8a34fa5 ^
b55bd70 ^
9833610 ^
b55bd70 ^
7e597ae ^
9833610 ^
8a34fa5 ^
9833610 ^
b55bd70 ^
7e597ae ^

78f4b51 ^
9833610 ^

c8e5733 ^
9833610 ^
8a34fa5 ^
78f4b51 ^





8a34fa5 ^

bf35794 ^
c09bf8d ^

6b25d06 ^
c09bf8d ^

937cabf ^
c09bf8d ^




6b25d06 ^
4688ad1 ^
c09bf8d ^

b355755 ^
c09bf8d ^
b55bd70 ^
78f4b51 ^
c09bf8d ^
78f4b51 ^
e995c1b ^
c09bf8d ^
e995c1b ^
78f4b51 ^
e369292 ^
c09bf8d ^
931e712 ^
7e597ae ^



78f4b51 ^
2dd5212 ^
7e597ae ^
78f4b51 ^
4688ad1 ^
c09bf8d ^
e6cbe9c ^
c09bf8d ^

adaa28a ^
ca65478 ^
fde45eb ^
adaa28a ^
7e597ae ^
b55bd70 ^
adaa28a ^

b55bd70 ^
7e597ae ^


78f4b51 ^
7e597ae ^
e6cbe9c ^
adaa28a ^

9e8b325 ^
ca65478 ^
9e8b325 ^
dc5d967 ^
9e8b325 ^
e81eb46 ^

8a34fa5 ^


8a34fa5 ^
ca65478 ^
8a34fa5 ^
d7e1708 ^
8a34fa5 ^
8a8b795 ^
8a34fa5 ^
9e8b325 ^


8a34fa5 ^



9e8b325 ^


8a34fa5 ^

9e8b325 ^
8a34fa5 ^


9e8b325 ^







8a34fa5 ^



9e8b325 ^






dba2306 ^
9e8b325 ^

8a34fa5 ^
9e8b325 ^
8a34fa5 ^
adaa28a ^

ca65478 ^
adaa28a ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211