add fullgaps patch
This commit is contained in:
parent
33081ed8e6
commit
9a51d0912b
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const unsigned int gappx = 5; /* gaps between windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
@ -85,6 +86,9 @@ static const Key keys[] = {
|
|||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
{ MODKEY, XK_minus, setgaps, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_equal, setgaps, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||||
TAGKEYS( XK_1, 0)
|
TAGKEYS( XK_1, 0)
|
||||||
TAGKEYS( XK_2, 1)
|
TAGKEYS( XK_2, 1)
|
||||||
TAGKEYS( XK_3, 2)
|
TAGKEYS( XK_3, 2)
|
||||||
|
35
dwm.c
35
dwm.c
@ -122,6 +122,7 @@ struct Monitor {
|
|||||||
int by; /* bar geometry */
|
int by; /* bar geometry */
|
||||||
int mx, my, mw, mh; /* screen size */
|
int mx, my, mw, mh; /* screen size */
|
||||||
int wx, wy, ww, wh; /* window area */
|
int wx, wy, ww, wh; /* window area */
|
||||||
|
int gappx; /* gaps between windows */
|
||||||
unsigned int seltags;
|
unsigned int seltags;
|
||||||
unsigned int sellt;
|
unsigned int sellt;
|
||||||
unsigned int tagset[2];
|
unsigned int tagset[2];
|
||||||
@ -207,6 +208,7 @@ static void sendmon(Client *c, Monitor *m);
|
|||||||
static void setclientstate(Client *c, long state);
|
static void setclientstate(Client *c, long state);
|
||||||
static void setfocus(Client *c);
|
static void setfocus(Client *c);
|
||||||
static void setfullscreen(Client *c, int fullscreen);
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
|
static void setgaps(const Arg *arg);
|
||||||
static void setlayout(const Arg *arg);
|
static void setlayout(const Arg *arg);
|
||||||
static void setmfact(const Arg *arg);
|
static void setmfact(const Arg *arg);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
@ -652,6 +654,7 @@ createmon(void)
|
|||||||
m->nmaster = nmaster;
|
m->nmaster = nmaster;
|
||||||
m->showbar = showbar;
|
m->showbar = showbar;
|
||||||
m->topbar = topbar;
|
m->topbar = topbar;
|
||||||
|
m->gappx = gappx;
|
||||||
m->lt[0] = &layouts[0];
|
m->lt[0] = &layouts[0];
|
||||||
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
@ -1611,6 +1614,16 @@ setfullscreen(Client *c, int fullscreen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setgaps(const Arg *arg)
|
||||||
|
{
|
||||||
|
if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
|
||||||
|
selmon->gappx = 0;
|
||||||
|
else
|
||||||
|
selmon->gappx += arg->i;
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setlayout(const Arg *arg)
|
setlayout(const Arg *arg)
|
||||||
{
|
{
|
||||||
@ -1818,18 +1831,18 @@ tile(Monitor *m)
|
|||||||
if (n > m->nmaster)
|
if (n > m->nmaster)
|
||||||
mw = m->nmaster ? m->ww * m->mfact : 0;
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
else
|
else
|
||||||
mw = m->ww;
|
mw = m->ww - m->gappx;
|
||||||
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
|
resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
|
||||||
if (my + HEIGHT(c) < m->wh)
|
if (my + HEIGHT(c) + m->gappx < m->wh)
|
||||||
my += HEIGHT(c);
|
my += HEIGHT(c) + m->gappx;
|
||||||
} else {
|
} else {
|
||||||
h = (m->wh - ty) / (n - i);
|
h = (m->wh - ty) / (n - i) - m->gappx;
|
||||||
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
|
||||||
if (ty + HEIGHT(c) < m->wh)
|
if (ty + HEIGHT(c) + m->gappx < m->wh)
|
||||||
ty += HEIGHT(c);
|
ty += HEIGHT(c) + m->gappx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
patch
6
patch
@ -1,9 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
order=("dwm-cursorwarp" "dwm-gaps" "dwm-torus")
|
order=("dwm-cursorwarp" "dwm-fullgaps" "dwm-torus")
|
||||||
|
|
||||||
for patch in ${order[@]}; do
|
for patch in ${order[@]}; do
|
||||||
patch_file=$(ls patches | grep $patch)
|
patch_file=$(ls patches | grep $patch)
|
||||||
echo "applying patch $patch_file..."
|
echo "applying patch $patch_file..."
|
||||||
git apply "patches/$patch_file" || echo "failed to patch $patch_file. it may've already been applied!"
|
git apply "patches/$patch_file" || patch < "patches/$patch_file" || echo "failed to patch $patch_file. it may've already been applied!"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm *.orig
|
||||||
|
94
patches/dwm-fullgaps-6.4.diff
Normal file
94
patches/dwm-fullgaps-6.4.diff
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
diff -up a/config.def.h b/config.def.h
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
+static const unsigned int gappx = 5; /* gaps between windows */
|
||||||
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
|
@@ -85,6 +86,9 @@ static const Key keys[] = {
|
||||||
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
+ { MODKEY, XK_minus, setgaps, {.i = -1 } },
|
||||||
|
+ { MODKEY, XK_equal, setgaps, {.i = +1 } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||||
|
TAGKEYS( XK_1, 0)
|
||||||
|
TAGKEYS( XK_2, 1)
|
||||||
|
TAGKEYS( XK_3, 2)
|
||||||
|
diff -up a/dwm.c b/dwm.c
|
||||||
|
--- a/dwm.c 2023-04-30
|
||||||
|
+++ b/dwm.c 2023-04-30
|
||||||
|
@@ -119,6 +119,7 @@ struct Monitor {
|
||||||
|
int by; /* bar geometry */
|
||||||
|
int mx, my, mw, mh; /* screen size */
|
||||||
|
int wx, wy, ww, wh; /* window area */
|
||||||
|
+ int gappx; /* gaps between windows */
|
||||||
|
unsigned int seltags;
|
||||||
|
unsigned int sellt;
|
||||||
|
unsigned int tagset[2];
|
||||||
|
@@ -200,6 +201,7 @@ static void sendmon(Client *c, Monitor *
|
||||||
|
static void setclientstate(Client *c, long state);
|
||||||
|
static void setfocus(Client *c);
|
||||||
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
|
+static void setgaps(const Arg *arg);
|
||||||
|
static void setlayout(const Arg *arg);
|
||||||
|
static void setmfact(const Arg *arg);
|
||||||
|
static void setup(void);
|
||||||
|
@@ -641,6 +643,7 @@ createmon(void)
|
||||||
|
m->nmaster = nmaster;
|
||||||
|
m->showbar = showbar;
|
||||||
|
m->topbar = topbar;
|
||||||
|
+ m->gappx = gappx;
|
||||||
|
m->lt[0] = &layouts[0];
|
||||||
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
|
@@ -1508,6 +1511,16 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
+setgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
|
||||||
|
+ selmon->gappx = 0;
|
||||||
|
+ else
|
||||||
|
+ selmon->gappx += arg->i;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
setlayout(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||||
|
@@ -1697,18 +1710,18 @@ tile(Monitor *m)
|
||||||
|
if (n > m->nmaster)
|
||||||
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
else
|
||||||
|
- 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);
|
||||||
|
- 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);
|
||||||
|
+ mw = m->ww - m->gappx;
|
||||||
|
+ for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
+ if (i < m->nmaster) {
|
||||||
|
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||||
|
+ resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
|
||||||
|
+ if (my + HEIGHT(c) + m->gappx < m->wh)
|
||||||
|
+ my += HEIGHT(c) + m->gappx;
|
||||||
|
} 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);
|
||||||
|
- if (ty + HEIGHT(c) < m->wh)
|
||||||
|
- ty += HEIGHT(c);
|
||||||
|
+ h = (m->wh - ty) / (n - i) - m->gappx;
|
||||||
|
+ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
|
||||||
|
+ if (ty + HEIGHT(c) + m->gappx < m->wh)
|
||||||
|
+ ty += HEIGHT(c) + m->gappx;
|
||||||
|
}
|
||||||
|
}
|
@ -1,53 +0,0 @@
|
|||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 77ff358..a4e496b 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -9,6 +9,7 @@ static const char selbordercolor[] = "#005577";
|
|
||||||
static const char selbgcolor[] = "#005577";
|
|
||||||
static const char selfgcolor[] = "#eeeeee";
|
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
|
||||||
+static const unsigned int gappx = 1; /* gap pixel between windows */
|
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
|
||||||
static const Bool showbar = True; /* False means no bar */
|
|
||||||
static const Bool topbar = True; /* False means bottom bar */
|
|
||||||
diff --git a/dwm.c b/dwm.c
|
|
||||||
index 1d78655..6cc96ff 100644
|
|
||||||
--- a/dwm.c
|
|
||||||
+++ b/dwm.c
|
|
||||||
@@ -1703,7 +1703,7 @@ textnw(const char *text, unsigned int len) {
|
|
||||||
|
|
||||||
void
|
|
||||||
tile(Monitor *m) {
|
|
||||||
- unsigned int i, n, h, mw, my, ty;
|
|
||||||
+ unsigned int i, n, h, r, g = 0, mw, my, ty;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
||||||
@@ -1711,19 +1711,21 @@ tile(Monitor *m) {
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(n > m->nmaster)
|
|
||||||
- mw = m->nmaster ? m->ww * m->mfact : 0;
|
|
||||||
+ mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0;
|
|
||||||
else
|
|
||||||
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);
|
|
||||||
+ r = MIN(n, m->nmaster) - i;
|
|
||||||
+ h = (m->wh - my - gappx * (r - 1)) / r;
|
|
||||||
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
|
|
||||||
- my += HEIGHT(c);
|
|
||||||
+ my += HEIGHT(c) + gappx;
|
|
||||||
}
|
|
||||||
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), False);
|
|
||||||
- ty += HEIGHT(c);
|
|
||||||
+ r = n - i;
|
|
||||||
+ h = (m->wh - ty - gappx * (r - 1)) / r;
|
|
||||||
+ resize(c, m->wx + mw + g, m->wy + ty, m->ww - mw - g - (2*c->bw), h - (2*c->bw), False);
|
|
||||||
+ ty += HEIGHT(c) + gappx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user