~ctb/dwm

b2ce371386fa270ee47b9a700dd8fa3b5638a7f5 — Christopher Thomas Bohn 2 years ago dad50b6 + 2685a03
uselessgaps
2 files changed, 31 insertions(+), 6 deletions(-)

M config.def.h
M dwm.c
M config.def.h => config.def.h +1 -0
@@ 2,6 2,7 @@

/* appearance */
static const unsigned int borderpx  = 3;        /* border pixel of windows */
static const unsigned int gappx     = 6;        /* gaps between windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const int swallowfloating    = 0;        /* 1 means swallow floating windows by default */
static const int showbar            = 1;        /* 0 means no bar */

M dwm.c => dwm.c +30 -6
@@ 54,8 54,8 @@
#define ISVISIBLE(C)            ((C->tags & C->mon->tagset[C->mon->seltags]))
#define LENGTH(X)               (sizeof X / sizeof X[0])
#define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
#define WIDTH(X)                ((X)->w + 2 * (X)->bw)
#define HEIGHT(X)               ((X)->h + 2 * (X)->bw)
#define WIDTH(X)                ((X)->w + 2 * (X)->bw + gappx)
#define HEIGHT(X)               ((X)->h + 2 * (X)->bw + gappx)
#define TAGMASK                 ((1 << LENGTH(tags)) - 1)
#define TEXTW(X)                (drw_fontset_getwidth(drw, (X)) + lrpad)



@@ 1376,12 1376,36 @@ void
resizeclient(Client *c, int x, int y, int w, int h)
{
	XWindowChanges wc;
	unsigned int n;
	unsigned int gapoffset;
	unsigned int gapincr;
	Client *nbc;

	c->oldx = c->x; c->x = wc.x = x;
	c->oldy = c->y; c->y = wc.y = y;
	c->oldw = c->w; c->w = wc.width = w;
	c->oldh = c->h; c->h = wc.height = h;
	wc.border_width = c->bw;

	/* Get number of clients for the selected monitor */
	for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++);

	/* Do nothing if layout is floating */
	if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) {
		gapincr = gapoffset = 0;
	} else {
		/* Remove border and gap if layout is monocle or only one client */
		if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) {
			gapoffset = 0;
			gapincr = -2 * borderpx;
			wc.border_width = 0;
		} else {
			gapoffset = gappx;
			gapincr = 2 * gappx;
		}
	}

	c->oldx = c->x; c->x = wc.x = x + gapoffset;
	c->oldy = c->y; c->y = wc.y = y + gapoffset;
	c->oldw = c->w; c->w = wc.width = w - gapincr;
	c->oldh = c->h; c->h = wc.height = h - gapincr;

	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
	configure(c);
	XSync(dpy, False);