added MODKEY-{plus,minus} shortcuts (increasing/decreasing master clients) 06bae9df
Anselm R. Garbe · 2007-01-05 14:48 4 file(s) · +62 −15
config.arg.h +2 −2
31 31
		{ .cmd = "exe=\"$(lsx `echo $PATH | sed 's/:/ /g'` | sort -u " \
32 32
			" | dmenu -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' " \
33 33
			"-sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"')\" && exec $exe" } }, \
34 -
	{ MODKEY,			XK_d,		incnmaster,	{ .i = -1 } }, \
35 34
	{ MODKEY,			XK_j,		focusnext,	{ 0 } }, \
36 35
	{ MODKEY,			XK_k,		focusprev,	{ 0 } }, \
37 36
	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
38 37
	{ MODKEY,			XK_g,		resizemaster,	{ .i = 15 } }, \
39 -
	{ MODKEY,			XK_i,		incnmaster,	{ .i = 1 } }, \
40 38
	{ MODKEY,			XK_s,		resizemaster,	{ .i = -15 } }, \
39 +
	{ MODKEY,			XK_plus,	incnmaster,	{ .i = 1 } }, \
40 +
	{ MODKEY,			XK_minus,	incnmaster,	{ .i = -1 } }, \
41 41
	{ MODKEY|ShiftMask,		XK_0,		tag,		{ .i = -1 } }, \
42 42
	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 0 } }, \
43 43
	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 1 } }, \
config.default.h +2 −0
31 31
	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
32 32
	{ MODKEY,			XK_g,		resizemaster,	{ .i = 15 } }, \
33 33
	{ MODKEY,			XK_s,		resizemaster,	{ .i = -15 } }, \
34 +
	{ MODKEY,			XK_plus,	incnmaster,	{ .i = 1 } }, \
35 +
	{ MODKEY,			XK_minus,	incnmaster,	{ .i = -1 } }, \
34 36
	{ MODKEY|ShiftMask,		XK_0,		tag,		{ .i = -1 } }, \
35 37
	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 0 } }, \
36 38
	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 1 } }, \
dwm.1 +6 −0
70 70
.B Mod1-s
71 71
Shrink master area (tiling mode only).
72 72
.TP
73 +
.B Mod1-plus
74 +
Increase clients of master area (tiling mode only).
75 +
.TP
76 +
.B Mod1-minus
77 +
Decrease clients of master area (tiling mode only).
78 +
.TP
73 79
.B Mod1-Shift-[1..n]
74 80
Apply
75 81
.RB nth
view.c +52 −13
11 11
	return c;
12 12
}
13 13
14 +
static Bool
15 +
ismaster(Client *c) {
16 +
	Client *cl;
17 +
	unsigned int i;
18 +
19 +
	for(cl = nexttiled(clients), i = 0; cl && cl != c; cl = nexttiled(cl->next), i++);
20 +
	return i < nmaster;
21 +
}
22 +
23 +
static void
24 +
pop(Client *c) {
25 +
	detach(c);
26 +
	if(clients)
27 +
		clients->prev = c;
28 +
	c->next = clients;
29 +
	clients = c;
30 +
}
31 +
32 +
static void
33 +
swap(Client *c1, Client *c2) {
34 +
	Client tmp = *c1;
35 +
	Client *cp = c1->prev;
36 +
	Client *cn = c1->next;
37 +
38 +
	*c1 = *c2;
39 +
	c1->prev = cp;
40 +
	c1->next = cn;
41 +
	cp = c2->prev;
42 +
	cn = c2->next;
43 +
	*c2 = tmp;
44 +
	c2->prev = cp;
45 +
	c2->next = cn;
46 +
}
47 +
14 48
static void
15 49
togglemax(Client *c) {
16 50
	XEvent ev;
32 66
	}
33 67
	resize(c, True, TopLeft);
34 68
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
69 +
}
70 +
71 +
static Client *
72 +
topofstack() {
73 +
	Client *c;
74 +
	unsigned int i;
75 +
76 +
	for(c = nexttiled(clients), i = 0; c && i < nmaster; c = nexttiled(c->next), i++);
77 +
	return (i < nmaster) ? NULL : c;
35 78
}
36 79
37 80
/* extern */
248 291
249 292
void
250 293
zoom(Arg *arg) {
251 -
	unsigned int i, n;
294 +
	unsigned int n;
252 295
	Client *c;
253 296
254 297
	if(!sel)
262 305
	if(n <= nmaster || (arrange == dofloat))
263 306
		return;
264 307
265 -
	for(c = nexttiled(clients), i = 0; c && (c != sel) && i < nmaster; c = nexttiled(c->next))
266 -
		i++;
267 -
	if(c == sel && i < nmaster)
268 -
		for(; c && i < nmaster; c = nexttiled(c->next))
269 -
			i++;
270 -
	if(!c)
271 -
		return;
308 +
	if(ismaster((c = sel))) {
309 +
		if(!(c = topofstack()))
310 +
			return;
311 +
		swap(c, sel);
312 +
		c = sel;
313 +
	}
314 +
	else
315 +
		pop(c);
272 316
273 -
	detach(c);
274 -
	if(clients)
275 -
		clients->prev = c;
276 -
	c->next = clients;
277 -
	clients = c;
278 317
	focus(c);
279 318
	arrange();
280 319
}