*** dwm.h.000 Mon Aug 7 02:52:49 2006 --- dwm.h Mon Aug 7 11:13:00 2006 *************** *** 13,18 **** --- 13,19 ---- typedef union Arg Arg; typedef struct Client Client; + typedef struct Tag Tag; typedef struct DC DC; typedef struct Fnt Fnt; *************** *** 59,65 **** long flags; unsigned int border; Bool isfloat; - Bool ismax; Bool *tags; Client *next; Client *prev; --- 60,65 ---- *************** *** 67,81 **** Window title; }; ! extern const char *tags[]; extern char stext[1024]; extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; extern unsigned int ntags; extern void (*handler[LASTEvent])(XEvent *); - extern void (*arrange)(Arg *); extern Atom wmatom[WMLast], netatom[NetLast]; extern Bool running, issel; extern Client *clients, *sel; extern Cursor cursor[CurLast]; extern DC dc; extern Display *dpy; --- 67,85 ---- Window title; }; ! struct Tag { ! char *name; ! Bool ismax; ! }; ! extern char stext[1024]; extern int tsel, screen, sx, sy, sw, sh, bx, by, bw, bh, mw; extern unsigned int ntags; extern void (*handler[LASTEvent])(XEvent *); extern Atom wmatom[WMLast], netatom[NetLast]; extern Bool running, issel; extern Client *clients, *sel; + extern Tag tags[]; extern Cursor cursor[CurLast]; extern DC dc; extern Display *dpy; *************** *** 119,125 **** /* tag.c */ extern void appendtag(Arg *arg); - extern void dofloat(Arg *arg); extern void dotile(Arg *arg); extern void initrregs(); extern Client *getnext(Client *c); --- 123,128 ---- *** client.c.000 Mon Aug 7 02:52:49 2006 --- client.c Mon Aug 7 12:57:57 2006 *************** *** 18,24 **** c->tw = 0; for(i = 0; i < ntags; i++) if(c->tags[i]) ! c->tw += textw(tags[i]); c->tw += textw(c->name); if(c->tw > c->w) c->tw = c->w + 2; --- 18,24 ---- c->tw = 0; for(i = 0; i < ntags; i++) if(c->tags[i]) ! c->tw += textw(tags[i].name); c->tw += textw(c->name); if(c->tw > c->w) c->tw = c->w + 2; *************** *** 69,83 **** if(!sel) return; - if(sel->ismax) - togglemax(NULL); - if(!(c = getnext(sel->next))) c = getnext(clients); ! if(c) { ! higher(c); focus(c); - } } void --- 69,78 ---- if(!sel) return; if(!(c = getnext(sel->next))) c = getnext(clients); ! if(c) focus(c); } void *************** *** 88,104 **** if(!sel) return; - if(sel->ismax) - togglemax(NULL); - if(!(c = getprev(sel->prev))) { for(c = clients; c && c->next; c = c->next); c = getprev(c); } ! if(c) { ! higher(c); focus(c); - } } Client * --- 83,94 ---- if(!sel) return; if(!(c = getprev(sel->prev))) { for(c = clients; c && c->next; c = c->next); c = getprev(c); } ! if(c) focus(c); } Client * *************** *** 276,282 **** || (c->maxw && c->minw && c->maxw == c->minw && c->maxh == c->minh); settitle(c); ! arrange(NULL); /* mapping the window now prevents flicker */ XMapRaised(dpy, c->win); --- 266,272 ---- || (c->maxw && c->minw && c->maxw == c->minw && c->maxh == c->minh); settitle(c); ! dotile(NULL); /* mapping the window now prevents flicker */ XMapRaised(dpy, c->win); *************** *** 399,431 **** void togglemax(Arg *arg) { ! int ox, oy, ow, oh; ! XEvent ev; ! if(!sel) ! return; ! ! if((sel->ismax = !sel->ismax)) { ! ox = sel->x; ! oy = sel->y; ! ow = sel->w; ! oh = sel->h; ! sel->x = sx; ! sel->y = sy + bh; ! sel->w = sw - 2; ! sel->h = sh - 2 - bh; ! ! higher(sel); ! resize(sel, False, TopLeft); ! ! sel->x = ox; ! sel->y = oy; ! sel->w = ow; ! sel->h = oh; ! } ! else ! resize(sel, False, TopLeft); ! while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } void --- 389,398 ---- void togglemax(Arg *arg) { ! tags[tsel].ismax = !tags[tsel].ismax; ! dotile(NULL); if(!sel) ! focus(sel); } void *************** *** 456,462 **** XSync(dpy, False); XSetErrorHandler(xerror); XUngrabServer(dpy); ! arrange(NULL); if(sel) focus(sel); } --- 423,429 ---- XSync(dpy, False); XSetErrorHandler(xerror); XUngrabServer(dpy); ! dotile(NULL); if(sel) focus(sel); } *************** *** 466,472 **** { Client *c; ! if(!sel || (arrange != dotile) || sel->isfloat) return; if(sel == getnext(clients)) { --- 433,439 ---- { Client *c; ! if(!sel || sel->isfloat) return; if(sel == getnext(clients)) { *************** *** 486,491 **** clients->prev = sel; sel->next = clients; clients = sel; ! arrange(NULL); focus(sel); } --- 453,458 ---- clients->prev = sel; sel->next = clients; clients = sel; ! dotile(NULL); focus(sel); } *** draw.c.000 Mon Aug 7 02:52:49 2006 --- draw.c Mon Aug 7 11:12:02 2006 *************** *** 107,134 **** drawstatus() { int i, x; - Bool istile = arrange == dotile; dc.x = dc.y = 0; dc.w = bw; ! drawtext(NULL, !istile, False); dc.w = 0; for(i = 0; i < ntags; i++) { dc.x += dc.w; ! dc.w = textw(tags[i]); ! if(istile) ! drawtext(tags[i], (i == tsel), True); ! else ! drawtext(tags[i], (i != tsel), True); } x = dc.x + dc.w; dc.w = textw(stext); dc.x = bx + bw - dc.w; ! drawtext(stext, !istile, False); if(sel && ((dc.w = dc.x - x) >= bh)) { dc.x = x; ! drawtext(sel->name, istile, True); } XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); XSync(dpy, False); --- 107,130 ---- drawstatus() { int i, x; dc.x = dc.y = 0; dc.w = bw; ! drawtext(NULL, False, False); dc.w = 0; for(i = 0; i < ntags; i++) { dc.x += dc.w; ! dc.w = textw(tags[i].name); ! drawtext(tags[i].name, (i == tsel), True); } x = dc.x + dc.w; dc.w = textw(stext); dc.x = bx + bw - dc.w; ! drawtext(stext, False, False); if(sel && ((dc.w = dc.x - x) >= bh)) { dc.x = x; ! drawtext(sel->name, True, True); } XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); XSync(dpy, False); *************** *** 138,144 **** drawtitle(Client *c) { int i; - Bool istile = arrange == dotile; if(c == sel) { drawstatus(); --- 134,139 ---- *************** *** 156,168 **** for(i = 0; i < ntags; i++) { if(c->tags[i]) { dc.x += dc.w; ! dc.w = textw(tags[i]); ! drawtext(tags[i], !istile, True); } } dc.x += dc.w; dc.w = textw(c->name); ! drawtext(c->name, !istile, True); XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0); XSync(dpy, False); } --- 151,163 ---- for(i = 0; i < ntags; i++) { if(c->tags[i]) { dc.x += dc.w; ! dc.w = textw(tags[i].name); ! drawtext(tags[i].name, False, True); } } dc.x += dc.w; dc.w = textw(c->name); ! drawtext(c->name, False, True); XCopyArea(dpy, dc.drawable, c->title, dc.gc, 0, 0, c->tw, c->th, 0, 0); XSync(dpy, False); } *** event.c.000 Mon Aug 7 02:52:49 2006 --- event.c Mon Aug 7 11:12:25 2006 *************** *** 106,112 **** default: x = 0; for(a.i = 0; a.i < ntags; a.i++) { ! x += textw(tags[a.i]); if(ev->x < x) { view(&a); break; --- 106,112 ---- default: x = 0; for(a.i = 0; a.i < ntags; a.i++) { ! x += textw(tags[a.i].name); if(ev->x < x) { view(&a); break; *************** *** 127,133 **** default: break; case Button1: ! if(!c->ismax && (arrange == dofloat || c->isfloat)) { higher(c); movemouse(c); } --- 127,133 ---- default: break; case Button1: ! if(c->isfloat) { higher(c); movemouse(c); } *************** *** 136,142 **** lower(c); break; case Button3: ! if(!c->ismax && (arrange == dofloat || c->isfloat)) { higher(c); resizemouse(c); } --- 136,142 ---- lower(c); break; case Button3: ! if(c->isfloat) { higher(c); resizemouse(c); } *************** *** 192,198 **** if(c->isfloat) resize(c, False, TopLeft); else ! arrange(NULL); } else { wc.x = ev->x; --- 192,198 ---- if(c->isfloat) resize(c, False, TopLeft); else ! dotile(NULL); } else { wc.x = ev->x; *************** *** 312,318 **** case XA_WM_TRANSIENT_FOR: XGetTransientForHint(dpy, c->win, &trans); if(!c->isfloat && (c->isfloat = (trans != 0))) ! arrange(NULL); break; case XA_WM_NORMAL_HINTS: setsize(c); --- 312,318 ---- case XA_WM_TRANSIENT_FOR: XGetTransientForHint(dpy, c->win, &trans); if(!c->isfloat && (c->isfloat = (trans != 0))) ! dotile(NULL); break; case XA_WM_NORMAL_HINTS: setsize(c); *** tag.c.000 Mon Aug 7 02:52:49 2006 --- tag.c Mon Aug 7 12:58:28 2006 *************** *** 30,37 **** static RReg *rreg = NULL; static unsigned int len = 0; - void (*arrange)(Arg *) = DEFMODE; - /* extern */ void --- 30,35 ---- *************** *** 41,69 **** return; sel->tags[arg->i] = True; ! arrange(NULL); ! } ! ! void ! dofloat(Arg *arg) ! { ! Client *c; ! ! for(c = clients; c; c = c->next) { ! c->ismax = False; ! if(c->tags[tsel]) { ! resize(c, True, TopLeft); ! } ! else ! ban(c); ! } ! if((sel = getnext(clients))) { ! higher(sel); ! focus(sel); ! } ! else ! XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); ! drawall(); } void --- 39,45 ---- return; sel->tags[arg->i] = True; ! dotile(NULL); } void *************** *** 83,96 **** h = sh - bh; for(i = 0, c = clients; c; c = c->next) { - c->ismax = False; if(c->tags[tsel]) { if(c->isfloat) { higher(c); resize(c, True, TopLeft); continue; } ! if(n == 1) { c->x = sx; c->y = sy + bh; c->w = sw - 2; --- 59,71 ---- h = sh - bh; for(i = 0, c = clients; c; c = c->next) { if(c->tags[tsel]) { if(c->isfloat) { higher(c); resize(c, True, TopLeft); continue; } ! if(n == 1 || tags[tsel].ismax) { c->x = sx; c->y = sy + bh; c->w = sw - 2; *************** *** 120,129 **** else ban(c); } ! if((sel = getnext(clients))) { ! higher(sel); focus(sel); - } else XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); drawall(); --- 95,102 ---- else ban(c); } ! if(sel = getnext(clients)) focus(sel); else XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); drawall(); *************** *** 202,208 **** if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) { c->isfloat = rule[i].isfloat; for(j = 0; rreg[i].tregex && j < ntags; j++) { ! if(!regexec(rreg[i].tregex, tags[j], 1, &tmp, 0)) { matched = True; c->tags[j] = True; } --- 175,181 ---- if(rreg[i].clregex && !regexec(rreg[i].clregex, classinst, 1, &tmp, 0)) { c->isfloat = rule[i].isfloat; for(j = 0; rreg[i].tregex && j < ntags; j++) { ! if(!regexec(rreg[i].tregex, tags[j].name, 1, &tmp, 0)) { matched = True; c->tags[j] = True; } *************** *** 220,234 **** void togglemode(Arg *arg) { ! arrange = arrange == dofloat ? dotile : dofloat; ! arrange(NULL); } void view(Arg *arg) { tsel = arg->i; ! arrange(NULL); drawall(); } --- 193,209 ---- void togglemode(Arg *arg) { ! if (sel->isfloat = !sel->isfloat) ! higher(sel); ! focus(sel); ! dotile(NULL); } void view(Arg *arg) { tsel = arg->i; ! dotile(NULL); drawall(); } *** main.c.000 Mon Aug 7 02:52:49 2006 --- main.c Mon Aug 7 09:44:24 2006 *************** *** 212,218 **** grabkeys(); initrregs(); ! for(ntags = 0; tags[ntags]; ntags++); /* style */ dc.bg = getcolor(BGCOLOR); --- 212,218 ---- grabkeys(); initrregs(); ! for(ntags = 0; tags[ntags].name; ntags++); /* style */ dc.bg = getcolor(BGCOLOR); *** config.default.h.000 Mon Aug 7 02:52:49 2006 --- config.default.h Mon Aug 7 11:31:45 2006 *************** *** 4,12 **** */ #define TAGS \ ! const char *tags[] = { "0", "1", "2", "3", "4", NULL }; - #define DEFMODE dotile /* dofloat */ #define DEFTAG 1 /* index */ #define FONT "fixed" #define BGCOLOR "#666699" --- 4,18 ---- */ #define TAGS \ ! Tag tags[] = { \ ! "0", False, \ ! "1", False, \ ! "2", False, \ ! "3", False, \ ! "4", False, \ ! NULL, False, \ ! }; #define DEFTAG 1 /* index */ #define FONT "fixed" #define BGCOLOR "#666699"