summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile24
-rw-r--r--README25
-rw-r--r--client.c55
-rw-r--r--config.mk8
-rw-r--r--draw.c73
-rw-r--r--dwm.1 (renamed from gridwm.1)0
-rw-r--r--dwm.html77
-rw-r--r--kb.c5
-rw-r--r--logo.pngbin0 -> 387 bytes
-rw-r--r--util.c2
-rw-r--r--wm.c23
-rw-r--r--wm.h17
12 files changed, 194 insertions, 115 deletions
diff --git a/Makefile b/Makefile
index 74ef9ed..35963ce 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,18 @@
1# gridwm - grid window manager 1# dwm - dynamic window manager
2# (C)opyright MMVI Anselm R. Garbe 2# (C)opyright MMVI Anselm R. Garbe
3 3
4include config.mk 4include config.mk
5 5
6SRC = client.c draw.c event.c kb.c mouse.c util.c wm.c 6SRC = client.c draw.c event.c kb.c mouse.c util.c wm.c
7OBJ = ${SRC:.c=.o} 7OBJ = ${SRC:.c=.o}
8MAN1 = gridwm.1 8MAN1 = dwm.1
9BIN = gridwm 9BIN = dwm
10 10
11all: config gridwm 11all: config dwm
12 @echo finished 12 @echo finished
13 13
14config: 14config:
15 @echo gridwm build options: 15 @echo dwm build options:
16 @echo "LIBS = ${LIBS}" 16 @echo "LIBS = ${LIBS}"
17 @echo "CFLAGS = ${CFLAGS}" 17 @echo "CFLAGS = ${CFLAGS}"
18 @echo "LDFLAGS = ${LDFLAGS}" 18 @echo "LDFLAGS = ${LDFLAGS}"
@@ -24,19 +24,19 @@ config:
24 24
25${OBJ}: wm.h 25${OBJ}: wm.h
26 26
27gridwm: ${OBJ} 27dwm: ${OBJ}
28 @echo LD $@ 28 @echo LD $@
29 @${CC} -o $@ ${OBJ} ${LDFLAGS} 29 @${CC} -o $@ ${OBJ} ${LDFLAGS}
30 30
31clean: 31clean:
32 rm -f gridwm *.o core 32 rm -f dwm *.o core
33 33
34dist: clean 34dist: clean
35 mkdir -p gridwm-${VERSION} 35 mkdir -p dwm-${VERSION}
36 cp -R Makefile README LICENSE config.mk *.h *.c ${MAN} gridwm-${VERSION} 36 cp -R Makefile README LICENSE config.mk *.h *.c ${MAN} dwm-${VERSION}
37 tar -cf gridwm-${VERSION}.tar gridwm-${VERSION} 37 tar -cf dwm-${VERSION}.tar dwm-${VERSION}
38 gzip gridwm-${VERSION}.tar 38 gzip dwm-${VERSION}.tar
39 rm -rf gridwm-${VERSION} 39 rm -rf dwm-${VERSION}
40 40
41install: all 41install: all
42 @mkdir -p ${DESTDIR}${PREFIX}/bin 42 @mkdir -p ${DESTDIR}${PREFIX}/bin
diff --git a/README b/README
index 55fe9cd..c8e24ef 100644
--- a/README
+++ b/README
@@ -1,41 +1,40 @@
1gridwm 1dwm
2------ 2------
3 3
4gridwm is an extremly fast, small, and automatic X11 window manager. It 4dwm is an extremly fast, small, and dynamic X11 window manager.
5arranges all windows in a grid.
6 5
7 6
8Requirements 7Requirements
9------------ 8------------
10In order to build gridwm you need the Xlib header files. 9In order to build dwm you need the Xlib header files.
11 10
12 11
13Installation 12Installation
14------------ 13------------
15Edit config.mk to match your local setup. gridwm is installed into 14Edit config.mk to match your local setup. dwm is installed into
16the /usr/local namespace by default. 15the /usr/local namespace by default.
17 16
18Afterwards enter the following command to build and install gridwm (if 17Afterwards enter the following command to build and install dwm (if
19necessary as root): 18necessary as root):
20 19
21 make clean install 20 make clean install
22 21
23 22
24Running gridwm 23Running dwm
25-------------- 24--------------
26Add the following line to your .xinitrc to start gridwm using startx: 25Add the following line to your .xinitrc to start dwm using startx:
27 26
28 exec gridwm 27 exec dwm
29 28
30In order to connect gridwm to a specific display, make sure that 29In order to connect dwm to a specific display, make sure that
31the DISPLAY environment variable is set correctly, e.g.: 30the DISPLAY environment variable is set correctly, e.g.:
32 31
33 DISPLAY=foo.bar:1 exec gridwm 32 DISPLAY=foo.bar:1 exec dwm
34 33
35This will start gridwm on display :1 of the host foo.bar. 34This will start dwm on display :1 of the host foo.bar.
36 35
37 36
38Configuration 37Configuration
39------------- 38-------------
40The configuration of gridwm is done by customizing the wm.h source file. To 39The configuration of dwm is done by customizing the wm.h source file. To
41customize the key bindings edit kb.c. 40customize the key bindings edit kb.c.
diff --git a/client.c b/client.c
index 6777473..679e2be 100644
--- a/client.c
+++ b/client.c
@@ -11,7 +11,9 @@
11 11
12#include "wm.h" 12#include "wm.h"
13 13
14void (*arrange)(void *aux); 14static void floating(void);
15static void tiling(void);
16static void (*arrange)(void) = tiling;
15 17
16void 18void
17max(void *aux) 19max(void *aux)
@@ -26,25 +28,23 @@ max(void *aux)
26 discard_events(EnterWindowMask); 28 discard_events(EnterWindowMask);
27} 29}
28 30
29void 31static void
30floating(void *aux) 32floating(void)
31{ 33{
32 Client *c; 34 Client *c;
33 35
34 arrange = floating;
35 for(c = stack; c; c = c->snext) 36 for(c = stack; c; c = c->snext)
36 resize(c); 37 resize(c);
37 discard_events(EnterWindowMask); 38 discard_events(EnterWindowMask);
38} 39}
39 40
40void 41static void
41grid(void *aux) 42tiling(void)
42{ 43{
43 Client *c; 44 Client *c;
44 int n, cols, rows, gw, gh, i, j; 45 int n, cols, rows, gw, gh, i, j;
45 float rt, fd; 46 float rt, fd;
46 47
47 arrange = grid;
48 if(!clients) 48 if(!clients)
49 return; 49 return;
50 for(n = 0, c = clients; c; c = c->next, n++); 50 for(n = 0, c = clients; c; c = c->next, n++);
@@ -76,6 +76,17 @@ grid(void *aux)
76} 76}
77 77
78void 78void
79toggle(void *aux)
80{
81 if(arrange == floating)
82 arrange = tiling;
83 else
84 arrange = floating;
85 arrange();
86}
87
88
89void
79sel(void *aux) 90sel(void *aux)
80{ 91{
81 const char *arg = aux; 92 const char *arg = aux;
@@ -114,8 +125,8 @@ resize_title(Client *c)
114 c->tw = 0; 125 c->tw = 0;
115 for(i = 0; i < TLast; i++) 126 for(i = 0; i < TLast; i++)
116 if(c->tags[i]) 127 if(c->tags[i])
117 c->tw += textw(&brush.font, c->tags[i]) + brush.font.height; 128 c->tw += textw(&dc.font, c->tags[i]) + dc.font.height;
118 c->tw += textw(&brush.font, c->name) + brush.font.height; 129 c->tw += textw(&dc.font, c->name) + dc.font.height;
119 if(c->tw > c->w) 130 if(c->tw > c->w)
120 c->tw = c->w + 2; 131 c->tw = c->w + 2;
121 c->tx = c->x + c->w - c->tw + 2; 132 c->tx = c->x + c->w - c->tw + 2;
@@ -240,7 +251,7 @@ manage(Window w, XWindowAttributes *wa)
240 c->border = 1; 251 c->border = 1;
241 update_size(c); 252 update_size(c);
242 XSetWindowBorderWidth(dpy, c->win, 1); 253 XSetWindowBorderWidth(dpy, c->win, 1);
243 XSetWindowBorder(dpy, c->win, brush.border); 254 XSetWindowBorder(dpy, c->win, dc.border);
244 XSelectInput(dpy, c->win, 255 XSelectInput(dpy, c->win,
245 StructureNotifyMask | PropertyChangeMask | EnterWindowMask); 256 StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
246 XGetTransientForHint(dpy, c->win, &c->trans); 257 XGetTransientForHint(dpy, c->win, &c->trans);
@@ -266,7 +277,7 @@ manage(Window w, XWindowAttributes *wa)
266 GrabModeAsync, GrabModeSync, None, None); 277 GrabModeAsync, GrabModeSync, None, None);
267 XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask, 278 XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
268 GrabModeAsync, GrabModeSync, None, None); 279 GrabModeAsync, GrabModeSync, None, None);
269 arrange(NULL); 280 arrange();
270 focus(c); 281 focus(c);
271} 282}
272 283
@@ -385,7 +396,7 @@ unmanage(Client *c)
385 XFlush(dpy); 396 XFlush(dpy);
386 XSetErrorHandler(error_handler); 397 XSetErrorHandler(error_handler);
387 XUngrabServer(dpy); 398 XUngrabServer(dpy);
388 arrange(NULL); 399 arrange();
389 if(stack) 400 if(stack)
390 focus(stack); 401 focus(stack);
391} 402}
@@ -417,21 +428,21 @@ draw_client(Client *c)
417 if(c == stack) 428 if(c == stack)
418 return; 429 return;
419 430
420 brush.x = brush.y = 0; 431 dc.x = dc.y = 0;
421 brush.h = c->th; 432 dc.h = c->th;
422 433
423 brush.w = 0; 434 dc.w = 0;
424 for(i = 0; i < TLast; i++) { 435 for(i = 0; i < TLast; i++) {
425 if(c->tags[i]) { 436 if(c->tags[i]) {
426 brush.x += brush.w; 437 dc.x += dc.w;
427 brush.w = textw(&brush.font, c->tags[i]) + brush.font.height; 438 dc.w = textw(&dc.font, c->tags[i]) + dc.font.height;
428 draw(&brush, True, c->tags[i]); 439 draw(True, c->tags[i]);
429 } 440 }
430 } 441 }
431 brush.x += brush.w; 442 dc.x += dc.w;
432 brush.w = textw(&brush.font, c->name) + brush.font.height; 443 dc.w = textw(&dc.font, c->name) + dc.font.height;
433 draw(&brush, True, c->name); 444 draw(True, c->name);
434 XCopyArea(dpy, brush.drawable, c->title, brush.gc, 445 XCopyArea(dpy, dc.drawable, c->title, dc.gc,
435 0, 0, c->tw, c->th, 0, 0); 446 0, 0, c->tw, c->th, 0, 0);
436 XFlush(dpy); 447 XFlush(dpy);
437} 448}
diff --git a/config.mk b/config.mk
index 9857f93..33edcd7 100644
--- a/config.mk
+++ b/config.mk
@@ -14,14 +14,10 @@ VERSION = 0.0
14LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11 14LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11
15 15
16# Linux/BSD 16# Linux/BSD
17CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ 17CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
18 -DVERSION=\"${VERSION}\" 18 -DVERSION=\"${VERSION}\"
19LDFLAGS = ${LIBS} 19LDFLAGS = -g ${LIBS}
20#CFLAGS += -W -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Waggregate-return -Wnested-externs -Winline -Wwrite-strings -Wundef -Wsign-compare -Wmissing-prototypes -Wredundant-decls
21 20
22#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
23# -DVERSION=\"${VERSION}\"
24#LDFLAGS = -g ${LIBS}
25 21
26# Solaris 22# Solaris
27#CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\" 23#CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\"
diff --git a/draw.c b/draw.c
index 1046322..455c137 100644
--- a/draw.c
+++ b/draw.c
@@ -11,39 +11,39 @@
11#include "wm.h" 11#include "wm.h"
12 12
13static void 13static void
14drawborder(Brush *b) 14drawborder(void)
15{ 15{
16 XPoint points[5]; 16 XPoint points[5];
17 XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter); 17 XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
18 XSetForeground(dpy, b->gc, b->border); 18 XSetForeground(dpy, dc.gc, dc.border);
19 points[0].x = b->x; 19 points[0].x = dc.x;
20 points[0].y = b->y; 20 points[0].y = dc.y;
21 points[1].x = b->w - 1; 21 points[1].x = dc.w - 1;
22 points[1].y = 0; 22 points[1].y = 0;
23 points[2].x = 0; 23 points[2].x = 0;
24 points[2].y = b->h - 1; 24 points[2].y = dc.h - 1;
25 points[3].x = -(b->w - 1); 25 points[3].x = -(dc.w - 1);
26 points[3].y = 0; 26 points[3].y = 0;
27 points[4].x = 0; 27 points[4].x = 0;
28 points[4].y = -(b->h - 1); 28 points[4].y = -(dc.h - 1);
29 XDrawLines(dpy, b->drawable, b->gc, points, 5, CoordModePrevious); 29 XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious);
30} 30}
31 31
32void 32void
33draw(Brush *b, Bool border, const char *text) 33draw(Bool border, const char *text)
34{ 34{
35 int x, y, w, h; 35 int x, y, w, h;
36 unsigned int len; 36 unsigned int len;
37 static char buf[256]; 37 static char buf[256];
38 XGCValues gcv; 38 XGCValues gcv;
39 XRectangle r = { b->x, b->y, b->w, b->h }; 39 XRectangle r = { dc.x, dc.y, dc.w, dc.h };
40 40
41 XSetForeground(dpy, b->gc, b->bg); 41 XSetForeground(dpy, dc.gc, dc.bg);
42 XFillRectangles(dpy, b->drawable, b->gc, &r, 1); 42 XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
43 43
44 w = 0; 44 w = 0;
45 if(border) 45 if(border)
46 drawborder(b); 46 drawborder();
47 47
48 if(!text) 48 if(!text)
49 return; 49 return;
@@ -54,33 +54,33 @@ draw(Brush *b, Bool border, const char *text)
54 memcpy(buf, text, len); 54 memcpy(buf, text, len);
55 buf[len] = 0; 55 buf[len] = 0;
56 56
57 h = b->font.ascent + b->font.descent; 57 h = dc.font.ascent + dc.font.descent;
58 y = b->y + (b->h / 2) - (h / 2) + b->font.ascent; 58 y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
59 x = b->x + (h / 2); 59 x = dc.x + (h / 2);
60 60
61 /* shorten text if necessary */ 61 /* shorten text if necessary */
62 while(len && (w = textnw(&b->font, buf, len)) > b->w - h) 62 while(len && (w = textnw(&dc.font, buf, len)) > dc.w - h)
63 buf[--len] = 0; 63 buf[--len] = 0;
64 64
65 if(w > b->w) 65 if(w > dc.w)
66 return; /* too long */ 66 return; /* too long */
67 67
68 gcv.foreground = b->fg; 68 gcv.foreground = dc.fg;
69 gcv.background = b->bg; 69 gcv.background = dc.bg;
70 if(b->font.set) { 70 if(dc.font.set) {
71 XChangeGC(dpy, b->gc, GCForeground | GCBackground, &gcv); 71 XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv);
72 XmbDrawImageString(dpy, b->drawable, b->font.set, b->gc, 72 XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc,
73 x, y, buf, len); 73 x, y, buf, len);
74 } 74 }
75 else { 75 else {
76 gcv.font = b->font.xfont->fid; 76 gcv.font = dc.font.xfont->fid;
77 XChangeGC(dpy, b->gc, GCForeground | GCBackground | GCFont, &gcv); 77 XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv);
78 XDrawImageString(dpy, b->drawable, b->gc, x, y, buf, len); 78 XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len);
79 } 79 }
80} 80}
81 81
82static unsigned long 82static unsigned long
83xloadcolors(Colormap cmap, const char *colstr) 83xinitcolors(Colormap cmap, const char *colstr)
84{ 84{
85 XColor color; 85 XColor color;
86 XAllocNamedColor(dpy, cmap, colstr, &color, &color); 86 XAllocNamedColor(dpy, cmap, colstr, &color, &color);
@@ -88,13 +88,12 @@ xloadcolors(Colormap cmap, const char *colstr)
88} 88}
89 89
90void 90void
91loadcolors(int scr, Brush *b, 91initcolors(const char *bg, const char *fg, const char *border)
92 const char *bg, const char *fg, const char *border)
93{ 92{
94 Colormap cmap = DefaultColormap(dpy, scr); 93 Colormap cmap = DefaultColormap(dpy, screen);
95 b->bg = xloadcolors(cmap, bg); 94 dc.bg = xinitcolors(cmap, bg);
96 b->fg = xloadcolors(cmap, fg); 95 dc.fg = xinitcolors(cmap, fg);
97 b->border = xloadcolors(cmap, border); 96 dc.border = xinitcolors(cmap, border);
98} 97}
99 98
100unsigned int 99unsigned int
@@ -121,7 +120,7 @@ texth(Fnt *font)
121} 120}
122 121
123void 122void
124loadfont(Fnt *font, const char *fontstr) 123initfont(Fnt *font, const char *fontstr)
125{ 124{
126 char **missing, *def; 125 char **missing, *def;
127 int i, n; 126 int i, n;
@@ -164,7 +163,7 @@ loadfont(Fnt *font, const char *fontstr)
164 if (!font->xfont) 163 if (!font->xfont)
165 font->xfont = XLoadQueryFont(dpy, "fixed"); 164 font->xfont = XLoadQueryFont(dpy, "fixed");
166 if (!font->xfont) 165 if (!font->xfont)
167 error("error, cannot load 'fixed' font\n"); 166 error("error, cannot init 'fixed' font\n");
168 font->ascent = font->xfont->ascent; 167 font->ascent = font->xfont->ascent;
169 font->descent = font->xfont->descent; 168 font->descent = font->xfont->descent;
170 } 169 }
diff --git a/gridwm.1 b/dwm.1
index 02a6b6a..02a6b6a 100644
--- a/gridwm.1
+++ b/dwm.1
diff --git a/dwm.html b/dwm.html
new file mode 100644
index 0000000..b617c8c
--- /dev/null
+++ b/dwm.html
@@ -0,0 +1,77 @@
1<html>
2 <head>
3 <title>dwm - dynamic window manager</title>
4 <meta name="author" content="Anselm R. Garbe">
5 <meta name="generator" content="ed">
6 <meta name="copyright" content="(C)opyright 2006 by Anselm R. Garbe">
7 <style type="text/css">
8 body {
9 color: #000000;
10 font-family: sans-serif;
11 }
12 </style>
13 </head>
14 <body>
15 <center>
16 <img src="logo.png"/><br />
17 <h3>dynamic window manager</h3>
18 <center>
19 <h2>Description</h3>
20 <p>
21 dwm is a dynamic window manager for X11.
22 </p>
23 <h2>Differences to wmii</h2
24 <p>
25 In contrast to wmii, dwm is only a window manager, and nothing else.
26 Hence, it is much smaller, faster and simpler. dwm does
27 <b>not</b> include following features wmii provides:
28 </p>
29 <ul>
30 <li>9P support</li>
31 <li>status bar</li>
32 <li>menu</li>
33 <li>editable tagbars</li>
34 <li>shell-based config/control file</li>
35 <li>small tools (selection printer, mouse warper)</li>
36 </ul>
37 <p>
38 dwm is only a single binary, it's source code is intended to never
39 exceed 2000 SLOC.
40 </p>
41 <p>
42 dwm is customized through editing its source code, that makes it
43 extremely fast and secure - it does not process any input data which
44 hasn't been known at compile time, except window title names.
45 </p>
46 <p>
47 dwm is based on tagging and dynamic window management (however simpler
48 than wmii or larswm).
49 </p>
50 <p>
51 dwm don't distinguishes between layers, there is no floating or managed
52 layer. Wether the clients of currently selected tag are managed or not
53 managed, you can re-arrange all clients on the fly. Popup- and
54 fixed-size windows are treated unmanaged.
55 </p>
56 <p>
57 dwm uses 1-pixel borders to provide the maximum of screen real
58 estate to clients. Small titlebars are only drawn in front of unfocused
59 clients.
60 </p>
61 <p>
62 garbeam <b>don't</b> wants any feedback to dwm. If you ask for support,
63 feature requests or if you report bugs, they will be <b>ignored</b>
64 with a high chance. dwm is only intended to fit garbeam's needs,
65 however you are free to download and distribute/relicense it, with the
66 conditions of the <a href="http://wmii.de/cgi-bin/hgwebdir.cgi/dwm?f=f10eb1139362;file=LICENSE;style=raw">MIT/X Consortium license</a>.
67 </p>
68 <h2>Development</h2>
69 <p>
70 dwm is actively developed in parallel to wmii. You can <a href="http://wmii.de/cgi-bin/hgwebdir.cgi/dwm">browse</a> its source code repository or get a copy using <a href="http://www.selenic.com/mercurial/">Mercurial</a> with following command:
71 </p>
72 <p>
73 <em>hg clone http://wmii.de/cgi-bin/hgwebdir.cgi/dwm</em>
74 </p>
75 <p>--Anselm</p>
76 </body>
77</html>
diff --git a/kb.c b/kb.c
index f93f69f..5999c6e 100644
--- a/kb.c
+++ b/kb.c
@@ -13,13 +13,14 @@ const char *term[] = {
13 "aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn", 13 "aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
14 "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL 14 "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
15}; 15};
16const char *browse[] = { "firefox", NULL };
16 17
17static Key key[] = { 18static Key key[] = {
18 { Mod1Mask, XK_Return, (void (*)(void *))spawn, term }, 19 { Mod1Mask, XK_Return, (void (*)(void *))spawn, term },
20 { Mod1Mask, XK_w, (void (*)(void *))spawn, browse },
19 { Mod1Mask, XK_k, sel, "prev" }, 21 { Mod1Mask, XK_k, sel, "prev" },
20 { Mod1Mask, XK_j, sel, "next" }, 22 { Mod1Mask, XK_j, sel, "next" },
21 { Mod1Mask, XK_g, grid, NULL }, 23 { Mod1Mask, XK_space, toggle, NULL },
22 { Mod1Mask, XK_f, floating, NULL },
23 { Mod1Mask, XK_m, max, NULL }, 24 { Mod1Mask, XK_m, max, NULL },
24 { Mod1Mask | ShiftMask, XK_c, ckill, NULL }, 25 { Mod1Mask | ShiftMask, XK_c, ckill, NULL },
25 { Mod1Mask | ShiftMask, XK_q, quit, NULL }, 26 { Mod1Mask | ShiftMask, XK_q, quit, NULL },
diff --git a/logo.png b/logo.png
new file mode 100644
index 0000000..ebfc8ed
--- /dev/null
+++ b/logo.png
Binary files differ
diff --git a/util.c b/util.c
index 09fd872..0a5bd96 100644
--- a/util.c
+++ b/util.c
@@ -85,7 +85,7 @@ spawn(char *argv[])
85 close(ConnectionNumber(dpy)); 85 close(ConnectionNumber(dpy));
86 setsid(); 86 setsid();
87 execvp(argv[0], argv); 87 execvp(argv[0], argv);
88 fprintf(stderr, "gridwm: execvp %s", argv[0]); 88 fprintf(stderr, "dwm: execvp %s", argv[0]);
89 perror(" failed"); 89 perror(" failed");
90 } 90 }
91 exit (0); 91 exit (0);
diff --git a/wm.c b/wm.c
index 6d67bfc..ed002f7 100644
--- a/wm.c
+++ b/wm.c
@@ -37,17 +37,17 @@ char stext[1024];
37int tsel = Tdev; /* default tag */ 37int tsel = Tdev; /* default tag */
38int screen, sx, sy, sw, sh, th; 38int screen, sx, sy, sw, sh, th;
39 39
40Brush brush = {0}; 40DC dc = {0};
41Client *clients = NULL; 41Client *clients = NULL;
42Client *stack = NULL; 42Client *stack = NULL;
43 43
44static Bool other_wm_running; 44static Bool other_wm_running;
45static const char version[] = 45static const char version[] =
46 "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; 46 "dwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
47static int (*x_error_handler) (Display *, XErrorEvent *); 47static int (*x_error_handler) (Display *, XErrorEvent *);
48 48
49static void 49static void
50usage() { error("usage: gridwm [-v]\n"); } 50usage() { error("usage: dwm [-v]\n"); }
51 51
52static void 52static void
53scan_wins() 53scan_wins()
@@ -149,7 +149,7 @@ error_handler(Display *dpy, XErrorEvent *error)
149 || (error->request_code == X_GrabKey 149 || (error->request_code == X_GrabKey
150 && error->error_code == BadAccess)) 150 && error->error_code == BadAccess))
151 return 0; 151 return 0;
152 fprintf(stderr, "gridwm: fatal error: request code=%d, error code=%d\n", 152 fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n",
153 error->request_code, error->error_code); 153 error->request_code, error->error_code);
154 return x_error_handler(dpy, error); /* may call exit() */ 154 return x_error_handler(dpy, error); /* may call exit() */
155} 155}
@@ -203,7 +203,7 @@ main(int argc, char *argv[])
203 203
204 dpy = XOpenDisplay(0); 204 dpy = XOpenDisplay(0);
205 if(!dpy) 205 if(!dpy)
206 error("gridwm: cannot connect X server\n"); 206 error("dwm: cannot connect X server\n");
207 207
208 screen = DefaultScreen(dpy); 208 screen = DefaultScreen(dpy);
209 root = RootWindow(dpy, screen); 209 root = RootWindow(dpy, screen);
@@ -216,7 +216,7 @@ main(int argc, char *argv[])
216 XFlush(dpy); 216 XFlush(dpy);
217 217
218 if(other_wm_running) 218 if(other_wm_running)
219 error("gridwm: another window manager is already running\n"); 219 error("dwm: another window manager is already running\n");
220 220
221 sx = sy = 0; 221 sx = sy = 0;
222 sw = DisplayWidth(dpy, screen); 222 sw = DisplayWidth(dpy, screen);
@@ -244,20 +244,19 @@ main(int argc, char *argv[])
244 update_keys(); 244 update_keys();
245 245
246 /* style */ 246 /* style */
247 loadcolors(screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR); 247 initcolors(BGCOLOR, FGCOLOR, BORDERCOLOR);
248 loadfont(&brush.font, FONT); 248 initfont(&dc.font, FONT);
249 249
250 th = texth(&brush.font); 250 th = texth(&dc.font);
251 251
252 brush.drawable = XCreatePixmap(dpy, root, sw, th, DefaultDepth(dpy, screen)); 252 dc.drawable = XCreatePixmap(dpy, root, sw, th, DefaultDepth(dpy, screen));
253 brush.gc = XCreateGC(dpy, root, 0, 0); 253 dc.gc = XCreateGC(dpy, root, 0, 0);
254 254
255 wa.event_mask = SubstructureRedirectMask | EnterWindowMask \ 255 wa.event_mask = SubstructureRedirectMask | EnterWindowMask \
256 | LeaveWindowMask; 256 | LeaveWindowMask;
257 wa.cursor = cursor[CurNormal]; 257 wa.cursor = cursor[CurNormal];
258 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); 258 XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
259 259
260 arrange = grid;
261 scan_wins(); 260 scan_wins();
262 261
263 while(running) { 262 while(running) {
diff --git a/wm.h b/wm.h
index b5e1f71..9172dea 100644
--- a/wm.h
+++ b/wm.h
@@ -19,7 +19,7 @@ enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast };
19 19
20/********** CUSTOMIZE **********/ 20/********** CUSTOMIZE **********/
21 21
22typedef struct Brush Brush; 22typedef struct DC DC;
23typedef struct Client Client; 23typedef struct Client Client;
24typedef struct Fnt Fnt; 24typedef struct Fnt Fnt;
25typedef struct Key Key; 25typedef struct Key Key;
@@ -39,7 +39,7 @@ struct Fnt {
39 int height; 39 int height;
40}; 40};
41 41
42struct Brush { 42struct DC { /* draw context */
43 GC gc; 43 GC gc;
44 Drawable drawable; 44 Drawable drawable;
45 int x, y, w, h; 45 int x, y, w, h;
@@ -79,12 +79,11 @@ extern Atom wm_atom[WMLast], net_atom[NetLast];
79extern Cursor cursor[CurLast]; 79extern Cursor cursor[CurLast];
80extern Bool running, issel; 80extern Bool running, issel;
81extern void (*handler[LASTEvent]) (XEvent *); 81extern void (*handler[LASTEvent]) (XEvent *);
82extern void (*arrange)(void *aux);
83 82
84extern int tsel, screen, sx, sy, sw, sh, th; 83extern int tsel, screen, sx, sy, sw, sh, th;
85extern char stext[1024], *tags[TLast]; 84extern char stext[1024], *tags[TLast];
86 85
87extern Brush brush; 86extern DC dc;
88extern Client *clients, *stack; 87extern Client *clients, *stack;
89 88
90/* client.c */ 89/* client.c */
@@ -102,15 +101,13 @@ extern void lower(Client *c);
102extern void ckill(void *aux); 101extern void ckill(void *aux);
103extern void sel(void *aux); 102extern void sel(void *aux);
104extern void max(void *aux); 103extern void max(void *aux);
105extern void floating(void *aux); 104extern void toggle(void *aux);
106extern void grid(void *aux);
107extern void gravitate(Client *c, Bool invert); 105extern void gravitate(Client *c, Bool invert);
108 106
109/* draw.c */ 107/* draw.c */
110extern void draw(Brush *b, Bool border, const char *text); 108extern void draw(Bool border, const char *text);
111extern void loadcolors(int scr, Brush *b, 109extern void initcolors(const char *bg, const char *fg, const char *bo);
112 const char *bg, const char *fg, const char *bo); 110extern void initfont(Fnt *font, const char *fontstr);
113extern void loadfont(Fnt *font, const char *fontstr);
114extern unsigned int textnw(Fnt *font, char *text, unsigned int len); 111extern unsigned int textnw(Fnt *font, char *text, unsigned int len);
115extern unsigned int textw(Fnt *font, char *text); 112extern unsigned int textw(Fnt *font, char *text);
116extern unsigned int texth(Fnt *font); 113extern unsigned int texth(Fnt *font);