]> nyquistdev.net Git - dwm-config.git/commitdiff
fixed size for zathur
authorA-Larsen <austin.larsen@mailfence.com>
Tue, 13 Oct 2026 04:53:44 +0000 (00:53 -0400)
committerA-Larsen <austin.larsen@mailfence.com>
Tue, 13 Oct 2026 04:53:44 +0000 (00:53 -0400)
config.def.h
config.h
dwm
dwm.c
dwm.o

index e283226c5286bb729588c0ea48461e52000eb968..acb14fb537ac24544eb30cb050de05b67b18155e 100644 (file)
@@ -37,6 +37,7 @@ static const char col_cyan[]        = "#d8bb6d";
 // };
 /* In config.h */
 
+const unsigned int zathura_width = 750;
 const unsigned int blender_width    = 800;
 const unsigned int blender_height   = 500;
 // const unsigned int calc_width       = 400;
@@ -107,7 +108,7 @@ static const Rule rules[] = {
     { "Xephyr",             NULL,    NULL,              0,            0,           0,           1,            1,           0,           NULL,         1},
     { "Brave-browser",      NULL,    NULL,              1<<0,         0,           1,           0,            1,           0,           NULL,         1},
     { "Alacritty",          NULL,    NULL,              1<<0,         0,           1,           0,            0,           0,           NULL,         1},
-    { "Zathura",            NULL,    NULL,              1<<0,         0,           1,           0,            1,           0,           &layouts[2],  1},
+    { "Zathura",            NULL,    NULL,              1<<0,         0,           1,           0,            1,           0,           NULL,         1},
     { "steam",              NULL,    NULL,              1<<1,         0,           1,           0,            0,           0,           &layouts[2],  0},
     { "steam",              NULL,   "Friends List",     1<<1,         0,           0,           1,            1,           1,           NULL,         0},
     { "steam",              NULL, "Steam Settings",     0,            1,           0,           0,            0,           0,           NULL,         0},
index e283226c5286bb729588c0ea48461e52000eb968..acb14fb537ac24544eb30cb050de05b67b18155e 100644 (file)
--- a/config.h
+++ b/config.h
@@ -37,6 +37,7 @@ static const char col_cyan[]        = "#d8bb6d";
 // };
 /* In config.h */
 
+const unsigned int zathura_width = 750;
 const unsigned int blender_width    = 800;
 const unsigned int blender_height   = 500;
 // const unsigned int calc_width       = 400;
@@ -107,7 +108,7 @@ static const Rule rules[] = {
     { "Xephyr",             NULL,    NULL,              0,            0,           0,           1,            1,           0,           NULL,         1},
     { "Brave-browser",      NULL,    NULL,              1<<0,         0,           1,           0,            1,           0,           NULL,         1},
     { "Alacritty",          NULL,    NULL,              1<<0,         0,           1,           0,            0,           0,           NULL,         1},
-    { "Zathura",            NULL,    NULL,              1<<0,         0,           1,           0,            1,           0,           &layouts[2],  1},
+    { "Zathura",            NULL,    NULL,              1<<0,         0,           1,           0,            1,           0,           NULL,         1},
     { "steam",              NULL,    NULL,              1<<1,         0,           1,           0,            0,           0,           &layouts[2],  0},
     { "steam",              NULL,   "Friends List",     1<<1,         0,           0,           1,            1,           1,           NULL,         0},
     { "steam",              NULL, "Steam Settings",     0,            1,           0,           0,            0,           0,           NULL,         0},
diff --git a/dwm b/dwm
index 7fee6f551b32b1451aea0050746eee0bd212596f..78f5eeab6d1bc2e1678a994120b4101408e3dded 100755 (executable)
Binary files a/dwm and b/dwm differ
diff --git a/dwm.c b/dwm.c
index b093df847ac55bfd7d67e9664bed2a1388ea58d8..578ccf0b86583e4cd6f25236f824b62acc1cd666 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -520,14 +520,60 @@ centeredmaster(Monitor *m)
        mx = bx;
        tw = bw;
 
-       if (nt > m->nmaster) {
-               mw = m->nmaster ? (bw - 2 * g) * m->mfact : 0;
-               tw = (bw - mw - 2 * g) / 2;
-               if (nt - m->nmaster > 1)
-                       mx = bx + tw + g;
-               else
-                       tw = bw - mw - g;
+       // if (nt > m->nmaster) {
+       //      mw = m->nmaster ? (bw - 2 * g) * m->mfact : 0;
+       //      tw = (bw - mw - 2 * g) / 2;
+       //      if (nt - m->nmaster > 1)
+       //              mx = bx + tw + g;
+       //      else
+       //              tw = bw - mw - g;
+       // }
+    // if (nt > m->nmaster) {
+               // /* --- FIXED ZATHURA WIDTH OVERRIDE --- */
+               // Client *master_c = nexttiled(m->clients);
+               // if (master_c && strstr(master_c->class, "Zathura"))
+                       // mw = zathura_width;
+               // else
+                       // mw = m->nmaster ? (bw - 2 * g) * m->mfact : 0;
+               // /* ----------------------------------- */
+
+               // tw = (bw - mw - 2 * g) / 2;
+               // if (nt - m->nmaster > 1)
+                       // mx = bx + tw + g;
+               // else
+                       // tw = bw - mw - g;
+       // }
+    /* --- 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;
+               }
        }
+       /* ----------------------------------------------------- */
+    int is_zathura = (master_c && (strstr(master_c->class, "Zathura") ||
+                      strstr(master_c->class, "zathura")));
+
+    if (is_zathura) {
+        mw = zathura_width;
+        if (nt > m->nmaster) {
+            tw = (bw - mw - 2 * g) / 2;
+            if (nt - m->nmaster > 1)
+                mx = bx + tw + g;
+            else
+                tw = bw - mw - g;
+        } else {
+            mx = bx + (bw - mw) / 2;
+        }
+    } else if (nt > m->nmaster) {
+        mw = m->nmaster ? (bw - 2 * g) * m->mfact : 0;
+        tw = (bw - mw - 2 * g) / 2;
+        if (nt - m->nmaster > 1)
+            mx = bx + tw + g;
+        else
+            tw = bw - mw - g;
+    }
 
        oty = 0;
        ety = 0;
@@ -1837,6 +1883,9 @@ focusmon(const Arg *arg)
        unfocus(selmon->sel, 0);
        selmon = m;
        focus(NULL);
+    XWarpPointer(dpy, None, root, 0, 0, 0, 0,
+                    selmon->wx + selmon->ww / 2,
+                    selmon->wy + selmon->wh / 2);
 }
 
 // void
@@ -3343,10 +3392,40 @@ tile(Monitor *m)
 
        int g = gappx;
 
-       if (nt > m->nmaster)
+       // 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;
+       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
+       } 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)
diff --git a/dwm.o b/dwm.o
index 4bcac9d30392a3b4bb6f43fa76f12916aee37413..42f27b55be1cf0d8234adef74356e3df513ed147 100644 (file)
Binary files a/dwm.o and b/dwm.o differ