From: A-Larsen Date: Tue, 13 Oct 2026 04:53:44 +0000 (-0400) Subject: fixed size for zathur X-Git-Url: https://nyquistdev.net/git/?a=commitdiff_plain;h=746c61ce6168c9a1074afb2b690fe00d40d90dc1;p=dwm-config.git fixed size for zathur --- diff --git a/config.def.h b/config.def.h index e283226..acb14fb 100644 --- a/config.def.h +++ b/config.def.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/config.h b/config.h index e283226..acb14fb 100644 --- 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 7fee6f5..78f5eea 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index b093df8..578ccf0 100644 --- 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 4bcac9d..42f27b5 100644 Binary files a/dwm.o and b/dwm.o differ