From: A-Larsen Date: Tue, 13 Oct 2026 14:57:32 +0000 (-0400) Subject: force zathura to master X-Git-Url: https://nyquistdev.net/git/?a=commitdiff_plain;h=c1a8d8d34ae290a2ad6c6322012ba74da8ea1c4f;p=dwm-config.git force zathura to master --- diff --git a/dwm b/dwm index 66c81f7..9aeeb0e 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index 782a445..a3934df 100644 --- a/dwm.c +++ b/dwm.c @@ -3433,6 +3433,59 @@ tagmon(const Arg *arg) // } // } +// 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) { @@ -3447,43 +3500,44 @@ 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) { diff --git a/dwm.o b/dwm.o index a8a05cb..37ceb48 100644 Binary files a/dwm.o and b/dwm.o differ