diff -r 9ede7b2d2450 .hgtags --- a/.hgtags Wed Feb 07 12:37:21 2007 +0100 +++ b/.hgtags Sun Feb 11 11:43:08 2007 +0100 @@ -35,3 +35,4 @@ f2cabc83a18f9b5b548159329ddd4dee904fa31f f2cabc83a18f9b5b548159329ddd4dee904fa31f 3.2.1 d3876aa792923f9a95f7ad0c7f0134533404df35 3.2.2 0f91934037b04221ff5d1ba3a6c39c1ff26e3661 3.3 +9ede7b2d2450537e750d5505789fbe63960e97e6 3.4 diff -r 9ede7b2d2450 Makefile --- a/Makefile Wed Feb 07 12:37:21 2007 +0100 +++ b/Makefile Sun Feb 11 11:43:08 2007 +0100 @@ -1,5 +1,5 @@ # dwm - dynamic window manager -# (C)opyright MMVII Anselm R. Garbe +# (C)opyright MMVI-MMVII Anselm R. Garbe include config.mk diff -r 9ede7b2d2450 config.arg.h --- a/config.arg.h Wed Feb 07 12:37:21 2007 +0100 +++ b/config.arg.h Sun Feb 11 16:13:20 2007 +0100 @@ -22,6 +22,7 @@ const char *tags[] = { "1", "2", "3", "4 #define MODKEY Mod1Mask #define NMASTER 1 /* clients in master area */ #define SNAP 40 /* pixel */ +#define TOPBAR True /* False */ #define KEYS \ static Key key[] = { \ diff -r 9ede7b2d2450 config.default.h --- a/config.default.h Wed Feb 07 12:37:21 2007 +0100 +++ b/config.default.h Sun Feb 11 16:13:20 2007 +0100 @@ -22,6 +22,7 @@ const char *tags[] = { "1", "2", "3", "4 #define MODKEY Mod1Mask #define NMASTER 1 /* clients in master area */ #define SNAP 20 /* pixel */ +#define TOPBAR True /* False */ #define KEYS \ static Key key[] = { \ @@ -84,4 +85,6 @@ static Rule rule[] = { \ static Rule rule[] = { \ /* class:instance:title regex tags regex isfloat */ \ { "Gimp.*", NULL, True }, \ + { "MPlayer.*", NULL, True }, \ + { "Acroread.*", NULL, True }, \ }; diff -r 9ede7b2d2450 config.mk --- a/config.mk Wed Feb 07 12:37:21 2007 +0100 +++ b/config.mk Sun Feb 11 11:43:08 2007 +0100 @@ -1,5 +1,5 @@ # dwm version -VERSION = 3.4 +VERSION = 3.5 # Customize below to fit your system diff -r 9ede7b2d2450 draw.c --- a/draw.c Wed Feb 07 12:37:21 2007 +0100 +++ b/draw.c Sun Feb 11 14:49:02 2007 +0100 @@ -72,17 +72,6 @@ drawtext(const char *text, unsigned long XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv); XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len); } - x = (h + 2) / 4; - r.x = dc.x + 1; - r.y = dc.y + 1; - if(filledsquare) { - r.width = r.height = x + 1; - XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); - } - else if(emptysquare) { - r.width = r.height = x; - XDrawRectangles(dpy, dc.drawable, dc.gc, &r, 1); - } } /* extern */ @@ -98,10 +87,10 @@ drawstatus(void) { drawtext(tags[i], dc.sel, sel && sel->tags[i], isoccupied(i)); else drawtext(tags[i], dc.norm, sel && sel->tags[i], isoccupied(i)); - dc.x += dc.w; + dc.x += dc.w + 1; } dc.w = bmw; - drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.norm, False, False); + drawtext("", dc.norm, False, False); x = dc.x + dc.w; dc.w = textw(stext); dc.x = sw - dc.w; @@ -112,7 +101,7 @@ drawstatus(void) { drawtext(stext, dc.norm, False, False); if((dc.w = dc.x - x) > bh) { dc.x = x; - drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False, False); + drawtext(sel ? sel->name : NULL, dc.norm, False, False); } XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0); XSync(dpy, False); diff -r 9ede7b2d2450 dwm.h --- a/dwm.h Wed Feb 07 12:37:21 2007 +0100 +++ b/dwm.h Sun Feb 11 16:10:08 2007 +0100 @@ -132,6 +132,7 @@ extern void settags(Client *c, Client *t extern void settags(Client *c, Client *trans); /* sets tags of c */ extern void tag(Arg *arg); /* tags c with arg's index */ extern void toggletag(Arg *arg); /* toggles c tags with arg's index */ +extern void viewnext(Arg *arg); /* view next tag(s) */ /* util.c */ extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ @@ -142,6 +143,7 @@ extern void detach(Client *c); /* deta extern void detach(Client *c); /* detaches c from global client list */ extern void dofloat(void); /* arranges all windows floating */ extern void dotile(void); /* arranges all windows tiled */ +extern void domax(void); /* arranges all windows fullscreen */ extern void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */ extern void focusprev(Arg *arg); /* focuses previous visible client, arg is ignored */ extern void incnmaster(Arg *arg); /* increments nmaster with arg's index value */ diff -r 9ede7b2d2450 main.c --- a/main.c Wed Feb 07 12:37:21 2007 +0100 +++ b/main.c Sun Feb 11 11:43:08 2007 +0100 @@ -18,11 +18,11 @@ /* extern */ char stext[256]; -Bool *seltag; int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah; unsigned int master, nmaster, ntags, numlockmask; Atom wmatom[WMLast], netatom[NetLast]; Bool running = True; +Bool *seltag; Bool selscreen = True; Client *clients = NULL; Client *sel = NULL; @@ -141,15 +141,15 @@ setup(void) { wa.override_redirect = 1; wa.background_pixmap = ParentRelative; wa.event_mask = ButtonPressMask | ExposureMask; - barwin = XCreateWindow(dpy, root, sx, sy, sw, bh, 0, DefaultDepth(dpy, screen), - CopyFromParent, DefaultVisual(dpy, screen), + barwin = XCreateWindow(dpy, root, sx, sy + (TOPBAR ? 0 : sh - bh), sw, bh, 0, + DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen), CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); XDefineCursor(dpy, barwin, cursor[CurNormal]); XMapRaised(dpy, barwin); strcpy(stext, "dwm-"VERSION); /* windowarea */ wax = sx; - way = sy + bh; + way = sy + (TOPBAR ? bh : 0); wah = sh - bh; waw = sw; /* pixmap for everything */ @@ -273,7 +273,7 @@ main(int argc, char *argv[]) { break; default: for(stext[r] = '\0', p = stext + strlen(stext) - 1; p >= stext && *p == '\n'; *p-- = '\0'); - for(p = stext + strlen(stext) - 1; p >= stext && *p != '\n'; --p); + for(; p >= stext && *p != '\n'; --p); if(p > stext) strncpy(stext, p + 1, sizeof stext); } diff -r 9ede7b2d2450 tag.c --- a/tag.c Wed Feb 07 12:37:21 2007 +0100 +++ b/tag.c Sun Feb 11 16:08:36 2007 +0100 @@ -76,13 +76,14 @@ settags(Client *c, Client *trans) { unsigned int i, j; regmatch_t tmp; Bool matched = trans != NULL; - XClassHint ch; + XClassHint ch = { 0 }; if(matched) { for(i = 0; i < ntags; i++) c->tags[i] = trans->tags[i]; } - else if(XGetClassHint(dpy, c->win, &ch)) { + else { + XGetClassHint(dpy, c->win, &ch); snprintf(prop, sizeof prop, "%s:%s:%s", ch.res_class ? ch.res_class : "", ch.res_name ? ch.res_name : "", c->name); @@ -95,6 +96,7 @@ settags(Client *c, Client *trans) { c->tags[j] = True; } } + break; /* perform only the first rule matching */ } if(ch.res_class) XFree(ch.res_class); @@ -131,3 +133,16 @@ toggletag(Arg *arg) { sel->tags[arg->i] = True; arrange(); } + +/* begin code by jukka */ +void +viewnext(Arg *arg) { + unsigned int i; + Bool last = seltag[ntags-1]; + + for (i=ntags-1; i>0; --i) + seltag[i] = seltag[i-1]; + seltag[0] = last; + arrange(); +} +/* end code by jukka */ diff -r 9ede7b2d2450 view.c --- a/view.c Wed Feb 07 12:37:21 2007 +0100 +++ b/view.c Sun Feb 11 15:24:08 2007 +0100 @@ -117,6 +117,48 @@ dotile(void) { restack(); } +/* begin code by mitch */ +void +arrangemax(Client *c) { + if(c == sel) { + c->ismax = True; + c->x = sx; + c->y = bh; + c->w = sw - 2 * BORDERPX; + c->h = sh - bh - 2 * BORDERPX; + XRaiseWindow(dpy, c->win); + } else { + c->ismax = False; + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); + XLowerWindow(dpy, c->win); + } +} + +void +domax(void) { + Client *c; + + for(c = clients; c; c = c->next) { + if(isvisible(c)) { + if(c->isfloat) { + resize(c, True); + continue; + } + arrangemax(c); + resize(c, False); + } else { + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); + } + + } + if(!sel || !isvisible(sel)) { + for(c = stack; c && !isvisible(c); c = c->snext); + focus(c); + } + restack(); +} +/* end code by mitch */ + void focusnext(Arg *arg) { Client *c; @@ -192,7 +234,17 @@ restack(void) { return; if(sel->isfloat || arrange == dofloat) XRaiseWindow(dpy, sel->win); - if(arrange != dofloat) { + + /* begin code by mitch */ + if(arrange == domax) { + for(c = nexttiled(clients); c; c = nexttiled(c->next)) { + arrangemax(c); + resize(c, False); + } + + } else if (arrange == dotile) { + /* end code by mitch */ + if(!sel->isfloat) XLowerWindow(dpy, sel->win); for(c = nexttiled(clients); c; c = nexttiled(c->next)) { @@ -215,7 +267,8 @@ togglefloat(Arg *arg) { void togglemode(Arg *arg) { - arrange = (arrange == dofloat) ? dotile : dofloat; + /* only toggle between tile and max - float is just available through togglefloat */ + arrange = (arrange == dotile) ? domax : dotile; if(sel) arrange(); else diff -r 9ede7b2d2450 config.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config.h Sun Feb 11 16:02:08 2007 +0100 @@ -0,0 +1,60 @@ +/* (C)opyright MMVI-MMVII Anselm R. Garbe + * See LICENSE file for license details. + */ + +#define TAGS \ +const char *tags[] = { "Das Alles", "Das Nichts", NULL }; + +#define BORDERPX 1 +#define DEFMODE domax /* dotile */ +#define FLOATSYMBOL "" +#define TILESYMBOL "" + +#define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-*-*" +#define NORMBGCOLOR "#333333" +#define NORMFGCOLOR "#bbbbbb" +#define SELBGCOLOR "#eec900" +#define SELFGCOLOR "#000000" +#define NORMBORDERCOLOR NORMBGCOLOR +#define SELBORDERCOLOR SELBGCOLOR + +#define MASTER 500 /* per thousand */ +#define MODKEY Mod1Mask +#define NMASTER 1 /* clients in master area */ +#define SNAP 5 /* pixel */ +#define TOPBAR True /* False */ + +#define KEYS \ +static Key key[] = { \ + /* modifier key function argument */ \ + { MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec urxvt" } }, \ + { MODKEY, XK_F1, viewnext, { .i = 0 } }, \ + { MODKEY, XK_Tab, focusnext, { 0 } }, \ + { MODKEY, XK_asciicircum, spawn, \ + { .cmd = "exe=\"$(lsx `echo $PATH | sed 's/:/ /g'` | sort -u " \ + " | dmenu -font '"FONT"' -normbg '"NORMBGCOLOR"' -normfg '"NORMFGCOLOR"' " \ + "-selbg '"SELBGCOLOR"' -selfg '"SELFGCOLOR"')\" && exec $exe" } }, \ + { MODKEY, XK_1, zoom, { 0 } }, \ + { MODKEY, XK_2, killclient, { 0 } }, \ + { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \ + { MODKEY|ShiftMask, XK_F4, spawn, { .cmd = "exec sudo halt" } }, \ + { MODKEY, XK_space, togglemode, { 0 } }, \ + { MODKEY|ShiftMask, XK_space, togglefloat, { 0 } }, \ + { MODKEY, XK_g, resizemaster, { .i = 15 } }, \ + { MODKEY, XK_s, resizemaster, { .i = -15 } }, \ + { MODKEY, XK_i, incnmaster, { .i = 1 } }, \ + { MODKEY, XK_d, incnmaster, { .i = -1 } }, \ + { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ + { MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \ +}; + +/* Query class:instance:title for regex matching info with following command: + * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */ +#define RULES \ +static Rule rule[] = { \ + /* class:instance:title regex tags regex isfloat */ \ + { "URxvt.*", "Das Nichts", False }, \ + { "MPlayer.*", NULL, True }, \ + { "Gimp.*", "Das Alles", True }, \ + { ".*", "Das Alles", False }, \ +};