added logo+description
650a1fb4
12 file(s) · +194 −115
| 1 | - | # gridwm - grid window manager |
|
| 1 | + | # dwm - dynamic window manager |
|
| 2 | 2 | # (C)opyright MMVI Anselm R. Garbe |
|
| 3 | 3 | ||
| 4 | 4 | include config.mk |
|
| 5 | 5 | ||
| 6 | 6 | SRC = client.c draw.c event.c kb.c mouse.c util.c wm.c |
|
| 7 | 7 | OBJ = ${SRC:.c=.o} |
|
| 8 | - | MAN1 = gridwm.1 |
|
| 9 | - | BIN = gridwm |
|
| 8 | + | MAN1 = dwm.1 |
|
| 9 | + | BIN = dwm |
|
| 10 | 10 | ||
| 11 | - | all: config gridwm |
|
| 11 | + | all: config dwm |
|
| 12 | 12 | @echo finished |
|
| 13 | 13 | ||
| 14 | 14 | config: |
|
| 15 | - | @echo gridwm build options: |
|
| 15 | + | @echo dwm build options: |
|
| 16 | 16 | @echo "LIBS = ${LIBS}" |
|
| 17 | 17 | @echo "CFLAGS = ${CFLAGS}" |
|
| 18 | 18 | @echo "LDFLAGS = ${LDFLAGS}" |
|
| 24 | 24 | ||
| 25 | 25 | ${OBJ}: wm.h |
|
| 26 | 26 | ||
| 27 | - | gridwm: ${OBJ} |
|
| 27 | + | dwm: ${OBJ} |
|
| 28 | 28 | @echo LD $@ |
|
| 29 | 29 | @${CC} -o $@ ${OBJ} ${LDFLAGS} |
|
| 30 | 30 | ||
| 31 | 31 | clean: |
|
| 32 | - | rm -f gridwm *.o core |
|
| 32 | + | rm -f dwm *.o core |
|
| 33 | 33 | ||
| 34 | 34 | dist: clean |
|
| 35 | - | mkdir -p gridwm-${VERSION} |
|
| 36 | - | cp -R Makefile README LICENSE config.mk *.h *.c ${MAN} gridwm-${VERSION} |
|
| 37 | - | tar -cf gridwm-${VERSION}.tar gridwm-${VERSION} |
|
| 38 | - | gzip gridwm-${VERSION}.tar |
|
| 39 | - | rm -rf gridwm-${VERSION} |
|
| 35 | + | mkdir -p dwm-${VERSION} |
|
| 36 | + | cp -R Makefile README LICENSE config.mk *.h *.c ${MAN} dwm-${VERSION} |
|
| 37 | + | tar -cf dwm-${VERSION}.tar dwm-${VERSION} |
|
| 38 | + | gzip dwm-${VERSION}.tar |
|
| 39 | + | rm -rf dwm-${VERSION} |
|
| 40 | 40 | ||
| 41 | 41 | install: all |
|
| 42 | 42 | @mkdir -p ${DESTDIR}${PREFIX}/bin |
|
| 1 | - | gridwm |
|
| 1 | + | dwm |
|
| 2 | 2 | ------ |
|
| 3 | 3 | ||
| 4 | - | gridwm is an extremly fast, small, and automatic X11 window manager. It |
|
| 5 | - | arranges all windows in a grid. |
|
| 4 | + | dwm is an extremly fast, small, and dynamic X11 window manager. |
|
| 6 | 5 | ||
| 7 | 6 | ||
| 8 | 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 | 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 | 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 | 18 | necessary as root): |
|
| 20 | 19 | ||
| 21 | 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 | 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 | 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 | 40 | customize the key bindings edit kb.c. |
| 11 | 11 | ||
| 12 | 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 | 18 | void |
|
| 17 | 19 | max(void *aux) |
|
| 26 | 28 | discard_events(EnterWindowMask); |
|
| 27 | 29 | } |
|
| 28 | 30 | ||
| 29 | - | void |
|
| 30 | - | floating(void *aux) |
|
| 31 | + | static void |
|
| 32 | + | floating(void) |
|
| 31 | 33 | { |
|
| 32 | 34 | Client *c; |
|
| 33 | 35 | ||
| 34 | - | arrange = floating; |
|
| 35 | 36 | for(c = stack; c; c = c->snext) |
|
| 36 | 37 | resize(c); |
|
| 37 | 38 | discard_events(EnterWindowMask); |
|
| 38 | 39 | } |
|
| 39 | 40 | ||
| 40 | - | void |
|
| 41 | - | grid(void *aux) |
|
| 41 | + | static void |
|
| 42 | + | tiling(void) |
|
| 42 | 43 | { |
|
| 43 | 44 | Client *c; |
|
| 44 | 45 | int n, cols, rows, gw, gh, i, j; |
|
| 45 | 46 | float rt, fd; |
|
| 46 | 47 | ||
| 47 | - | arrange = grid; |
|
| 48 | 48 | if(!clients) |
|
| 49 | 49 | return; |
|
| 50 | 50 | for(n = 0, c = clients; c; c = c->next, n++); |
|
| 76 | 76 | } |
|
| 77 | 77 | ||
| 78 | 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 | 90 | sel(void *aux) |
|
| 80 | 91 | { |
|
| 81 | 92 | const char *arg = aux; |
|
| 114 | 125 | c->tw = 0; |
|
| 115 | 126 | for(i = 0; i < TLast; i++) |
|
| 116 | 127 | if(c->tags[i]) |
|
| 117 | - | c->tw += textw(&brush.font, c->tags[i]) + brush.font.height; |
|
| 118 | - | c->tw += textw(&brush.font, c->name) + brush.font.height; |
|
| 128 | + | c->tw += textw(&dc.font, c->tags[i]) + dc.font.height; |
|
| 129 | + | c->tw += textw(&dc.font, c->name) + dc.font.height; |
|
| 119 | 130 | if(c->tw > c->w) |
|
| 120 | 131 | c->tw = c->w + 2; |
|
| 121 | 132 | c->tx = c->x + c->w - c->tw + 2; |
|
| 240 | 251 | c->border = 1; |
|
| 241 | 252 | update_size(c); |
|
| 242 | 253 | XSetWindowBorderWidth(dpy, c->win, 1); |
|
| 243 | - | XSetWindowBorder(dpy, c->win, brush.border); |
|
| 254 | + | XSetWindowBorder(dpy, c->win, dc.border); |
|
| 244 | 255 | XSelectInput(dpy, c->win, |
|
| 245 | 256 | StructureNotifyMask | PropertyChangeMask | EnterWindowMask); |
|
| 246 | 257 | XGetTransientForHint(dpy, c->win, &c->trans); |
|
| 266 | 277 | GrabModeAsync, GrabModeSync, None, None); |
|
| 267 | 278 | XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask, |
|
| 268 | 279 | GrabModeAsync, GrabModeSync, None, None); |
|
| 269 | - | arrange(NULL); |
|
| 280 | + | arrange(); |
|
| 270 | 281 | focus(c); |
|
| 271 | 282 | } |
|
| 272 | 283 | ||
| 385 | 396 | XFlush(dpy); |
|
| 386 | 397 | XSetErrorHandler(error_handler); |
|
| 387 | 398 | XUngrabServer(dpy); |
|
| 388 | - | arrange(NULL); |
|
| 399 | + | arrange(); |
|
| 389 | 400 | if(stack) |
|
| 390 | 401 | focus(stack); |
|
| 391 | 402 | } |
|
| 417 | 428 | if(c == stack) |
|
| 418 | 429 | return; |
|
| 419 | 430 | ||
| 420 | - | brush.x = brush.y = 0; |
|
| 421 | - | brush.h = c->th; |
|
| 431 | + | dc.x = dc.y = 0; |
|
| 432 | + | dc.h = c->th; |
|
| 422 | 433 | ||
| 423 | - | brush.w = 0; |
|
| 434 | + | dc.w = 0; |
|
| 424 | 435 | for(i = 0; i < TLast; i++) { |
|
| 425 | 436 | if(c->tags[i]) { |
|
| 426 | - | brush.x += brush.w; |
|
| 427 | - | brush.w = textw(&brush.font, c->tags[i]) + brush.font.height; |
|
| 428 | - | draw(&brush, True, c->tags[i]); |
|
| 437 | + | dc.x += dc.w; |
|
| 438 | + | dc.w = textw(&dc.font, c->tags[i]) + dc.font.height; |
|
| 439 | + | draw(True, c->tags[i]); |
|
| 429 | 440 | } |
|
| 430 | 441 | } |
|
| 431 | - | brush.x += brush.w; |
|
| 432 | - | brush.w = textw(&brush.font, c->name) + brush.font.height; |
|
| 433 | - | draw(&brush, True, c->name); |
|
| 434 | - | XCopyArea(dpy, brush.drawable, c->title, brush.gc, |
|
| 442 | + | dc.x += dc.w; |
|
| 443 | + | dc.w = textw(&dc.font, c->name) + dc.font.height; |
|
| 444 | + | draw(True, c->name); |
|
| 445 | + | XCopyArea(dpy, dc.drawable, c->title, dc.gc, |
|
| 435 | 446 | 0, 0, c->tw, c->th, 0, 0); |
|
| 436 | 447 | XFlush(dpy); |
|
| 437 | 448 | } |
|
| 14 | 14 | LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11 |
|
| 15 | 15 | ||
| 16 | 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 | 18 | -DVERSION=\"${VERSION}\" |
|
| 19 | - | LDFLAGS = ${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 |
|
| 19 | + | LDFLAGS = -g ${LIBS} |
|
| 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 | 22 | # Solaris |
|
| 27 | 23 | #CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\" |
| 11 | 11 | #include "wm.h" |
|
| 12 | 12 | ||
| 13 | 13 | static void |
|
| 14 | - | drawborder(Brush *b) |
|
| 14 | + | drawborder(void) |
|
| 15 | 15 | { |
|
| 16 | 16 | XPoint points[5]; |
|
| 17 | - | XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter); |
|
| 18 | - | XSetForeground(dpy, b->gc, b->border); |
|
| 19 | - | points[0].x = b->x; |
|
| 20 | - | points[0].y = b->y; |
|
| 21 | - | points[1].x = b->w - 1; |
|
| 17 | + | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
|
| 18 | + | XSetForeground(dpy, dc.gc, dc.border); |
|
| 19 | + | points[0].x = dc.x; |
|
| 20 | + | points[0].y = dc.y; |
|
| 21 | + | points[1].x = dc.w - 1; |
|
| 22 | 22 | points[1].y = 0; |
|
| 23 | 23 | points[2].x = 0; |
|
| 24 | - | points[2].y = b->h - 1; |
|
| 25 | - | points[3].x = -(b->w - 1); |
|
| 24 | + | points[2].y = dc.h - 1; |
|
| 25 | + | points[3].x = -(dc.w - 1); |
|
| 26 | 26 | points[3].y = 0; |
|
| 27 | 27 | points[4].x = 0; |
|
| 28 | - | points[4].y = -(b->h - 1); |
|
| 29 | - | XDrawLines(dpy, b->drawable, b->gc, points, 5, CoordModePrevious); |
|
| 28 | + | points[4].y = -(dc.h - 1); |
|
| 29 | + | XDrawLines(dpy, dc.drawable, dc.gc, points, 5, CoordModePrevious); |
|
| 30 | 30 | } |
|
| 31 | 31 | ||
| 32 | 32 | void |
|
| 33 | - | draw(Brush *b, Bool border, const char *text) |
|
| 33 | + | draw(Bool border, const char *text) |
|
| 34 | 34 | { |
|
| 35 | 35 | int x, y, w, h; |
|
| 36 | 36 | unsigned int len; |
|
| 37 | 37 | static char buf[256]; |
|
| 38 | 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); |
|
| 42 | - | XFillRectangles(dpy, b->drawable, b->gc, &r, 1); |
|
| 41 | + | XSetForeground(dpy, dc.gc, dc.bg); |
|
| 42 | + | XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); |
|
| 43 | 43 | ||
| 44 | 44 | w = 0; |
|
| 45 | 45 | if(border) |
|
| 46 | - | drawborder(b); |
|
| 46 | + | drawborder(); |
|
| 47 | 47 | ||
| 48 | 48 | if(!text) |
|
| 49 | 49 | return; |
|
| 54 | 54 | memcpy(buf, text, len); |
|
| 55 | 55 | buf[len] = 0; |
|
| 56 | 56 | ||
| 57 | - | h = b->font.ascent + b->font.descent; |
|
| 58 | - | y = b->y + (b->h / 2) - (h / 2) + b->font.ascent; |
|
| 59 | - | x = b->x + (h / 2); |
|
| 57 | + | h = dc.font.ascent + dc.font.descent; |
|
| 58 | + | y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent; |
|
| 59 | + | x = dc.x + (h / 2); |
|
| 60 | 60 | ||
| 61 | 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 | 63 | buf[--len] = 0; |
|
| 64 | 64 | ||
| 65 | - | if(w > b->w) |
|
| 65 | + | if(w > dc.w) |
|
| 66 | 66 | return; /* too long */ |
|
| 67 | 67 | ||
| 68 | - | gcv.foreground = b->fg; |
|
| 69 | - | gcv.background = b->bg; |
|
| 70 | - | if(b->font.set) { |
|
| 71 | - | XChangeGC(dpy, b->gc, GCForeground | GCBackground, &gcv); |
|
| 72 | - | XmbDrawImageString(dpy, b->drawable, b->font.set, b->gc, |
|
| 68 | + | gcv.foreground = dc.fg; |
|
| 69 | + | gcv.background = dc.bg; |
|
| 70 | + | if(dc.font.set) { |
|
| 71 | + | XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); |
|
| 72 | + | XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc, |
|
| 73 | 73 | x, y, buf, len); |
|
| 74 | 74 | } |
|
| 75 | 75 | else { |
|
| 76 | - | gcv.font = b->font.xfont->fid; |
|
| 77 | - | XChangeGC(dpy, b->gc, GCForeground | GCBackground | GCFont, &gcv); |
|
| 78 | - | XDrawImageString(dpy, b->drawable, b->gc, x, y, buf, len); |
|
| 76 | + | gcv.font = dc.font.xfont->fid; |
|
| 77 | + | XChangeGC(dpy, dc.gc, GCForeground | GCBackground | GCFont, &gcv); |
|
| 78 | + | XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len); |
|
| 79 | 79 | } |
|
| 80 | 80 | } |
|
| 81 | 81 | ||
| 82 | 82 | static unsigned long |
|
| 83 | - | xloadcolors(Colormap cmap, const char *colstr) |
|
| 83 | + | xinitcolors(Colormap cmap, const char *colstr) |
|
| 84 | 84 | { |
|
| 85 | 85 | XColor color; |
|
| 86 | 86 | XAllocNamedColor(dpy, cmap, colstr, &color, &color); |
|
| 88 | 88 | } |
|
| 89 | 89 | ||
| 90 | 90 | void |
|
| 91 | - | loadcolors(int scr, Brush *b, |
|
| 92 | - | const char *bg, const char *fg, const char *border) |
|
| 91 | + | initcolors(const char *bg, const char *fg, const char *border) |
|
| 93 | 92 | { |
|
| 94 | - | Colormap cmap = DefaultColormap(dpy, scr); |
|
| 95 | - | b->bg = xloadcolors(cmap, bg); |
|
| 96 | - | b->fg = xloadcolors(cmap, fg); |
|
| 97 | - | b->border = xloadcolors(cmap, border); |
|
| 93 | + | Colormap cmap = DefaultColormap(dpy, screen); |
|
| 94 | + | dc.bg = xinitcolors(cmap, bg); |
|
| 95 | + | dc.fg = xinitcolors(cmap, fg); |
|
| 96 | + | dc.border = xinitcolors(cmap, border); |
|
| 98 | 97 | } |
|
| 99 | 98 | ||
| 100 | 99 | unsigned int |
|
| 121 | 120 | } |
|
| 122 | 121 | ||
| 123 | 122 | void |
|
| 124 | - | loadfont(Fnt *font, const char *fontstr) |
|
| 123 | + | initfont(Fnt *font, const char *fontstr) |
|
| 125 | 124 | { |
|
| 126 | 125 | char **missing, *def; |
|
| 127 | 126 | int i, n; |
|
| 164 | 163 | if (!font->xfont) |
|
| 165 | 164 | font->xfont = XLoadQueryFont(dpy, "fixed"); |
|
| 166 | 165 | if (!font->xfont) |
|
| 167 | - | error("error, cannot load 'fixed' font\n"); |
|
| 166 | + | error("error, cannot init 'fixed' font\n"); |
|
| 168 | 167 | font->ascent = font->xfont->ascent; |
|
| 169 | 168 | font->descent = font->xfont->descent; |
|
| 170 | 169 | } |
|
| 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 | "aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn", |
|
| 14 | 14 | "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL |
|
| 15 | 15 | }; |
|
| 16 | + | const char *browse[] = { "firefox", NULL }; |
|
| 16 | 17 | ||
| 17 | 18 | static Key key[] = { |
|
| 18 | 19 | { Mod1Mask, XK_Return, (void (*)(void *))spawn, term }, |
|
| 20 | + | { Mod1Mask, XK_w, (void (*)(void *))spawn, browse }, |
|
| 19 | 21 | { Mod1Mask, XK_k, sel, "prev" }, |
|
| 20 | 22 | { Mod1Mask, XK_j, sel, "next" }, |
|
| 21 | - | { Mod1Mask, XK_g, grid, NULL }, |
|
| 22 | - | { Mod1Mask, XK_f, floating, NULL }, |
|
| 23 | + | { Mod1Mask, XK_space, toggle, NULL }, |
|
| 23 | 24 | { Mod1Mask, XK_m, max, NULL }, |
|
| 24 | 25 | { Mod1Mask | ShiftMask, XK_c, ckill, NULL }, |
|
| 25 | 26 | { Mod1Mask | ShiftMask, XK_q, quit, NULL }, |
Binary file — no preview.
| 85 | 85 | close(ConnectionNumber(dpy)); |
|
| 86 | 86 | setsid(); |
|
| 87 | 87 | execvp(argv[0], argv); |
|
| 88 | - | fprintf(stderr, "gridwm: execvp %s", argv[0]); |
|
| 88 | + | fprintf(stderr, "dwm: execvp %s", argv[0]); |
|
| 89 | 89 | perror(" failed"); |
|
| 90 | 90 | } |
|
| 91 | 91 | exit (0); |
| 37 | 37 | int tsel = Tdev; /* default tag */ |
|
| 38 | 38 | int screen, sx, sy, sw, sh, th; |
|
| 39 | 39 | ||
| 40 | - | Brush brush = {0}; |
|
| 40 | + | DC dc = {0}; |
|
| 41 | 41 | Client *clients = NULL; |
|
| 42 | 42 | Client *stack = NULL; |
|
| 43 | 43 | ||
| 44 | 44 | static Bool other_wm_running; |
|
| 45 | 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 | 47 | static int (*x_error_handler) (Display *, XErrorEvent *); |
|
| 48 | 48 | ||
| 49 | 49 | static void |
|
| 50 | - | usage() { error("usage: gridwm [-v]\n"); } |
|
| 50 | + | usage() { error("usage: dwm [-v]\n"); } |
|
| 51 | 51 | ||
| 52 | 52 | static void |
|
| 53 | 53 | scan_wins() |
|
| 149 | 149 | || (error->request_code == X_GrabKey |
|
| 150 | 150 | && error->error_code == BadAccess)) |
|
| 151 | 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 | 153 | error->request_code, error->error_code); |
|
| 154 | 154 | return x_error_handler(dpy, error); /* may call exit() */ |
|
| 155 | 155 | } |
|
| 203 | 203 | ||
| 204 | 204 | dpy = XOpenDisplay(0); |
|
| 205 | 205 | if(!dpy) |
|
| 206 | - | error("gridwm: cannot connect X server\n"); |
|
| 206 | + | error("dwm: cannot connect X server\n"); |
|
| 207 | 207 | ||
| 208 | 208 | screen = DefaultScreen(dpy); |
|
| 209 | 209 | root = RootWindow(dpy, screen); |
|
| 216 | 216 | XFlush(dpy); |
|
| 217 | 217 | ||
| 218 | 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 | 221 | sx = sy = 0; |
|
| 222 | 222 | sw = DisplayWidth(dpy, screen); |
|
| 244 | 244 | update_keys(); |
|
| 245 | 245 | ||
| 246 | 246 | /* style */ |
|
| 247 | - | loadcolors(screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR); |
|
| 248 | - | loadfont(&brush.font, FONT); |
|
| 247 | + | initcolors(BGCOLOR, FGCOLOR, BORDERCOLOR); |
|
| 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)); |
|
| 253 | - | brush.gc = XCreateGC(dpy, root, 0, 0); |
|
| 252 | + | dc.drawable = XCreatePixmap(dpy, root, sw, th, DefaultDepth(dpy, screen)); |
|
| 253 | + | dc.gc = XCreateGC(dpy, root, 0, 0); |
|
| 254 | 254 | ||
| 255 | 255 | wa.event_mask = SubstructureRedirectMask | EnterWindowMask \ |
|
| 256 | 256 | | LeaveWindowMask; |
|
| 257 | 257 | wa.cursor = cursor[CurNormal]; |
|
| 258 | 258 | XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
|
| 259 | 259 | ||
| 260 | - | arrange = grid; |
|
| 261 | 260 | scan_wins(); |
|
| 262 | 261 | ||
| 263 | 262 | while(running) { |
|
| 19 | 19 | ||
| 20 | 20 | /********** CUSTOMIZE **********/ |
|
| 21 | 21 | ||
| 22 | - | typedef struct Brush Brush; |
|
| 22 | + | typedef struct DC DC; |
|
| 23 | 23 | typedef struct Client Client; |
|
| 24 | 24 | typedef struct Fnt Fnt; |
|
| 25 | 25 | typedef struct Key Key; |
|
| 39 | 39 | int height; |
|
| 40 | 40 | }; |
|
| 41 | 41 | ||
| 42 | - | struct Brush { |
|
| 42 | + | struct DC { /* draw context */ |
|
| 43 | 43 | GC gc; |
|
| 44 | 44 | Drawable drawable; |
|
| 45 | 45 | int x, y, w, h; |
|
| 79 | 79 | extern Cursor cursor[CurLast]; |
|
| 80 | 80 | extern Bool running, issel; |
|
| 81 | 81 | extern void (*handler[LASTEvent]) (XEvent *); |
|
| 82 | - | extern void (*arrange)(void *aux); |
|
| 83 | 82 | ||
| 84 | 83 | extern int tsel, screen, sx, sy, sw, sh, th; |
|
| 85 | 84 | extern char stext[1024], *tags[TLast]; |
|
| 86 | 85 | ||
| 87 | - | extern Brush brush; |
|
| 86 | + | extern DC dc; |
|
| 88 | 87 | extern Client *clients, *stack; |
|
| 89 | 88 | ||
| 90 | 89 | /* client.c */ |
|
| 102 | 101 | extern void ckill(void *aux); |
|
| 103 | 102 | extern void sel(void *aux); |
|
| 104 | 103 | extern void max(void *aux); |
|
| 105 | - | extern void floating(void *aux); |
|
| 106 | - | extern void grid(void *aux); |
|
| 104 | + | extern void toggle(void *aux); |
|
| 107 | 105 | extern void gravitate(Client *c, Bool invert); |
|
| 108 | 106 | ||
| 109 | 107 | /* draw.c */ |
|
| 110 | - | extern void draw(Brush *b, Bool border, const char *text); |
|
| 111 | - | extern void loadcolors(int scr, Brush *b, |
|
| 112 | - | const char *bg, const char *fg, const char *bo); |
|
| 113 | - | extern void loadfont(Fnt *font, const char *fontstr); |
|
| 108 | + | extern void draw(Bool border, const char *text); |
|
| 109 | + | extern void initcolors(const char *bg, const char *fg, const char *bo); |
|
| 110 | + | extern void initfont(Fnt *font, const char *fontstr); |
|
| 114 | 111 | extern unsigned int textnw(Fnt *font, char *text, unsigned int len); |
|
| 115 | 112 | extern unsigned int textw(Fnt *font, char *text); |
|
| 116 | 113 | extern unsigned int texth(Fnt *font); |
|