about summary refs log tree commit diff
path: root/patches
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-10 11:54:03 +0200
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-06-10 11:54:03 +0200
commit95d01d54ff5ff3a39d1c0fb9ad1d0017f489f9f3 (patch)
tree040550993518c66c34ac58511f36635f07f57326 /patches
parentAdded activetagindicator [Patch] (diff)
downloaddwm-95d01d54ff5ff3a39d1c0fb9ad1d0017f489f9f3.tar.gz
dwm-95d01d54ff5ff3a39d1c0fb9ad1d0017f489f9f3.tar.bz2
dwm-95d01d54ff5ff3a39d1c0fb9ad1d0017f489f9f3.zip
Improved gaps patch
Diffstat (limited to 'patches')
-rw-r--r--patches/dwm-muhgaps-6.2.diff153
1 files changed, 109 insertions, 44 deletions
diff --git a/patches/dwm-muhgaps-6.2.diff b/patches/dwm-muhgaps-6.2.diff
index 2018ba3..2cdc340 100644
--- a/patches/dwm-muhgaps-6.2.diff
+++ b/patches/dwm-muhgaps-6.2.diff
@@ -1,47 +1,112 @@
---- dwm/dwm.c.orig	2015-11-22 13:26:16.664650238 -0700
-+++ dwm/dwm.c	2015-11-22 13:25:57.407984351 -0700
-@@ -52,8 +52,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_text(drw, 0, 0, 0, 0, (X), 0) + drw->fonts[0]->h)
- 
-@@ -1293,12 +1293,36 @@ void
- resizeclient(Client *c, int x, int y, int w, int h)
+From 20967685d6879bd611a856ade154df19da9ddc7b Mon Sep 17 00:00:00 2001
+From: Stein Gunnar Bakkeby <bakkeby@gmail.com>
+Date: Wed, 8 May 2019 08:07:14 +0200
+Subject: [PATCH] Vanity gaps - allows control of both inner and outer gaps
+ between windows and screen edge
+
+---
+ config.def.h |  21 +++++++++
+ dwm.c        | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
+ 2 files changed, 161 insertions(+), 10 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..0927c2d 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -3,6 +3,11 @@
+ /* appearance */
+ static const unsigned int borderpx  = 1;        /* border pixel of windows */
+ static const unsigned int snap      = 32;       /* snap pixel */
++static const unsigned int gappx    = 10;        /* gap between windows */
+ static const int showbar            = 1;        /* 0 means no bar */
+ static const int topbar             = 1;        /* 0 means bottom bar */
+ static const char *fonts[]          = { "monospace:size=10" };
+@@ -70,6 +75,22 @@ static Key keys[] = {
+ 	{ MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
+ 	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
+ 	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
+ 	{ MODKEY,                       XK_Return, zoom,           {0} },
+ 	{ MODKEY,                       XK_Tab,    view,           {0} },
+ 	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
+diff --git a/dwm.c b/dwm.c
+index 4465af1..88f3e04 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -119,6 +119,10 @@ struct Monitor {
+ 	int by;               /* bar geometry */
+ 	int mx, my, mw, mh;   /* screen size */
+ 	int wx, wy, ww, wh;   /* window area  */
++ int gappx;            /* gap between windows */
+ 	unsigned int seltags;
+ 	unsigned int sellt;
+ 	unsigned int tagset[2];
+@@ -199,6 +203,16 @@ static void sendmon(Client *c, Monitor *m);
+ static void setclientstate(Client *c, long state);
+ static void setfocus(Client *c);
+ static void setfullscreen(Client *c, int fullscreen);
+ static void setlayout(const Arg *arg);
+ static void setmfact(const Arg *arg);
+ static void setup(void);
+@@ -240,6 +254,7 @@ static char stext[256];
+ static int screen;
+ static int sw, sh;           /* X display screen geometry width, height */
+ static int bh, blw = 0;      /* bar geometry */
+ static int lrpad;            /* sum of left and right padding for text */
+ static int (*xerrorxlib)(Display *, XErrorEvent *);
+ static unsigned int numlockmask = 0;
+@@ -638,6 +653,10 @@ 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);
+@@ -1498,6 +1517,111 @@ setfullscreen(Client *c, int fullscreen)
+ }
+
+ void
+ setlayout(const Arg *arg)
+ {
+ 	if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
+@@ -1673,26 +1797,32 @@ tagmon(const Arg *arg)
+ void
+ tile(Monitor *m)
  {
- 	XWindowChanges wc;
-+	unsigned int n;
-+	unsigned int gapoffset;
-+	unsigned int gapincr;
-+	Client *nbc;
+-	unsigned int i, n, h, mw, my, ty;
++	unsigned int i, n, h, r, mw, my, ty;
+ 	Client *c;
  
--	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++);
+ 	for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ 	if (n == 0)
+ 		return;
 +
-+	/* Do nothing if layout is floating */
-+	if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) {
-+		gapincr = gapoffset = 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);
+ 	if (n > m->nmaster)
+-		mw = m->nmaster ? m->ww * m->mfact : 0;
++		mw = m->nmaster ? (m->ww + m->gappx) * m->mfact : 0;
+ 	else
+-		mw = m->ww;
+-	for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
++		mw = m->ww - 2*m->gappx + 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);
+-			resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
+-			my += HEIGHT(c);
++			r = MIN(n, m->nmaster) - i;
++			h = (m->wh - my - m->gappoh - m->gappx * (r - 1)) / r;
++			resize(c, m->wx + m->gappov, 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);
++			r = n - i;
++			h = (m->wh - ty - m->gappx - m->gappx * (r - 1)) / r;
++			resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
++			ty += HEIGHT(c) + m->gappx;
+ 		}
+ }
+ 
+-- 
+2.7.4