dwm gaps patch
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
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 int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
|
||||
@@ -37,11 +37,14 @@ static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
|
||||
#include "fibonacci.c"
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
{ "[@]", spiral },
|
||||
{ "[\\]", dwindle },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -77,6 +80,8 @@ static const Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XK_r, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY|ShiftMask, XK_r, setlayout, {.v = &layouts[4]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
|
||||
+8
-24
@@ -1,26 +1,10 @@
|
||||
--- config.def.h
|
||||
+++ config.def.h
|
||||
@@ -36,11 +36,14 @@ static const float mfact = 0.55; /* factor of master area size [0.05..0.95]
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
|
||||
+#include "fibonacci.c"
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
{ "[]=", tile }, /* first entry is default */
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
+ { "[@]", spiral },
|
||||
+ { "[\\]", dwindle },
|
||||
};
|
||||
|
||||
/* key definitions */
|
||||
@@ -76,6 +79,8 @@ static Key keys[] = {
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
+ { MODKEY, XK_r, setlayout, {.v = &layouts[3]} },
|
||||
+ { MODKEY|ShiftMask, XK_r, setlayout, {.v = &layouts[4]} },
|
||||
{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
||||
@@ -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 */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
/* appearance */
|
||||
static const unsigned int borderpx = 5; /* border pixel of windows */
|
||||
static const unsigned int gappx = 5; /* gap pixel 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 */
|
||||
|
||||
@@ -1687,7 +1687,7 @@ tagmon(const Arg *arg)
|
||||
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++);
|
||||
@@ -1695,20 +1695,22 @@ 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), 0);
|
||||
if (my + HEIGHT(c) < m->wh)
|
||||
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), 0);
|
||||
if (ty + HEIGHT(c) < m->wh)
|
||||
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), 0);
|
||||
if (ty + HEIGHT(c) + gappx < m->wh)
|
||||
ty += HEIGHT(c) + gappx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2167
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,39 @@
|
||||
--- dwm.c
|
||||
+++ 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), 0);
|
||||
- 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), 0);
|
||||
+ ty += HEIGHT(c) + gappx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
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), 0);
|
||||
- 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), 0);
|
||||
+ ty += HEIGHT(c) + gappx;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user