Created
May 30, 2019 08:42
-
-
Save rjl6789/617e4edd6b794a14969f5c88e8918ff4 to your computer and use it in GitHub Desktop.
some minor corrections and tidy up of dwm-ru_gaps-6.2.diff and associated bottomstack patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -up 6.2/config.def.h ru/config.def.h | |
--- 6.2/config.def.h 2019-05-30 09:01:26.113367993 +0100 | |
+++ ru/config.def.h 2019-05-30 08:48:06.076698048 +0100 | |
@@ -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 */ | |
@@ -84,6 +85,9 @@ static 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 6.2/dwm.c ru/dwm.c | |
--- 6.2/dwm.c 2019-05-30 09:01:26.116701327 +0100 | |
+++ ru/dwm.c 2019-05-30 09:12:20.230037558 +0100 | |
@@ -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]; | |
@@ -198,6 +199,7 @@ static int sendevent(Client *c, Atom pro | |
static void sendmon(Client *c, Monitor *m); | |
static void setclientstate(Client *c, long state); | |
static void setfocus(Client *c); | |
+static void setgaps(const Arg *arg); | |
static void setfullscreen(Client *c, int fullscreen); | |
static void setlayout(const Arg *arg); | |
static void setmfact(const Arg *arg); | |
@@ -638,6 +640,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); | |
@@ -1282,6 +1285,13 @@ resizeclient(Client *c, int x, int y, in | |
c->oldw = c->w; c->w = wc.width = w; | |
c->oldh = c->h; c->h = wc.height = h; | |
wc.border_width = c->bw; | |
+ if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) | |
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange)) | |
+ { | |
+ c->w = wc.width += c->bw * 2; | |
+ c->h = wc.height += c->bw * 2; | |
+ wc.border_width = 0; | |
+ } | |
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); | |
configure(c); | |
XSync(dpy, False); | |
@@ -1498,6 +1508,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]) | |
@@ -1680,19 +1700,25 @@ tile(Monitor *m) | |
if (n == 0) | |
return; | |
+ if(n == 1){ | |
+ c = nexttiled(m->clients); | |
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); | |
+ return; | |
+ } | |
+ | |
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++) | |
+ 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); | |
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0); | |
- my += HEIGHT(c); | |
+ 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); | |
+ 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); | |
- ty += HEIGHT(c); | |
+ h = (m->wh - ty) / (n - i) - m->gappx; | |
+ resize(c, m->wx + mw , m->wy + ty, m->ww - mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0); | |
+ ty += HEIGHT(c) + m->gappx; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -up ru_applied/config.def.h ru_bottom_stack/config.def.h | |
--- ru_applied/config.def.h 2019-05-30 09:14:31.833371475 +0100 | |
+++ ru_bottom_stack/config.def.h 2019-05-30 08:52:36.890032508 +0100 | |
@@ -42,6 +42,8 @@ static const Layout layouts[] = { | |
{ "[]=", tile }, /* first entry is default */ | |
{ "><>", NULL }, /* no layout function means floating behavior */ | |
{ "[M]", monocle }, | |
+ { "TTT", bstack }, | |
+ { "===", bstackhoriz }, | |
}; | |
/* key definitions */ | |
@@ -77,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_u, setlayout, {.v = &layouts[3]} }, | |
+ { MODKEY|ShiftMask, XK_u, setlayout, {.v = &layouts[4]} }, | |
{ MODKEY, XK_space, setlayout, {0} }, | |
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, | |
{ MODKEY, XK_0, view, {.ui = ~0 } }, | |
diff -up ru_applied/dwm.c ru_bottom_stack/dwm.c | |
--- ru_applied/dwm.c 2019-05-30 09:14:31.836704807 +0100 | |
+++ ru_bottom_stack/dwm.c 2019-05-30 09:19:46.360039517 +0100 | |
@@ -211,6 +211,8 @@ static void spawn(const Arg *arg); | |
static void tag(const Arg *arg); | |
static void tagmon(const Arg *arg); | |
static void tile(Monitor *); | |
+static void bstack(Monitor *); | |
+static void bstackhoriz(Monitor *); | |
static void togglebar(const Arg *arg); | |
static void togglefloating(const Arg *arg); | |
static void toggletag(const Arg *arg); | |
@@ -2173,3 +2175,67 @@ main(int argc, char *argv[]) | |
XCloseDisplay(dpy); | |
return EXIT_SUCCESS; | |
} | |
+ | |
+void | |
+bstack(Monitor *m) | |
+{ | |
+ unsigned int i, n, w, mh, mx, tx; | |
+ Client *c; | |
+ | |
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); | |
+ if (n == 0) | |
+ return; | |
+ if(n == 1){ | |
+ c = nexttiled(m->clients); | |
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); | |
+ return; | |
+ } | |
+ | |
+ if (n > m->nmaster) | |
+ mh = m->nmaster ? m->wh * m->mfact : 0; | |
+ else | |
+ mh = m->wh; | |
+ for (i = 0, mx = tx = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) | |
+ if (i < m->nmaster) { | |
+ w = (m->ww - mx) / (MIN(n, m->nmaster) - i) - m->gappx; | |
+ resize(c, m->wx + mx, m->wy + m->gappx, w - (2*c->bw), mh - 2*(c->bw + m->gappx), 0); | |
+ mx += WIDTH(c) + m->gappx; | |
+ } else { | |
+ w = (m->ww - tx) / (n - i) - m->gappx; | |
+ resize(c, m->wx + tx, m->wy + mh, w - (2*c->bw), m->wh - mh - 2*(c->bw) - m->gappx, 0); | |
+ tx += WIDTH(c) + m->gappx; | |
+ } | |
+} | |
+ | |
+void | |
+bstackhoriz(Monitor *m) | |
+{ | |
+ unsigned int i, n, h, mw, mh, my, ty; | |
+ Client *c; | |
+ | |
+ for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); | |
+ if (n == 0) | |
+ return; | |
+ if(n == 1){ | |
+ c = nexttiled(m->clients); | |
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0); | |
+ return; | |
+ } | |
+ | |
+ if (n > m->nmaster) | |
+ mh = m->nmaster ? m->wh * m->mfact : 0; | |
+ else | |
+ mh = m->wh; | |
+ mw = m->ww; | |
+ | |
+ for (i = ty = 0, my = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) | |
+ if (i < m->nmaster) { | |
+ h = (mh - 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); | |
+ my += HEIGHT(c) + m->gappx; | |
+ } else { | |
+ h = (m->wh - mh - ty) / (n - i) - m->gappx; | |
+ resize(c, m->wx + m->gappx, m->wy + mh + ty, mw - 2*(c->bw + m->gappx), h - (2*c->bw), 0); | |
+ ty += HEIGHT(c) + m->gappx; | |
+ } | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment