// }
// }
+// void
+// tile(Monitor *m)
+// {
+// unsigned int i, h, mw, my, ty;
+// Client *c;
+// int bx, by, bw, bh;
+// unsigned int nt;
+
+// get_layout_box(m, 0, &nt, &bx, &by, &bw, &bh);
+// if (nt == 0)
+// return;
+
+// int g = gappx;
+
+
+// /* --- FIND TRUE MASTER WINDOW (SKIPPING SIDE PANELS) --- */
+// Client *master_c = NULL;
+// for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
+// if ((c->tags & m->tagset[m->seltags]) && !c->isSidePanel) {
+// master_c = c;
+// break;
+// }
+// }
+// /* ----------------------------------------------------- */
+// if (master_c && (strstr(master_c->class, "Zathura") || strstr(master_c->class, "zathura"))) {
+// mw = zathura_width;
+// } else if (nt > m->nmaster) {
+// mw = m->nmaster ? (bw - g) * m->mfact : 0;
+// } else {
+// mw = bw;
+// }
+// /* --------------------------------------------------- */
+
+// for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
+// if (!(c->tags & m->tagset[m->seltags]) || c->isSidePanel)
+// continue;
+
+// if (i < m->nmaster) {
+// unsigned int nmat = MIN(nt, m->nmaster);
+// h = (bh - my - g * (nmat - 1 - i)) / (nmat - i);
+// resize(c, bx, by + my, mw - (2 * c->bw), h - (2 * c->bw), 0);
+// my += h + g;
+// } else {
+// unsigned int nstk = nt - m->nmaster;
+// unsigned int is = i - m->nmaster;
+// h = (bh - ty - g * (nstk - 1 - is)) / (nstk - is);
+// resize(c, bx + mw + g, by + ty, (bw - mw - g) - (2 * c->bw), h - (2 * c->bw), 0);
+// ty += h + g;
+// }
+// i++;
+// }
+// }
+
void
tile(Monitor *m)
{
int g = gappx;
- // if (nt > m->nmaster)
- // mw = m->nmaster ? (bw - g) * m->mfact : 0;
- // else
- // mw = bw;
-
- // /* --- FIXED ZATHURA WIDTH OVERRIDE --- */
- // if (nt > m->nmaster) {
- // Client *master_c = nexttiled(m->clients);
- // if (master_c && strstr(master_c->class, "Zathura"))
- // mw = zathura_width;
- // else
- // mw = m->nmaster ? (bw - g) * m->mfact : 0;
- // } else {
- // mw = bw;
- // }
- // /* ----------------------------------- */
-
- /* --- FIND TRUE MASTER WINDOW (SKIPPING SIDE PANELS) --- */
- Client *master_c = NULL;
+ /* --- FIND ZATHURA ON THE CURRENT TAG --- */
+ Client *zathura_c = NULL;
for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
if ((c->tags & m->tagset[m->seltags]) && !c->isSidePanel) {
- master_c = c;
- break;
+ if (strstr(c->class, "Zathura") || strstr(c->class, "zathura")) {
+ zathura_c = c;
+ break;
+ }
}
}
- /* ----------------------------------------------------- */
- if (master_c && (strstr(master_c->class, "Zathura") || strstr(master_c->class, "zathura"))) {
+ /* -------------------------------------- */
+
+ /* Determine master width (mw) */
+ if (zathura_c && nt > 1) {
mw = zathura_width;
} else if (nt > m->nmaster) {
mw = m->nmaster ? (bw - g) * m->mfact : 0;
} else {
mw = bw;
}
- /* --------------------------------------------------- */
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
- if (!(c->tags & m->tagset[m->seltags]) || c->isSidePanel)
+ i = 0;
+ my = 0;
+ ty = 0;
+
+ /* --- FORCE ZATHURA TO THE MASTER POSITION FIRST --- */
+ if (zathura_c) {
+ unsigned int nmat = MIN(nt, m->nmaster);
+ h = (bh - my - g * (nmat - 1 - i)) / (nmat - i);
+ resize(zathura_c, bx, by + my, mw - (2 * zathura_c->bw), h - (2 * zathura_c->bw), 0);
+ my += h + g;
+ i++;
+ }
+ /* ------------------------------------------------ */
+
+ /* Render all remaining tiled clients into master or stack */
+ for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
+ if (!(c->tags & m->tagset[m->seltags]) || c->isSidePanel || c == zathura_c)
continue;
if (i < m->nmaster) {