]> nyquistdev.net Git - dwm-config.git/commitdiff
force zathura to master
authorA-Larsen <austin.larsen@mailfence.com>
Tue, 13 Oct 2026 14:57:32 +0000 (10:57 -0400)
committerA-Larsen <austin.larsen@mailfence.com>
Tue, 13 Oct 2026 14:57:32 +0000 (10:57 -0400)
dwm
dwm.c
dwm.o

diff --git a/dwm b/dwm
index 66c81f72dcefbba1364fb57bedadb6c286150f87..9aeeb0eed2d5163cf0bb6269a574a36d18c16a0a 100755 (executable)
Binary files a/dwm and b/dwm differ
diff --git a/dwm.c b/dwm.c
index 782a4452250127ef966d7185e28a5b61d5a6555b..a3934df5a1ffc3e6dd1532cd3888cd2fb3da9e4a 100644 (file)
--- 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 a8a05cbb5bb24549ff9c54d211a870d96adb61c8..37ceb487b2712fb1fdca640c52a198b03754e1f0 100644 (file)
Binary files a/dwm.o and b/dwm.o differ