aboutsummaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index 4bd377b..5867298 100644
--- a/dwm.c
+++ b/dwm.c
@@ -253,6 +253,7 @@ static void centeredmaster(Monitor *m);
static void centeredfloatingmaster(Monitor *m);
static void bstack(Monitor *m);
static void bstackhoriz(Monitor *m);
+static void stairs(Monitor *m);
/* variables */
static const char broken[] = "broken";
@@ -1878,6 +1879,43 @@ spawn(const Arg *arg)
}
void
+stairs(Monitor *m)
+{
+ unsigned int i, n, h, mw, my;
+ unsigned int ox, oy, ow, oh; /* stair offset values */
+ Client *c;
+
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if (n == 0)
+ return;
+
+ if (n > m->nmaster)
+ mw = m->nmaster ? m->ww * m->mfact : 0;
+ else
+ mw = m->ww - m->gappx;
+
+ for (i = 0, my = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
+ if (i < m->nmaster) {
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
+ resize(c, m->wx + m->gappx, m->wy + my, mw - (2 * c->bw) - m->gappx, h - (2 * c->bw), 0);
+ if (my + HEIGHT(c) + m->gappx < m->wh)
+ my += HEIGHT(c) + m->gappx;
+ } else {
+ oy = i - m->nmaster;
+ ox = stairdirection ? n - i - 1 : (stairsamesize ? i - m->nmaster : 0);
+ ow = stairsamesize ? n - m->nmaster - 1 : n - i - 1;
+ oh = stairsamesize ? ow : i - m->nmaster;
+ resize(c,
+ m->wx + mw + (ox * stairpx) + m->gappx,
+ m->wy + (oy * stairpx) + m->gappx,
+ m->ww - mw - (2 * c->bw) - (ow * stairpx) - (2 * m->gappx),
+ m->wh - (2 * c->bw) - (oh * stairpx) - (2 * m->gappx),
+ 0);
+ }
+ }
+}
+
+void
tag(const Arg *arg)
{
if (selmon->sel && arg->ui & TAGMASK) {