Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add bstack and useless-gap patches

  • Loading branch information...
commit ac6f11102f2846d47ed93f18d7f2c126fbcde041 1 parent 5d668b5
@falconindy authored
Showing with 39 additions and 4 deletions.
  1. +4 −0 config.h
  2. +35 −4 dwm.c
View
4 config.h
@@ -1,5 +1,6 @@
/* See LICENSE file for copyright and license details. */
+
/* appearance */
//static const char font[] = "-*-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*";
static const char font[] = "-*-nu-*-*-*-*-11-*-*-*-*-*-*-*";
@@ -13,6 +14,7 @@ static const unsigned int borderpx = 1; /* border pixel of 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 */
+static const unsigned int gappx = 4; /* gap pixel between windows */
/* tagging */
static const char *tags[] = { "web", "term", "foo", "vbox", "misc" };
@@ -36,6 +38,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "TTT", bstack },
};
/* key definitions */
@@ -89,6 +92,7 @@ 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_y, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
View
39 dwm.c
@@ -136,6 +136,7 @@ static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
static void attachstack(Client *c);
+static void bstack(Monitor *m);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
static void cleanup(void);
@@ -417,6 +418,36 @@ attachstack(Client *c) {
c->mon->stack = c;
}
+static void
+bstack(Monitor *m) {
+ int x, y, h, w, mh;
+ unsigned int i, n;
+ Client *c;
+
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ if(n == 0)
+ return;
+ /* master */
+ c = nexttiled(m->clients);
+ mh = m->mfact * m->wh;
+ resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * c->bw, False);
+ if(--n == 0)
+ return;
+ /* tile stack */
+ x = m->wx;
+ y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh;
+ w = m->ww / n;
+ h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh;
+ if(w < bh)
+ w = m->ww;
+ for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
+ resize(c, x, y, /* remainder */ ((i + 1 == n)
+ ? m->wx + m->ww - x - 2 * c->bw : w - 2 * c->bw), h - 2 * c->bw, False);
+ if(w != m->ww)
+ x = c->x + WIDTH(c);
+ }
+}
+
void
buttonpress(XEvent *e) {
unsigned int i, x, click;
@@ -1305,10 +1336,10 @@ resize(Client *c, int x, int y, int w, int h, Bool interact) {
XWindowChanges wc;
if(applysizehints(c, &x, &y, &w, &h, interact)) {
- c->x = wc.x = x;
- c->y = wc.y = y;
- c->w = wc.width = w;
- c->h = wc.height = h;
+ c->x = wc.x = x + gappx;
+ c->y = wc.y = y + gappx;
+ c->w = wc.width = w - 2 * gappx ;
+ c->h = wc.height = h - 2 * gappx ;
wc.border_width = c->bw;
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
Please sign in to comment.
Something went wrong with that request. Please try again.