---
config.def.h | 8 ++++++++
dwm.c | 38 +++++++++++++++++++++++++++++++++++---
2 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..ff87720 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -33,6 +33,8 @@ static const Rule rules[] = {
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+static const float vfactmaster = 0.5; /* vertical factor of first master tile */
+static const float vfactstack = 0.5; /* vertical factor of first stack tile */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
_AT_@ -94,6 +96,12 @@ static Key keys[] = {
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
+ { MODKEY, XK_y, setvfactmaster, {.f = +0.05} },
+ { MODKEY|ShiftMask, XK_y, setvfactmaster, {.f = -0.05} },
+ { MODKEY|ControlMask, XK_y, setvfactmaster, {.f = +1.0 } },
+ { MODKEY, XK_o, setvfactstack, {.f = +0.05} },
+ { MODKEY|ShiftMask, XK_o, setvfactstack, {.f = -0.05} },
+ { MODKEY|ControlMask, XK_o, setvfactstack, {.f = +1.0 } },
};
/* button definitions */
diff --git a/dwm.c b/dwm.c
index 664c527..fe71c14 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -114,6 +114,8 @@ typedef struct {
struct Monitor {
char ltsymbol[16];
float mfact;
+ float vfactmaster;
+ float vfactstack;
int nmaster;
int num;
int by; /* bar geometry */
_AT_@ -204,6 +206,9 @@ static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void seturgent(Client *c, int urg);
+static void setvfact(float *factor, float f);
+static void setvfactmaster(const Arg *arg);
+static void setvfactstack(const Arg *arg);
static void showhide(Client *c);
static void sigchld(int unused);
static void spawn(const Arg *arg);
_AT_@ -636,6 +641,8 @@ createmon(void)
m = ecalloc(1, sizeof(Monitor));
m->tagset[0] = m->tagset[1] = 1;
m->mfact = mfact;
+ m->vfactmaster = vfactmaster;
+ m->vfactstack = vfactstack;
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
_AT_@ -1611,6 +1618,27 @@ seturgent(Client *c, int urg)
XFree(wmh);
}
+void
+setvfact(float *factor, float f) {
+ if (!selmon->lt[selmon->sellt]->arrange)
+ return;
+ f += (*factor < 0.05 ? 0.5 : *factor);
+ *factor = f < 1.0 ? (f < 0.05 || f > 0.95 ? *factor : f) : 0.0;
+ arrange(selmon);
+}
+
+void
+setvfactmaster(const Arg *arg)
+{
+ setvfact(&selmon->vfactmaster, arg->f);
+}
+
+void
+setvfactstack(const Arg *arg)
+{
+ setvfact(&selmon->vfactstack, arg->f);
+}
+
void
showhide(Client *c)
{
_AT_@ -1687,13 +1715,17 @@ tile(Monitor *m)
mw = m->ww;
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+ h = (i == 0 && MIN(n, m->nmaster) > 1 && m->vfactmaster > 0.01) ?
+ m->wh * m->vfactmaster :
+ (m->wh - my) / (MIN(n, m->nmaster) - i);
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
if (my + HEIGHT(c) < m->wh)
my += HEIGHT(c);
} else {
- h = (m->wh - ty) / (n - i);
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
+ h = (i == m->nmaster && n - i > 1 && m->vfactstack > 0.01) ?
+ m->wh * m->vfactstack : (m->wh - ty) / (n - i);
+ resize(c, m->wx + mw, m->wy + ty,
+ m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
if (ty + HEIGHT(c) < m->wh)
ty += HEIGHT(c);
}
--
2.29.2
Received on Sat Nov 28 2020 - 20:23:45 CET
This archive was generated by hypermail 2.3.0 : Sat Nov 28 2020 - 20:36:32 CET