summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-02-22 22:10:16 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-02-22 22:10:16 +0100
commit338c0838580b32f1258a800392d93cf973baf1e6 (patch)
tree30387958f30336d7617f63a085128cbe40651d2f
parenthahaha, untiled and non-untiled sounded really cumbersome (diff)
downloaddwm-338c0838580b32f1258a800392d93cf973baf1e6.tar.gz
dwm-338c0838580b32f1258a800392d93cf973baf1e6.zip
renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
-rw-r--r--client.c10
-rw-r--r--config.arg.h6
-rw-r--r--config.default.h6
-rw-r--r--draw.c2
-rw-r--r--dwm.122
-rw-r--r--dwm.h8
-rw-r--r--event.c8
-rw-r--r--layout.c60
-rw-r--r--tag.c4
9 files changed, 63 insertions, 63 deletions
diff --git a/client.c b/client.c
index 4ba15c4..d180278 100644
--- a/client.c
+++ b/client.c
@@ -203,8 +203,8 @@ manage(Window w, XWindowAttributes *wa) {
203 updatetitle(c); 203 updatetitle(c);
204 for(t = clients; t && t->win != trans; t = t->next); 204 for(t = clients; t && t->win != trans; t = t->next);
205 settags(c, t); 205 settags(c, t);
206 if(!c->isuntiled) 206 if(!c->isfloating)
207 c->isuntiled = (t != NULL) || c->isfixed; 207 c->isfloating = (t != NULL) || c->isfixed;
208 attach(c); 208 attach(c);
209 attachstack(c); 209 attachstack(c);
210 c->isbanned = True; 210 c->isbanned = True;
@@ -285,10 +285,10 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
285} 285}
286 286
287void 287void
288toggletiled(const char *arg) { 288togglefloating(const char *arg) {
289 if(!sel || lt->arrange == untile) 289 if(!sel || lt->arrange == floating)
290 return; 290 return;
291 sel->isuntiled = !sel->isuntiled; 291 sel->isfloating = !sel->isfloating;
292 lt->arrange(); 292 lt->arrange();
293} 293}
294 294
diff --git a/config.arg.h b/config.arg.h
index f286769..7452a2f 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -18,7 +18,7 @@
18const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; 18const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
19#define RULES \ 19#define RULES \
20static Rule rule[] = { \ 20static Rule rule[] = { \
21 /* class:instance:title regex tags regex isuntiled */ \ 21 /* class:instance:title regex tags regex isfloating */ \
22 { "Firefox", "3", False }, \ 22 { "Firefox", "3", False }, \
23 { "Gimp", NULL, True }, \ 23 { "Gimp", NULL, True }, \
24 { "MPlayer", NULL, True }, \ 24 { "MPlayer", NULL, True }, \
@@ -30,7 +30,7 @@ static Rule rule[] = { \
30static Layout layout[] = { \ 30static Layout layout[] = { \
31 /* symbol function */ \ 31 /* symbol function */ \
32 { "[]=", tile }, /* first entry is default */ \ 32 { "[]=", tile }, /* first entry is default */ \
33 { "><>", untile }, \ 33 { "><>", floating }, \
34}; 34};
35#define MASTERWIDTH 600 /* master width per thousand */ 35#define MASTERWIDTH 600 /* master width per thousand */
36#define NMASTER 1 /* clients in master area */ 36#define NMASTER 1 /* clients in master area */
@@ -56,7 +56,7 @@ static Key key[] = { \
56 { MODKEY, XK_k, focusclient, "-1" }, \ 56 { MODKEY, XK_k, focusclient, "-1" }, \
57 { MODKEY, XK_m, togglemax, NULL }, \ 57 { MODKEY, XK_m, togglemax, NULL }, \
58 { MODKEY, XK_Return, zoom, NULL }, \ 58 { MODKEY, XK_Return, zoom, NULL }, \
59 { MODKEY|ShiftMask, XK_space, toggletiled, NULL }, \ 59 { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \
60 { MODKEY|ShiftMask, XK_c, killclient, NULL }, \ 60 { MODKEY|ShiftMask, XK_c, killclient, NULL }, \
61 { MODKEY, XK_0, view, NULL }, \ 61 { MODKEY, XK_0, view, NULL }, \
62 { MODKEY, XK_1, view, "0" }, \ 62 { MODKEY, XK_1, view, "0" }, \
diff --git a/config.default.h b/config.default.h
index 1632f50..9813ef7 100644
--- a/config.default.h
+++ b/config.default.h
@@ -20,7 +20,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
20 * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */ 20 * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
21#define RULES \ 21#define RULES \
22static Rule rule[] = { \ 22static Rule rule[] = { \
23 /* class:instance:title regex tags regex isuntiled */ \ 23 /* class:instance:title regex tags regex isfloating */ \
24 { "Gimp", NULL, True }, \ 24 { "Gimp", NULL, True }, \
25 { "MPlayer", NULL, True }, \ 25 { "MPlayer", NULL, True }, \
26 { "Acroread", NULL, True }, \ 26 { "Acroread", NULL, True }, \
@@ -31,7 +31,7 @@ static Rule rule[] = { \
31static Layout layout[] = { \ 31static Layout layout[] = { \
32 /* symbol function */ \ 32 /* symbol function */ \
33 { "[]=", tile }, /* first entry is default */ \ 33 { "[]=", tile }, /* first entry is default */ \
34 { "><>", untile }, \ 34 { "><>", floating }, \
35}; 35};
36#define MASTERWIDTH 640 /* master width per thousand */ 36#define MASTERWIDTH 640 /* master width per thousand */
37#define NMASTER 1 /* clients in master area */ 37#define NMASTER 1 /* clients in master area */
@@ -52,7 +52,7 @@ static Key key[] = { \
52 { MODKEY|ShiftMask, XK_Tab, focusclient, "-1" }, \ 52 { MODKEY|ShiftMask, XK_Tab, focusclient, "-1" }, \
53 { MODKEY, XK_m, togglemax, NULL }, \ 53 { MODKEY, XK_m, togglemax, NULL }, \
54 { MODKEY, XK_Return, zoom, NULL }, \ 54 { MODKEY, XK_Return, zoom, NULL }, \
55 { MODKEY|ShiftMask, XK_space, toggletiled, NULL }, \ 55 { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \
56 { MODKEY|ShiftMask, XK_c, killclient, NULL }, \ 56 { MODKEY|ShiftMask, XK_c, killclient, NULL }, \
57 { MODKEY, XK_0, view, NULL }, \ 57 { MODKEY, XK_0, view, NULL }, \
58 { MODKEY, XK_1, view, "0" }, \ 58 { MODKEY, XK_1, view, "0" }, \
diff --git a/draw.c b/draw.c
index 58f3998..e0a93fe 100644
--- a/draw.c
+++ b/draw.c
@@ -81,7 +81,7 @@ drawstatus(void) {
81 dc.x = x; 81 dc.x = x;
82 if(sel) { 82 if(sel) {
83 drawtext(sel->name, dc.sel); 83 drawtext(sel->name, dc.sel);
84 drawsquare(sel->ismax, sel->isuntiled, dc.sel); 84 drawsquare(sel->ismax, sel->isfloating, dc.sel);
85 } 85 }
86 else 86 else
87 drawtext(NULL, dc.norm); 87 drawtext(NULL, dc.norm);
diff --git a/dwm.1 b/dwm.1
index e5ad7bf..277d08c 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 tiled and 8dwm is a dynamic window manager for X. It manages windows in tiled and
9untiled layouts. Either layout can be applied dynamically, optimizing the 9floating 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 tiled layout windows are managed in a master and stacking area. The master 12In tiled 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 untiled layout windows can be 14stacking area contains all other windows. In floating layout windows can be
15resized and moved freely. Dialog windows are always managed untiled, 15resized and moved freely. Dialog windows are always managed floating,
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
@@ -20,8 +20,8 @@ tags. Selecting certain tags displays all windows with these tags.
20.P 20.P
21dwm contains a small status bar which displays all available tags, the layout, 21dwm contains a small status bar which displays all available tags, the layout,
22the title of the focused window, and the text read from standard input. A 22the title of the focused window, and the text read from standard input. A
23untiled window is indicated with an empty square and a maximized 23floating window is indicated with an empty square and a maximized
24untiled window is indicated with a filled square before the windows 24floating window is indicated with a filled square before the windows
25title. The selected tags are indicated with a different color. The tags of 25title. The selected tags are indicated with a different color. The tags of
26the focused window are indicated with a filled square in the top left 26the focused window are indicated with a filled square in the top left
27corner. The tags which are applied to one or more windows are indicated 27corner. The tags which are applied to one or more windows are indicated
@@ -40,7 +40,7 @@ is read and displayed in the status text area.
40.TP 40.TP
41.B Button1 41.B Button1
42click on a tag label to display all windows with that tag, click on the layout 42click on a tag label to display all windows with that tag, click on the layout
43label toggles between tiled and untiled layout. 43label toggles between tiled and floating layout.
44.TP 44.TP
45.B Button3 45.B Button3
46click on a tag label adds/removes all windows with that tag to/from the view. 46click on a tag label adds/removes all windows with that tag to/from the view.
@@ -78,7 +78,7 @@ Increase the number of windows in the master area (tiled layout only).
78Decrease the number of windows in the master area (tiled layout only). 78Decrease the number of windows in the master area (tiled layout only).
79.TP 79.TP
80.B Mod1-m 80.B Mod1-m
81Toggles maximization of current window (untiled layout only). 81Toggles maximization of current window (floating layout only).
82.TP 82.TP
83.B Mod1-Shift-[1..n] 83.B Mod1-Shift-[1..n]
84Apply 84Apply
@@ -97,10 +97,10 @@ tag to/from current window.
97Close focused window. 97Close focused window.
98.TP 98.TP
99.B Mod1-space 99.B Mod1-space
100Toggle between tiled and untiled layout (affects all windows). 100Toggle between tiled and floating layout (affects all windows).
101.TP 101.TP
102.B Mod1-Shift-space 102.B Mod1-Shift-space
103Toggle focused window between tiled and untiled state (tiled layout only). 103Toggle focused window between tiled and floating state (tiled layout only).
104.TP 104.TP
105.B Mod1-[1..n] 105.B Mod1-[1..n]
106View all windows with 106View all windows with
@@ -120,13 +120,13 @@ Quit dwm.
120.SS Mouse commands 120.SS Mouse commands
121.TP 121.TP
122.B Mod1-Button1 122.B Mod1-Button1
123Move current window while dragging (untiled layout only). 123Move current window while dragging (floating layout only).
124.TP 124.TP
125.B Mod1-Button2 125.B Mod1-Button2
126Zooms/cycles current window to/from master area (tiled layout only). 126Zooms/cycles current window to/from master area (tiled layout only).
127.TP 127.TP
128.B Mod1-Button3 128.B Mod1-Button3
129Resize current window while dragging (untiled layout only). 129Resize current window while dragging (floating layout only).
130.SH CUSTOMIZATION 130.SH CUSTOMIZATION
131dwm is customized by creating a custom config.h and (re)compiling the source 131dwm is customized by creating a custom config.h and (re)compiling the source
132code. This keeps it fast, secure and simple. 132code. This keeps it fast, secure and simple.
diff --git a/dwm.h b/dwm.h
index f94ec8a..d795c84 100644
--- a/dwm.h
+++ b/dwm.h
@@ -50,7 +50,7 @@ struct Client {
50 int minax, minay, maxax, maxay; 50 int minax, minay, maxax, maxay;
51 long flags; 51 long flags;
52 unsigned int border; 52 unsigned int border;
53 Bool isbanned, isfixed, ismax, isuntiled; 53 Bool isbanned, isfixed, ismax, isfloating;
54 Bool *tags; 54 Bool *tags;
55 Client *next; 55 Client *next;
56 Client *prev; 56 Client *prev;
@@ -103,7 +103,7 @@ extern void killclient(const char *arg); /* kill c nicely */
103extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ 103extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
104extern void resize(Client *c, int x, int y, 104extern void resize(Client *c, int x, int y,
105 int w, int h, Bool sizehints); /* resize with given coordinates c*/ 105 int w, int h, Bool sizehints); /* resize with given coordinates c*/
106extern void toggletiled(const char *arg); /* toggles focused client between tiled/untiled state */ 106extern void togglefloating(const char *arg); /* toggles focused client between floating/tiled state */
107extern void updatesizehints(Client *c); /* update the size hint variables of c */ 107extern void updatesizehints(Client *c); /* update the size hint variables of c */
108extern void updatetitle(Client *c); /* update the name of c */ 108extern void updatetitle(Client *c); /* update the name of c */
109extern void unmanage(Client *c); /* destroy c */ 109extern void unmanage(Client *c); /* destroy c */
@@ -117,6 +117,7 @@ extern unsigned int textw(const char *text); /* return the width of text in px*/
117extern void grabkeys(void); /* grab all keys defined in config.h */ 117extern void grabkeys(void); /* grab all keys defined in config.h */
118 118
119/* layout.c */ 119/* layout.c */
120extern void floating(void); /* arranges all windows floating */
120extern void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */ 121extern void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */
121extern void incmasterw(const char *arg); /* increments the master width with arg's index value */ 122extern void incmasterw(const char *arg); /* increments the master width with arg's index value */
122extern void incnmaster(const char *arg); /* increments nmaster with arg's index value */ 123extern void incnmaster(const char *arg); /* increments nmaster with arg's index value */
@@ -124,8 +125,7 @@ extern void initlayouts(void); /* initialize layout array */
124extern Client *nexttiled(Client *c); /* returns tiled successor of c */ 125extern Client *nexttiled(Client *c); /* returns tiled successor of c */
125extern void restack(void); /* restores z layers of all clients */ 126extern void restack(void); /* restores z layers of all clients */
126extern void setlayout(const char *arg); /* sets layout, -1 toggles */ 127extern void setlayout(const char *arg); /* sets layout, -1 toggles */
127extern void togglemax(const char *arg); /* toggles maximization of untiled client */ 128extern void togglemax(const char *arg); /* toggles maximization of floating client */
128extern void untile(void); /* arranges all windows untiled */
129extern void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */ 129extern void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */
130 130
131/* main.c */ 131/* main.c */
diff --git a/event.c b/event.c
index a442d2e..6386659 100644
--- a/event.c
+++ b/event.c
@@ -151,14 +151,14 @@ buttonpress(XEvent *e) {
151 focus(c); 151 focus(c);
152 if(CLEANMASK(ev->state) != MODKEY) 152 if(CLEANMASK(ev->state) != MODKEY)
153 return; 153 return;
154 if(ev->button == Button1 && (lt->arrange == untile || c->isuntiled)) { 154 if(ev->button == Button1 && (lt->arrange == floating || c->isfloating)) {
155 restack(); 155 restack();
156 movemouse(c); 156 movemouse(c);
157 } 157 }
158 else if(ev->button == Button2) 158 else if(ev->button == Button2)
159 zoom(NULL); 159 zoom(NULL);
160 else if(ev->button == Button3 160 else if(ev->button == Button3
161 && (lt->arrange == untile || c->isuntiled) && !c->isfixed) 161 && (lt->arrange == floating || c->isfloating) && !c->isfixed)
162 { 162 {
163 restack(); 163 restack();
164 resizemouse(c); 164 resizemouse(c);
@@ -176,7 +176,7 @@ configurerequest(XEvent *e) {
176 c->ismax = False; 176 c->ismax = False;
177 if(ev->value_mask & CWBorderWidth) 177 if(ev->value_mask & CWBorderWidth)
178 c->border = ev->border_width; 178 c->border = ev->border_width;
179 if(c->isfixed || c->isuntiled || (lt->arrange == untile)) { 179 if(c->isfixed || c->isfloating || (lt->arrange == floating)) {
180 if(ev->value_mask & CWX) 180 if(ev->value_mask & CWX)
181 c->x = ev->x; 181 c->x = ev->x;
182 if(ev->value_mask & CWY) 182 if(ev->value_mask & CWY)
@@ -304,7 +304,7 @@ propertynotify(XEvent *e) {
304 default: break; 304 default: break;
305 case XA_WM_TRANSIENT_FOR: 305 case XA_WM_TRANSIENT_FOR:
306 XGetTransientForHint(dpy, c->win, &trans); 306 XGetTransientForHint(dpy, c->win, &trans);
307 if(!c->isuntiled && (c->isuntiled = (getclient(trans) != NULL))) 307 if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL)))
308 lt->arrange(); 308 lt->arrange();
309 break; 309 break;
310 case XA_WM_NORMAL_HINTS: 310 case XA_WM_NORMAL_HINTS:
diff --git a/layout.c b/layout.c
index 8756e00..c4727f0 100644
--- a/layout.c
+++ b/layout.c
@@ -31,7 +31,7 @@ tile(void) {
31 if(c->isbanned) 31 if(c->isbanned)
32 XMoveWindow(dpy, c->win, c->x, c->y); 32 XMoveWindow(dpy, c->win, c->x, c->y);
33 c->isbanned = False; 33 c->isbanned = False;
34 if(c->isuntiled) 34 if(c->isfloating)
35 continue; 35 continue;
36 c->ismax = False; 36 c->ismax = False;
37 nx = wax; 37 nx = wax;
@@ -70,6 +70,29 @@ LAYOUTS
70/* extern */ 70/* extern */
71 71
72void 72void
73floating(void) {
74 Client *c;
75
76 for(c = clients; c; c = c->next) {
77 if(isvisible(c)) {
78 if(c->isbanned)
79 XMoveWindow(dpy, c->win, c->x, c->y);
80 c->isbanned = False;
81 resize(c, c->x, c->y, c->w, c->h, True);
82 }
83 else {
84 c->isbanned = True;
85 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
86 }
87 }
88 if(!sel || !isvisible(sel)) {
89 for(c = stack; c && !isvisible(c); c = c->snext);
90 focus(c);
91 }
92 restack();
93}
94
95void
73focusclient(const char *arg) { 96focusclient(const char *arg) {
74 Client *c; 97 Client *c;
75 98
@@ -144,7 +167,7 @@ initlayouts(void) {
144 167
145Client * 168Client *
146nexttiled(Client *c) { 169nexttiled(Client *c) {
147 for(; c && (c->isuntiled || !isvisible(c)); c = c->next); 170 for(; c && (c->isfloating || !isvisible(c)); c = c->next);
148 return c; 171 return c;
149} 172}
150 173
@@ -156,10 +179,10 @@ restack(void) {
156 drawstatus(); 179 drawstatus();
157 if(!sel) 180 if(!sel)
158 return; 181 return;
159 if(sel->isuntiled || lt->arrange == untile) 182 if(sel->isfloating || lt->arrange == floating)
160 XRaiseWindow(dpy, sel->win); 183 XRaiseWindow(dpy, sel->win);
161 if(lt->arrange != untile) { 184 if(lt->arrange != floating) {
162 if(!sel->isuntiled) 185 if(!sel->isfloating)
163 XLowerWindow(dpy, sel->win); 186 XLowerWindow(dpy, sel->win);
164 for(c = nexttiled(clients); c; c = nexttiled(c->next)) { 187 for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
165 if(c == sel) 188 if(c == sel)
@@ -198,7 +221,7 @@ void
198togglemax(const char *arg) { 221togglemax(const char *arg) {
199 XEvent ev; 222 XEvent ev;
200 223
201 if(!sel || (lt->arrange != untile && !sel->isuntiled) || sel->isfixed) 224 if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
202 return; 225 return;
203 if((sel->ismax = !sel->ismax)) { 226 if((sel->ismax = !sel->ismax)) {
204 sel->rx = sel->x; 227 sel->rx = sel->x;
@@ -214,34 +237,11 @@ togglemax(const char *arg) {
214} 237}
215 238
216void 239void
217untile(void) {
218 Client *c;
219
220 for(c = clients; c; c = c->next) {
221 if(isvisible(c)) {
222 if(c->isbanned)
223 XMoveWindow(dpy, c->win, c->x, c->y);
224 c->isbanned = False;
225 resize(c, c->x, c->y, c->w, c->h, True);
226 }
227 else {
228 c->isbanned = True;
229 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
230 }
231 }
232 if(!sel || !isvisible(sel)) {
233 for(c = stack; c && !isvisible(c); c = c->snext);
234 focus(c);
235 }
236 restack();
237}
238
239void
240zoom(const char *arg) { 240zoom(const char *arg) {
241 unsigned int n; 241 unsigned int n;
242 Client *c; 242 Client *c;
243 243
244 if(!sel || lt->arrange != tile || sel->isuntiled) 244 if(!sel || lt->arrange != tile || sel->isfloating)
245 return; 245 return;
246 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) 246 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
247 n++; 247 n++;
diff --git a/tag.c b/tag.c
index b8539ac..d121c78 100644
--- a/tag.c
+++ b/tag.c
@@ -12,7 +12,7 @@
12typedef struct { 12typedef struct {
13 const char *prop; 13 const char *prop;
14 const char *tags; 14 const char *tags;
15 Bool isuntiled; 15 Bool isfloating;
16} Rule; 16} Rule;
17 17
18typedef struct { 18typedef struct {
@@ -83,7 +83,7 @@ settags(Client *c, Client *trans) {
83 ch.res_name ? ch.res_name : "", c->name); 83 ch.res_name ? ch.res_name : "", c->name);
84 for(i = 0; i < nrules; i++) 84 for(i = 0; i < nrules; i++)
85 if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { 85 if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
86 c->isuntiled = rule[i].isuntiled; 86 c->isfloating = rule[i].isfloating;
87 for(j = 0; regs[i].tagregex && j < ntags; j++) { 87 for(j = 0; regs[i].tagregex && j < ntags; j++) {
88 if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { 88 if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
89 matched = True; 89 matched = True;