diff options
| author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-13 09:32:22 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-13 09:32:22 +0200 |
| commit | 650a1fb4e1a798aca48a53739f5bb2649191bc1c (patch) | |
| tree | 24684f376a1016a4ccbb01f3f96ca08c01383eee | |
| parent | new stuff (some warning elimination) (diff) | |
| download | dwm-650a1fb4e1a798aca48a53739f5bb2649191bc1c.tar.gz dwm-650a1fb4e1a798aca48a53739f5bb2649191bc1c.zip | |
added logo+description
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 24 | ||||
| -rw-r--r-- | README | 25 | ||||
| -rw-r--r-- | client.c | 55 | ||||
| -rw-r--r-- | config.mk | 8 | ||||
| -rw-r--r-- | draw.c | 73 | ||||
| -rw-r--r-- | dwm.1 (renamed from gridwm.1) | 0 | ||||
| -rw-r--r-- | dwm.html | 77 | ||||
| -rw-r--r-- | kb.c | 5 | ||||
| -rw-r--r-- | logo.png | bin | 0 -> 387 bytes | |||
| -rw-r--r-- | util.c | 2 | ||||
| -rw-r--r-- | wm.c | 23 | ||||
| -rw-r--r-- | wm.h | 17 |
12 files changed, 194 insertions, 115 deletions
| @@ -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 | ||
| 4 | include config.mk | 4 | include config.mk |
| 5 | 5 | ||
| 6 | SRC = client.c draw.c event.c kb.c mouse.c util.c wm.c | 6 | SRC = client.c draw.c event.c kb.c mouse.c util.c wm.c |
| 7 | OBJ = ${SRC:.c=.o} | 7 | OBJ = ${SRC:.c=.o} |
| 8 | MAN1 = gridwm.1 | 8 | MAN1 = dwm.1 |
| 9 | BIN = gridwm | 9 | BIN = dwm |
| 10 | 10 | ||
| 11 | all: config gridwm | 11 | all: config dwm |
| 12 | @echo finished | 12 | @echo finished |
| 13 | 13 | ||
| 14 | config: | 14 | config: |
| 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 | ||
| 27 | gridwm: ${OBJ} | 27 | dwm: ${OBJ} |
| 28 | @echo LD $@ | 28 | @echo LD $@ |
| 29 | @${CC} -o $@ ${OBJ} ${LDFLAGS} | 29 | @${CC} -o $@ ${OBJ} ${LDFLAGS} |
| 30 | 30 | ||
| 31 | clean: | 31 | clean: |
| 32 | rm -f gridwm *.o core | 32 | rm -f dwm *.o core |
| 33 | 33 | ||
| 34 | dist: clean | 34 | dist: 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 | ||
| 41 | install: all | 41 | install: all |
| 42 | @mkdir -p ${DESTDIR}${PREFIX}/bin | 42 | @mkdir -p ${DESTDIR}${PREFIX}/bin |
| @@ -1,41 +1,40 @@ | |||
| 1 | gridwm | 1 | dwm |
| 2 | ------ | 2 | ------ |
| 3 | 3 | ||
| 4 | gridwm is an extremly fast, small, and automatic X11 window manager. It | 4 | dwm is an extremly fast, small, and dynamic X11 window manager. |
| 5 | arranges all windows in a grid. | ||
| 6 | 5 | ||
| 7 | 6 | ||
| 8 | Requirements | 7 | Requirements |
| 9 | ------------ | 8 | ------------ |
| 10 | In order to build gridwm you need the Xlib header files. | 9 | In order to build dwm you need the Xlib header files. |
| 11 | 10 | ||
| 12 | 11 | ||
| 13 | Installation | 12 | Installation |
| 14 | ------------ | 13 | ------------ |
| 15 | Edit config.mk to match your local setup. gridwm is installed into | 14 | Edit config.mk to match your local setup. dwm is installed into |
| 16 | the /usr/local namespace by default. | 15 | the /usr/local namespace by default. |
| 17 | 16 | ||
| 18 | Afterwards enter the following command to build and install gridwm (if | 17 | Afterwards enter the following command to build and install dwm (if |
| 19 | necessary as root): | 18 | necessary as root): |
| 20 | 19 | ||
| 21 | make clean install | 20 | make clean install |
| 22 | 21 | ||
| 23 | 22 | ||
| 24 | Running gridwm | 23 | Running dwm |
| 25 | -------------- | 24 | -------------- |
| 26 | Add the following line to your .xinitrc to start gridwm using startx: | 25 | Add the following line to your .xinitrc to start dwm using startx: |
| 27 | 26 | ||
| 28 | exec gridwm | 27 | exec dwm |
| 29 | 28 | ||
| 30 | In order to connect gridwm to a specific display, make sure that | 29 | In order to connect dwm to a specific display, make sure that |
| 31 | the DISPLAY environment variable is set correctly, e.g.: | 30 | the 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 | ||
| 35 | This will start gridwm on display :1 of the host foo.bar. | 34 | This will start dwm on display :1 of the host foo.bar. |
| 36 | 35 | ||
| 37 | 36 | ||
| 38 | Configuration | 37 | Configuration |
| 39 | ------------- | 38 | ------------- |
| 40 | The configuration of gridwm is done by customizing the wm.h source file. To | 39 | The configuration of dwm is done by customizing the wm.h source file. To |
| 41 | customize the key bindings edit kb.c. | 40 | customize the key bindings edit kb.c. |
| @@ -11,7 +11,9 @@ | |||
| 11 | 11 | ||
| 12 | #include "wm.h" | 12 | #include "wm.h" |
| 13 | 13 | ||
| 14 | void (*arrange)(void *aux); | 14 | static void floating(void); |
| 15 | static void tiling(void); | ||
| 16 | static void (*arrange)(void) = tiling; | ||
| 15 | 17 | ||
| 16 | void | 18 | void |
| 17 | max(void *aux) | 19 | max(void *aux) |
| @@ -26,25 +28,23 @@ max(void *aux) | |||
| 26 | discard_events(EnterWindowMask); | 28 | discard_events(EnterWindowMask); |
| 27 | } | 29 | } |
| 28 | 30 | ||
| 29 | void | 31 | static void |
| 30 | floating(void *aux) | 32 | floating(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 | ||
| 40 | void | 41 | static void |
| 41 | grid(void *aux) | 42 | tiling(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 | ||
| 78 | void | 78 | void |
| 79 | toggle(void *aux) | ||
| 80 | { | ||
| 81 | if(arrange == floating) | ||
| 82 | arrange = tiling; | ||
| 83 | else | ||
| 84 | arrange = floating; | ||
| 85 | arrange(); | ||
| 86 | } | ||
| 87 | |||
| 88 | |||
| 89 | void | ||
| 79 | sel(void *aux) | 90 | sel(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 | } |
| @@ -14,14 +14,10 @@ VERSION = 0.0 | |||
| 14 | LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11 | 14 | LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11 |
| 15 | 15 | ||
| 16 | # Linux/BSD | 16 | # Linux/BSD |
| 17 | CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ | 17 | CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ |
| 18 | -DVERSION=\"${VERSION}\" | 18 | -DVERSION=\"${VERSION}\" |
| 19 | LDFLAGS = ${LIBS} | 19 | LDFLAGS = -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}\" |
| @@ -11,39 +11,39 @@ | |||
| 11 | #include "wm.h" | 11 | #include "wm.h" |
| 12 | 12 | ||
| 13 | static void | 13 | static void |
| 14 | drawborder(Brush *b) | 14 | drawborder(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 | ||
| 32 | void | 32 | void |
| 33 | draw(Brush *b, Bool border, const char *text) | 33 | draw(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 | ||
| 82 | static unsigned long | 82 | static unsigned long |
| 83 | xloadcolors(Colormap cmap, const char *colstr) | 83 | xinitcolors(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 | ||
| 90 | void | 90 | void |
| 91 | loadcolors(int scr, Brush *b, | 91 | initcolors(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 | ||
| 100 | unsigned int | 99 | unsigned int |
| @@ -121,7 +120,7 @@ texth(Fnt *font) | |||
| 121 | } | 120 | } |
| 122 | 121 | ||
| 123 | void | 122 | void |
| 124 | loadfont(Fnt *font, const char *fontstr) | 123 | initfont(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/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> | ||
| @@ -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 | }; |
| 16 | const char *browse[] = { "firefox", NULL }; | ||
| 16 | 17 | ||
| 17 | static Key key[] = { | 18 | static 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 | |||
| @@ -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); |
| @@ -37,17 +37,17 @@ char stext[1024]; | |||
| 37 | int tsel = Tdev; /* default tag */ | 37 | int tsel = Tdev; /* default tag */ |
| 38 | int screen, sx, sy, sw, sh, th; | 38 | int screen, sx, sy, sw, sh, th; |
| 39 | 39 | ||
| 40 | Brush brush = {0}; | 40 | DC dc = {0}; |
| 41 | Client *clients = NULL; | 41 | Client *clients = NULL; |
| 42 | Client *stack = NULL; | 42 | Client *stack = NULL; |
| 43 | 43 | ||
| 44 | static Bool other_wm_running; | 44 | static Bool other_wm_running; |
| 45 | static const char version[] = | 45 | static const char version[] = |
| 46 | "gridwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; | 46 | "dwm - " VERSION ", (C)opyright MMVI Anselm R. Garbe\n"; |
| 47 | static int (*x_error_handler) (Display *, XErrorEvent *); | 47 | static int (*x_error_handler) (Display *, XErrorEvent *); |
| 48 | 48 | ||
| 49 | static void | 49 | static void |
| 50 | usage() { error("usage: gridwm [-v]\n"); } | 50 | usage() { error("usage: dwm [-v]\n"); } |
| 51 | 51 | ||
| 52 | static void | 52 | static void |
| 53 | scan_wins() | 53 | scan_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) { |
| @@ -19,7 +19,7 @@ enum { Tscratch, Tdev, Tirc, Twww, Twork, TLast }; | |||
| 19 | 19 | ||
| 20 | /********** CUSTOMIZE **********/ | 20 | /********** CUSTOMIZE **********/ |
| 21 | 21 | ||
| 22 | typedef struct Brush Brush; | 22 | typedef struct DC DC; |
| 23 | typedef struct Client Client; | 23 | typedef struct Client Client; |
| 24 | typedef struct Fnt Fnt; | 24 | typedef struct Fnt Fnt; |
| 25 | typedef struct Key Key; | 25 | typedef struct Key Key; |
| @@ -39,7 +39,7 @@ struct Fnt { | |||
| 39 | int height; | 39 | int height; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | struct Brush { | 42 | struct 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]; | |||
| 79 | extern Cursor cursor[CurLast]; | 79 | extern Cursor cursor[CurLast]; |
| 80 | extern Bool running, issel; | 80 | extern Bool running, issel; |
| 81 | extern void (*handler[LASTEvent]) (XEvent *); | 81 | extern void (*handler[LASTEvent]) (XEvent *); |
| 82 | extern void (*arrange)(void *aux); | ||
| 83 | 82 | ||
| 84 | extern int tsel, screen, sx, sy, sw, sh, th; | 83 | extern int tsel, screen, sx, sy, sw, sh, th; |
| 85 | extern char stext[1024], *tags[TLast]; | 84 | extern char stext[1024], *tags[TLast]; |
| 86 | 85 | ||
| 87 | extern Brush brush; | 86 | extern DC dc; |
| 88 | extern Client *clients, *stack; | 87 | extern Client *clients, *stack; |
| 89 | 88 | ||
| 90 | /* client.c */ | 89 | /* client.c */ |
| @@ -102,15 +101,13 @@ extern void lower(Client *c); | |||
| 102 | extern void ckill(void *aux); | 101 | extern void ckill(void *aux); |
| 103 | extern void sel(void *aux); | 102 | extern void sel(void *aux); |
| 104 | extern void max(void *aux); | 103 | extern void max(void *aux); |
| 105 | extern void floating(void *aux); | 104 | extern void toggle(void *aux); |
| 106 | extern void grid(void *aux); | ||
| 107 | extern void gravitate(Client *c, Bool invert); | 105 | extern void gravitate(Client *c, Bool invert); |
| 108 | 106 | ||
| 109 | /* draw.c */ | 107 | /* draw.c */ |
| 110 | extern void draw(Brush *b, Bool border, const char *text); | 108 | extern void draw(Bool border, const char *text); |
| 111 | extern void loadcolors(int scr, Brush *b, | 109 | extern void initcolors(const char *bg, const char *fg, const char *bo); |
| 112 | const char *bg, const char *fg, const char *bo); | 110 | extern void initfont(Fnt *font, const char *fontstr); |
| 113 | extern void loadfont(Fnt *font, const char *fontstr); | ||
| 114 | extern unsigned int textnw(Fnt *font, char *text, unsigned int len); | 111 | extern unsigned int textnw(Fnt *font, char *text, unsigned int len); |
| 115 | extern unsigned int textw(Fnt *font, char *text); | 112 | extern unsigned int textw(Fnt *font, char *text); |
| 116 | extern unsigned int texth(Fnt *font); | 113 | extern unsigned int texth(Fnt *font); |
