renames swim[ming] into versatile 6d5f67a0
Anselm R. Garbe · 2007-02-19 17:12 7 file(s) · +64 −64
client.c +4 −4
253 253
	updatetitle(c);
254 254
	for(t = clients; t && t->win != trans; t = t->next);
255 255
	settags(c, t);
256 -
	if(!c->swimming)
257 -
		c->swimming = (t != NULL) || c->isfixed;
256 +
	if(!c->versatile)
257 +
		c->versatile = (t != NULL) || c->isfixed;
258 258
	attach(c);
259 259
	attachstack(c);
260 260
	c->isbanned = True;
268 268
269 269
Client *
270 270
nexttiled(Client *c) {
271 -
	for(; c && (c->swimming || !isvisible(c)); c = c->next);
271 +
	for(; c && (c->versatile || !isvisible(c)); c = c->next);
272 272
	return c;
273 273
}
274 274
440 440
441 441
	if(!sel)
442 442
		return;
443 -
	if(sel->swimming || (lt->arrange == swim)) {
443 +
	if(sel->versatile || (lt->arrange == versatile)) {
444 444
		togglemax(sel);
445 445
		return;
446 446
	}
config.arg.h +3 −3
9 9
static Layout layout[] = { \
10 10
	/* symbol		function */ \
11 11
	{ "[]=",		tile }, /* first entry is default */ \
12 -
	{ "><>",		swim }, \
12 +
	{ "><>",		versatile }, \
13 13
};
14 14
15 15
#define BORDERPX		1
64 64
	{ MODKEY|ControlMask|ShiftMask,	XK_9,		toggletag,	{ .i = 8 } }, \
65 65
	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
66 66
	{ MODKEY,			XK_space,	togglelayout,	{ 0 } }, \
67 -
	{ MODKEY|ShiftMask,		XK_space,	toggleswimming,	{ 0 } }, \
67 +
	{ MODKEY|ShiftMask,		XK_space,	toggleversatile,{ 0 } }, \
68 68
	{ MODKEY,			XK_0,		view,		{ .i = -1 } }, \
69 69
	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
70 70
	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
89 89
90 90
#define RULES \
91 91
static Rule rule[] = { \
92 -
	/* class:instance:title regex	tags regex	swimming */ \
92 +
	/* class:instance:title regex	tags regex	versatile */ \
93 93
	{ "Firefox",			"3",		False }, \
94 94
	{ "Gimp",			NULL,		True }, \
95 95
	{ "MPlayer",			NULL,		True }, \
config.default.h +3 −3
9 9
Layout layout[] = { \
10 10
	/* symbol		function */ \
11 11
	{ "[]=",		tile }, /* first entry is default */ \
12 -
	{ "><>",		swim }, \
12 +
	{ "><>",		versatile }, \
13 13
};
14 14
15 15
#define BORDERPX		1
59 59
	{ MODKEY|ControlMask|ShiftMask,	XK_9,		toggletag,	{ .i = 8 } }, \
60 60
	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
61 61
	{ MODKEY,			XK_space,	togglelayout,	{ 0 } }, \
62 -
	{ MODKEY|ShiftMask,		XK_space,	toggleswimming,	{ 0 } }, \
62 +
	{ MODKEY|ShiftMask,		XK_space,	toggleversatile	{ 0 } }, \
63 63
	{ MODKEY,			XK_0,		view,		{ .i = -1 } }, \
64 64
	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
65 65
	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
86 86
 * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
87 87
#define RULES \
88 88
static Rule rule[] = { \
89 -
	/* class:instance:title regex	tags regex	swimming */ \
89 +
	/* class:instance:title regex	tags regex	versatile */ \
90 90
	{ "Gimp",			NULL,		True }, \
91 91
	{ "MPlayer",			NULL,		True }, \
92 92
	{ "Acroread",			NULL,		True }, \
dwm.1 +10 −10
6 6
.RB [ \-v ]
7 7
.SH DESCRIPTION
8 8
dwm is a dynamic window manager for X. It manages windows in tiling and
9 -
swimming layouts. Either layout can be applied dynamically, optimizing the
9 +
versatile layouts. Either layout can be applied dynamically, optimizing the
10 10
environment for the application in use and the task performed.
11 11
.P
12 12
In tiling layout windows are managed in a master and stacking area. The master
13 13
area contains the windows which currently need most attention, whereas the
14 -
stacking area contains all other windows. In swimming layout windows can be
15 -
resized and moved freely. Dialog windows are always managed swimming,
14 +
stacking area contains all other windows. In versatile layout windows can be
15 +
resized and moved freely. Dialog windows are always managed versatile,
16 16
regardless of the layout applied.
17 17
.P
18 18
Windows are grouped by tags. Each window can be tagged with one or multiple
38 38
.TP
39 39
.B Button1
40 40
click on a tag label to display all windows with that tag, click on the layout
41 -
label toggles between tiling and swimming layout.
41 +
label toggles between tiling and versatile layout.
42 42
.TP
43 43
.B Button3
44 44
click on a tag label adds/removes all windows with that tag to/from the view.
67 67
Focus previous window.
68 68
.TP
69 69
.B Mod1-Return
70 -
Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (swimming layout).
70 +
Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (versatile layout).
71 71
.TP
72 72
.B Mod1-g
73 73
Grow master area (tiling layout only).
98 98
Close focused window.
99 99
.TP
100 100
.B Mod1-space
101 -
Toggle between tiling and swimming layout (affects all windows).
101 +
Toggle between tiling and versatile layout (affects all windows).
102 102
.TP
103 103
.B Mod1-Shift-space
104 -
Toggle focused window between swimming and non-swimming state (tiling layout only).
104 +
Toggle focused window between versatile and non-versatile state (tiling layout only).
105 105
.TP
106 106
.B Mod1-[1..n]
107 107
View all windows with
121 121
.SS Mouse commands
122 122
.TP
123 123
.B Mod1-Button1
124 -
Move current window while dragging (swimming layout only).
124 +
Move current window while dragging (versatile layout only).
125 125
.TP
126 126
.B Mod1-Button2
127 -
Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (swimming layout).
127 +
Zooms/cycles current window to/from master area (tiling layout), toggles maximization of current window (versatile layout).
128 128
.TP
129 129
.B Mod1-Button3
130 -
Resize current window while dragging (swimming layout only).
130 +
Resize current window while dragging (versatile layout only).
131 131
.SH CUSTOMIZATION
132 132
dwm is customized by creating a custom config.h and (re)compiling the source
133 133
code. This keeps it fast, secure and simple.
dwm.h +3 −3
72 72
	int minax, minay, maxax, maxay;
73 73
	long flags; 
74 74
	unsigned int border;
75 -
	Bool isbanned, isfixed, ismax, swimming;
75 +
	Bool isbanned, isfixed, ismax, versatile;
76 76
	Bool *tags;
77 77
	Client *next;
78 78
	Client *prev;
135 135
extern void resizemaster(Arg *arg);		/* resizes the master percent with arg's index value */
136 136
extern void restack(void);			/* restores z layers of all clients */
137 137
extern void settags(Client *c, Client *trans);	/* sets tags of c */
138 -
extern void swim(void);				/* arranges all windows swimming */
139 138
extern void tag(Arg *arg);			/* tags c with arg's index */
140 -
extern void toggleswimming(Arg *arg);		/* toggles focusesd client between swimming/and non-swimming state */
139 +
extern void toggleversatile(Arg *arg);		/* toggles focusesd client between versatile/and non-versatile state */
141 140
extern void togglelayout(Arg *arg);		/* toggles layout */
142 141
extern void toggletag(Arg *arg);		/* toggles c tags with arg's index */
143 142
extern void toggleview(Arg *arg);		/* toggles the tag with arg's index (in)visible */
143 +
extern void versatile(void);			/* arranges all windows versatile */
144 144
extern void view(Arg *arg);			/* views the tag with arg's index */
145 145
146 146
/* util.c */
event.c +4 −4
156 156
		focus(c);
157 157
		if(CLEANMASK(ev->state) != MODKEY)
158 158
			return;
159 -
		if(ev->button == Button1 && (lt->arrange == swim || c->swimming)) {
159 +
		if(ev->button == Button1 && (lt->arrange == versatile || c->versatile)) {
160 160
			restack();
161 161
			movemouse(c);
162 162
		}
163 163
		else if(ev->button == Button2)
164 164
			zoom(NULL);
165 165
		else if(ev->button == Button3
166 -
		&& (lt->arrange == swim || c->swimming) && !c->isfixed)
166 +
		&& (lt->arrange == versatile || c->versatile) && !c->isfixed)
167 167
		{
168 168
			restack();
169 169
			resizemouse(c);
181 181
		c->ismax = False;
182 182
		if(ev->value_mask & CWBorderWidth)
183 183
			c->border = ev->border_width;
184 -
		if(c->isfixed || c->swimming || (lt->arrange == swim)) {
184 +
		if(c->isfixed || c->versatile || (lt->arrange == versatile)) {
185 185
			if(ev->value_mask & CWX)
186 186
				c->x = ev->x;
187 187
			if(ev->value_mask & CWY)
309 309
			default: break;
310 310
			case XA_WM_TRANSIENT_FOR:
311 311
				XGetTransientForHint(dpy, c->win, &trans);
312 -
				if(!c->swimming && (c->swimming = (getclient(trans) != NULL)))
312 +
				if(!c->versatile && (c->versatile = (getclient(trans) != NULL)))
313 313
					lt->arrange();
314 314
				break;
315 315
			case XA_WM_NORMAL_HINTS:
screen.c +37 −37
19 19
typedef struct {
20 20
	const char *prop;
21 21
	const char *tags;
22 -
	Bool swimming;
22 +
	Bool versatile;
23 23
} Rule;
24 24
25 25
typedef struct {
52 52
			if(c->isbanned)
53 53
				XMoveWindow(dpy, c->win, c->x, c->y);
54 54
			c->isbanned = False;
55 -
			if(c->swimming)
55 +
			if(c->versatile)
56 56
				continue;
57 57
			c->ismax = False;
58 58
			nx = wax;
175 175
	drawstatus();
176 176
	if(!sel)
177 177
		return;
178 -
	if(sel->swimming || lt->arrange == swim)
178 +
	if(sel->versatile || lt->arrange == versatile)
179 179
		XRaiseWindow(dpy, sel->win);
180 -
	if(lt->arrange != swim) {
181 -
		if(!sel->swimming)
180 +
	if(lt->arrange != versatile) {
181 +
		if(!sel->versatile)
182 182
			XLowerWindow(dpy, sel->win);
183 183
		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
184 184
			if(c == sel)
208 208
				ch.res_name ? ch.res_name : "", c->name);
209 209
		for(i = 0; i < nrules; i++)
210 210
			if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
211 -
				c->swimming = rule[i].swimming;
211 +
				c->versatile = rule[i].versatile;
212 212
				for(j = 0; regs[i].tagregex && j < ntags; j++) {
213 213
					if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
214 214
						matched = True;
227 227
}
228 228
229 229
void
230 -
swim(void) {
231 -
	Client *c;
232 -
233 -
	for(c = clients; c; c = c->next) {
234 -
		if(isvisible(c)) {
235 -
			if(c->isbanned)
236 -
				XMoveWindow(dpy, c->win, c->x, c->y);
237 -
			c->isbanned = False;
238 -
			resize(c, c->x, c->y, c->w, c->h, True);
239 -
		}
240 -
		else {
241 -
			c->isbanned = True;
242 -
			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
243 -
		}
244 -
	}
245 -
	if(!sel || !isvisible(sel)) {
246 -
		for(c = stack; c && !isvisible(c); c = c->snext);
247 -
		focus(c);
248 -
	}
249 -
	restack();
250 -
}
251 -
252 -
void
253 230
tag(Arg *arg) {
254 231
	unsigned int i;
255 232
263 240
}
264 241
265 242
void
266 -
toggleswimming(Arg *arg) {
267 -
	if(!sel || lt->arrange == swim)
268 -
		return;
269 -
	sel->swimming = !sel->swimming;
270 -
	lt->arrange();
271 -
}
272 -
273 -
void
274 243
toggletag(Arg *arg) {
275 244
	unsigned int i;
276 245
299 268
}
300 269
301 270
void
271 +
toggleversatile(Arg *arg) {
272 +
	if(!sel || lt->arrange == versatile)
273 +
		return;
274 +
	sel->versatile = !sel->versatile;
275 +
	lt->arrange();
276 +
}
277 +
278 +
void
302 279
toggleview(Arg *arg) {
303 280
	unsigned int i;
304 281
307 284
	if(i == ntags)
308 285
		seltag[arg->i] = True; /* cannot toggle last view */
309 286
	lt->arrange();
287 +
}
288 +
289 +
void
290 +
versatile(void) {
291 +
	Client *c;
292 +
293 +
	for(c = clients; c; c = c->next) {
294 +
		if(isvisible(c)) {
295 +
			if(c->isbanned)
296 +
				XMoveWindow(dpy, c->win, c->x, c->y);
297 +
			c->isbanned = False;
298 +
			resize(c, c->x, c->y, c->w, c->h, True);
299 +
		}
300 +
		else {
301 +
			c->isbanned = True;
302 +
			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
303 +
		}
304 +
	}
305 +
	if(!sel || !isvisible(sel)) {
306 +
		for(c = stack; c && !isvisible(c); c = c->snext);
307 +
		focus(c);
308 +
	}
309 +
	restack();
310 310
}
311 311
312 312
void