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