commit f50b07a3ea4ccb2a6cdd057e4454993f2e94f854
parent 8f61b230f9633db38b071b30a3e8c806313d7ce3
Author: jeromenerf <jerome.andrieux@gmail.com>
Date: Sat, 15 Aug 2015 18:57:17 +0200
Uselessgap patch update:
- supports 6.1 nmaster
- doc updated to reflect monocle and single window "no border mode"
- patch uploaded
Diffstat:
2 files changed, 105 insertions(+), 25 deletions(-)
diff --git a/dwm.suckless.org/patches/dwm-6.1-uselessgap.diff b/dwm.suckless.org/patches/dwm-6.1-uselessgap.diff
@@ -0,0 +1,60 @@
+commit 6d7963f16af5ce9e14deab86efb3a68a5c420268
+Author: jeromenerf <jerome.andrieux@gmail.com>
+Date: Sat Aug 15 18:35:11 2015 +0200
+
+ Useless gap for 6.1
+
+diff --git a/dwm.c b/dwm.c
+index c9fdd49..783fcdb 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -53,8 +53,8 @@
+ #define ISVISIBLE(C) ISVISIBLEONTAG(C, 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)
+
+@@ -1316,12 +1317,34 @@ resize(Client *c, int x, int y, int w, int h, Bool interact) {
+ 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);
diff --git a/dwm.suckless.org/patches/uselessgap.md b/dwm.suckless.org/patches/uselessgap.md
@@ -2,37 +2,57 @@
## Description
-This patch adds useless gap between windows and removes everything (gap and border) in monocle mode for aesthetic purpose.
-The size of the gap is configured in config.def.h.
+For aesthetic purposes, this patch:
+
+- adds "useless gaps" around windows
+- removes everything (gaps and borders) when in monocle mode for aesthetic purpose.
+
+The size of the gap is configured in `config.h`:
+
+```
+static const unsigned int gappx = 6; /* gap pixel between windows */
+```
## Example
- Original look :
- +-----------------+-------+
- | | |
- | | |
- | | |
- | +-------|
- | | |
- | | |
- | | |
- +-----------------+-------+
-
-
- New look :
- +----------------++-------+
- | || |
- | || N |
- | || |
- | |+-------+
- | |+-------+
- | || |
- | || |
- | || |
- +----------------++-------+
+No gaps:
+
+```
++-----------------+-------+
+| | |
+| | |
+| | |
+| +-------|
+| | |
+| | |
+| | |
++-----------------+-------+
+```
+
+With gaps around windows:
+
+```
++---------------------------+
+|+----------------++-------+|
+|| || ||
+|| || ||
+|| || ||
+|| |+-------+|
+|| |+-------+|
+|| || ||
+|| || ||
+|| || ||
+|+----------------++-------+|
++---------------------------+
+```
+
+NB: there are some alternatives in the patches section, adding gaps between
+windows, but not between windows and the screen borders, only in the default
+tile mode...
## Download
+ * [dwm-6.1-uselessgap.diff](dwm-6.1-uselessgap.diff) (4K) (20150815), now supports nmaster.
* [dwm-5.9-uselessgap.diff](dwm-5.9-uselessgap.diff) (1.8k) (20110107 updated. Thanks Jordan for your bug report)
Update to use the new resizeclient() function instead of resize()