{ 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 } }, \
{ 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 } }, \
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 */
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 */
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);
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;
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++;
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;
arrange(NULL);
}
+
+
void
zoom(Arg *arg) {
unsigned int n;