all repos — dwm @ fee8df6ccf3ab1494421d422af252f7b3da3a811

my dwm build

added the new dotile as described on ml
Anselm R. Garbe arg@10kloc.org
Fri, 29 Sep 2006 16:22:20 +0200
commit

fee8df6ccf3ab1494421d422af252f7b3da3a811

parent

8fa47ac679cfd91c022a35f2469bea7396e5f7c7

6 files changed, 112 insertions(+), 36 deletions(-)

jump to
M config.arg.hconfig.arg.h

@@ -36,6 +36,8 @@ "-selbg '"SELBGCOLOR"' -selfg '"SELFGCOLOR"')\" && exec $exe" } }, \

{ MODKEY, XK_j, focusnext, { 0 } }, \ { MODKEY, XK_k, focusprev, { 0 } }, \ { MODKEY, XK_Return, zoom, { 0 } }, \ + { MODKEY, XK_b, togglestackpos, { 0 } }, \ + { MODKEY, XK_d, togglestackdir, { 0 } }, \ { MODKEY, XK_g, resizecol, { .i = 20 } }, \ { MODKEY, XK_s, resizecol, { .i = -20 } }, \ { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
M config.default.hconfig.default.h

@@ -30,6 +30,8 @@ { MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \

{ MODKEY, XK_Tab, focusnext, { 0 } }, \ { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \ { MODKEY, XK_Return, zoom, { 0 } }, \ + { MODKEY, XK_b, togglestackpos, { 0 } }, \ + { MODKEY, XK_d, togglestackdir, { 0 } }, \ { MODKEY, XK_g, resizecol, { .i = 20 } }, \ { MODKEY, XK_s, resizecol, { .i = -20 } }, \ { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
M dwm.hdwm.h

@@ -102,7 +102,7 @@

extern const char *tags[]; /* all tags */ extern char stext[1024]; /* status text */ extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */ -extern int master, screen, sx, sy, sw, sh; /* screen geometry, master width */ +extern int master, screen, sx, sy, sw, sh; /* screen geometry, master dimension*/ extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */ extern void (*handler[LASTEvent])(XEvent *); /* event handler */ extern void (*arrange)(Arg *); /* arrange function, indicates mode */

@@ -170,10 +170,13 @@ extern void dotile(Arg *arg); /* arranges all windows, arg is ignored */

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 Bool isvisible(Client *c); /* returns True if client is visible */ -extern void resizecol(Arg *arg); /* resizes the master width with arg's index value */ +extern void resizecol(Arg *arg); /* resizes the master dimension with arg's index value */ extern void restack(void); /* restores z layers of all clients */ +extern void togglestackdir(Arg *arg); /* toggles stack direction */ +extern void togglestackpos(Arg *arg); /* toggles stack position */ extern void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */ extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ +extern void updatemaster(void); /* updates master dimension */ extern void view(Arg *arg); /* views the tag with arg's index */ extern void viewall(Arg *arg); /* views all tags, arg is ignored */ -extern void zoom(Arg *arg); /* zooms the focused client to master column, arg is ignored */ +extern void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */
M event.cevent.c

@@ -177,8 +177,9 @@ else

configure(c); XSync(dpy, False); if(c->isfloat) { - if(isvisible(c)) - resize(c, False, TopLeft); + resize(c, False, TopLeft); + if(!isvisible(c)) + ban(c); } else arrange(NULL);
M main.cmain.c

@@ -133,7 +133,7 @@ bmw = textw(FLOATSYMBOL) > textw(TILESYMBOL) ? textw(FLOATSYMBOL) : textw(TILESYMBOL);

sx = sy = 0; sw = DisplayWidth(dpy, screen); sh = DisplayHeight(dpy, screen); - master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100; + updatemaster(); bx = by = 0; bw = sw;
M view.cview.c

@@ -148,52 +148,93 @@ c->w = sw - 2 * BORDERPX;

c->h = sh - 2 * BORDERPX - bh; } else if(i == 0) { /* master window */ - c->x = sx; - if(stackpos == StackLeft) - c->x += master; - c->y = sy + bh; - if(isvertical) { + switch(stackpos) { + case StackLeft: + c->x = sx + stackw; + c->y = sy + bh; c->w = master - 2 * BORDERPX; - c->h = sh - 2 * BORDERPX - bh; - } - else { - c->w = sw; + c->h = sh - bh - 2 * BORDERPX; + break; + case StackBottom: + c->x = sx; + c->y = sy + bh; + c->w = sw - 2 * BORDERPX; c->h = master - 2 * BORDERPX; + break; + case StackRight: + c->x = sx; + c->y = sy + bh; + c->w = master - 2 * BORDERPX; + c->h = sh - bh - 2 * BORDERPX; + break; } } else if((isvertical && th > bh) || (!isvertical && tw > MINW)) { /* tile window */ - c->x = sx; - if(isvertical) - c->y = sy + (i - 1) * th + bh; - else - c->y = sy + bh; - if(stackpos == StackRight) - c->x += master; - else if(stackpos == StackBottom) - c->y += master; c->w = tw - 2 * BORDERPX; c->h = th - 2 * BORDERPX; - if(i + 1 == n) { /* fixes for last tile to take up rest space */ - if(isvertical) - c->h = sh - c->y - 2 * BORDERPX; + switch(stackpos) { + case StackLeft: + if(isvertical) { + c->x = sx; + c->y = sy + (i - 1) * th + bh; + if(i + 1 == n) + c->h = sh - c->y - 2 * BORDERPX; + } else { - if(stackpos == StackLeft) - c->w = master - c->x - 2 * BORDERPX; - else + c->x = sx + (i - 1) * tw; + c->y = sy + bh; + if(i + 1 == n) + c->w = sx + stackw - c->x - 2 * BORDERPX; + } + break; + case StackBottom: + if(isvertical) { + c->x = sx; + c->y = sy + master + (i - 1) * th + bh; + if(i + 1 == n) + c->h = sh - c->y - 2 * BORDERPX; + } + else { + c->x = sx + (i - 1) * tw; + c->y = sy + bh + master; + if(i + 1 == n) c->w = sw - c->x - 2 * BORDERPX; } + break; + case StackRight: + if(isvertical) { + c->x = sx + master; + c->y = sy + (i - 1) * th + bh; + if(i + 1 == n) + c->h = sh - c->y - 2 * BORDERPX; + } + else { + c->x = sx + master + (i - 1) * tw; + c->y = sy + bh; + if(i + 1 == n) + c->w = sx + stackw - c->x - 2 * BORDERPX; + } + break; } } else { /* fallback if th < bh resp. tw < MINW */ - c->x = sx; - c->y = sy + bh; - if(stackpos == StackRight) - c->x += master; - else if(stackpos == StackBottom) - c->y += master; c->w = stackw - 2 * BORDERPX; c->h = stackh - 2 * BORDERPX; + switch(stackpos) { + case StackLeft: + c->x = sx; + c->y = sy + bh; + break; + case StackBottom: + c->x = sx; + c->y = sy + master; + break; + case StackRight: + c->x = sx + master; + c->y = sy + bh; + break; + } } resize(c, False, TopLeft); i++;

@@ -319,6 +360,31 @@ arrange(NULL);

} void +togglestackdir(Arg *arg) { + if(arrange == dofloat) + return; + isvertical = !isvertical; + arrange(NULL); +} + +void +togglestackpos(Arg *arg) { + if(arrange == dofloat) + return; + if(stackpos == StackBottom) + stackpos = STACKPOS; + else + stackpos = StackBottom; + updatemaster(); + arrange(NULL); +} + +void +updatemaster(void) { + master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100; +} + +void view(Arg *arg) { unsigned int i;

@@ -338,6 +404,8 @@ seltag[i] = True;

reorder(); arrange(NULL); } + + void zoom(Arg *arg) {