summaryrefslogtreecommitdiff
path: root/suckless/dwm/patches
diff options
context:
space:
mode:
Diffstat (limited to 'suckless/dwm/patches')
-rw-r--r--suckless/dwm/patches/dwm-floatrules-20210801-138b405.diff71
-rw-r--r--suckless/dwm/patches/dwm-movekeyboard-6.4.diff136
-rw-r--r--suckless/dwm/patches/dwm-scratchpad-20221102-ba56fe9.diff92
-rw-r--r--suckless/dwm/patches/dwm-statuscmd-20210405-67d76bd.diff208
-rw-r--r--suckless/dwm/patches/dwm-uselessgap-20211119-58414bee958f2.diff101
5 files changed, 608 insertions, 0 deletions
diff --git a/suckless/dwm/patches/dwm-floatrules-20210801-138b405.diff b/suckless/dwm/patches/dwm-floatrules-20210801-138b405.diff
new file mode 100644
index 0000000..2bf943f
--- /dev/null
+++ b/suckless/dwm/patches/dwm-floatrules-20210801-138b405.diff
@@ -0,0 +1,71 @@
+diff --git a/config.def.h b/config.def.h
+index a2ac963..e8c0978 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -26,9 +26,9 @@ static const Rule rules[] = {
+ * WM_CLASS(STRING) = instance, class
+ * WM_NAME(STRING) = title
+ */
+- /* class instance title tags mask isfloating monitor */
+- { "Gimp", NULL, NULL, 0, 1, -1 },
+- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
++ /* class instance title tags mask isfloating monitor float x,y,w,h floatborderpx*/
++ { "Gimp", NULL, NULL, 0, 1, -1, 50,50,500,500, 5 },
++ { "Firefox", NULL, NULL, 1 << 8, 0, -1, 50,50,500,500, 5 },
+ };
+
+ /* layout(s) */
+diff --git a/dwm.c b/dwm.c
+index 5e4d494..a03ca15 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -93,6 +93,8 @@ struct Client {
+ int bw, oldbw;
+ unsigned int tags;
+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
++ int floatborderpx;
++ int hasfloatbw;
+ Client *next;
+ Client *snext;
+ Monitor *mon;
+@@ -139,6 +141,8 @@ typedef struct {
+ unsigned int tags;
+ int isfloating;
+ int monitor;
++ int floatx, floaty, floatw, floath;
++ int floatborderpx;
+ } Rule;
+
+ /* function declarations */
+@@ -300,6 +304,16 @@ applyrules(Client *c)
+ {
+ c->isfloating = r->isfloating;
+ c->tags |= r->tags;
++ if (r->floatborderpx >= 0) {
++ c->floatborderpx = r->floatborderpx;
++ c->hasfloatbw = 1;
++ }
++ if (r->isfloating) {
++ if (r->floatx >= 0) c->x = c->mon->mx + r->floatx;
++ if (r->floaty >= 0) c->y = c->mon->my + r->floaty;
++ if (r->floatw >= 0) c->w = r->floatw;
++ if (r->floath >= 0) c->h = r->floath;
++ }
+ for (m = mons; m && m->num != r->monitor; m = m->next);
+ if (m)
+ c->mon = m;
+@@ -1282,7 +1296,10 @@ resizeclient(Client *c, int x, int y, int w, int h)
+ 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;
++ if (c->isfloating && c->hasfloatbw && !c->isfullscreen)
++ wc.border_width = c->floatborderpx;
++ else
++ wc.border_width = c->bw;
+ XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+ configure(c);
+ XSync(dpy, False);
+--
+2.32.0
+
diff --git a/suckless/dwm/patches/dwm-movekeyboard-6.4.diff b/suckless/dwm/patches/dwm-movekeyboard-6.4.diff
new file mode 100644
index 0000000..677ed45
--- /dev/null
+++ b/suckless/dwm/patches/dwm-movekeyboard-6.4.diff
@@ -0,0 +1,136 @@
+From daf4eab44e319d78cffecf4133f8309c826fe6b9 Mon Sep 17 00:00:00 2001
+From: mrmine <mrmine1@proton.me>
+Date: Sun, 11 Dec 2022 23:31:46 +0100
+Subject: [PATCH] This Patch adds the ability to move floating windows on the x
+ and y axis with the keyboard, instead of only the mouse. This is achieved by
+ adding the two functions "movekeyboard-x" and "movekeyboard-y".
+
+---
+ config.def.h | 4 +++
+ dwm.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 92 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..a1ca89c 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -85,6 +85,10 @@ static const Key keys[] = {
+ { MODKEY, XK_period, focusmon, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
+ { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
++ { MODKEY|ControlMask, XK_l, movekeyboard_x, {.i = 20}},
++ { MODKEY|ControlMask, XK_h, movekeyboard_x, {.i = -20}},
++ { MODKEY|ControlMask, XK_j, movekeyboard_y, {.i = 20}},
++ { MODKEY|ControlMask, XK_k, movekeyboard_y, {.i = -20}},
+ TAGKEYS( XK_1, 0)
+ TAGKEYS( XK_2, 1)
+ TAGKEYS( XK_3, 2)
+diff --git a/dwm.c b/dwm.c
+index 03baf42..e8a9f28 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -184,6 +184,8 @@ static void maprequest(XEvent *e);
+ static void monocle(Monitor *m);
+ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
++static void movekeyboard_x(const Arg *arg);
++static void movekeyboard_y(const Arg *arg);
+ static Client *nexttiled(Client *c);
+ static void pop(Client *c);
+ static void propertynotify(XEvent *e);
+@@ -1203,6 +1205,92 @@ movemouse(const Arg *arg)
+ }
+ }
+
++void
++movekeyboard_x(const Arg *arg){
++ int ocx, ocy, nx, ny;
++ Client *c;
++ Monitor *m;
++
++ if (!(c = selmon->sel))
++ return;
++
++ if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
++ return;
++
++ restack(selmon);
++
++ ocx = c->x;
++ ocy = c->y;
++
++ nx = ocx + arg->i;
++ ny = ocy;
++
++ if (abs(selmon->wx - nx) < snap)
++ nx = selmon->wx;
++ else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
++ nx = selmon->wx + selmon->ww - WIDTH(c);
++
++ if (abs(selmon->wy - ny) < snap)
++ ny = selmon->wy;
++ else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
++ ny = selmon->wy + selmon->wh - HEIGHT(c);
++
++ if (!c->isfloating)
++ togglefloating(NULL);
++
++ if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
++ resize(c, nx, ny, c->w, c->h, 1);
++
++ if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
++ sendmon(c, m);
++ selmon = m;
++ focus(NULL);
++ }
++}
++
++void
++movekeyboard_y(const Arg *arg){
++ int ocx, ocy, nx, ny;
++ Client *c;
++ Monitor *m;
++
++ if (!(c = selmon->sel))
++ return;
++
++ if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
++ return;
++
++ restack(selmon);
++
++ ocx = c->x;
++ ocy = c->y;
++
++ nx = ocx;
++ ny = ocy + arg->i;
++
++ if (abs(selmon->wx - nx) < snap)
++ nx = selmon->wx;
++ else if (abs((selmon->wx + selmon->ww) - (nx + WIDTH(c))) < snap)
++ nx = selmon->wx + selmon->ww - WIDTH(c);
++
++ if (abs(selmon->wy - ny) < snap)
++ ny = selmon->wy;
++ else if (abs((selmon->wy + selmon->wh) - (ny + HEIGHT(c))) < snap)
++ ny = selmon->wy + selmon->wh - HEIGHT(c);
++
++ if (!c->isfloating)
++ togglefloating(NULL);
++
++ if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
++ resize(c, nx, ny, c->w, c->h, 1);
++
++ if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
++ sendmon(c, m);
++ selmon = m;
++ focus(NULL);
++ }
++}
++
+ Client *
+ nexttiled(Client *c)
+ {
+--
+2.38.1
+
diff --git a/suckless/dwm/patches/dwm-scratchpad-20221102-ba56fe9.diff b/suckless/dwm/patches/dwm-scratchpad-20221102-ba56fe9.diff
new file mode 100644
index 0000000..804e112
--- /dev/null
+++ b/suckless/dwm/patches/dwm-scratchpad-20221102-ba56fe9.diff
@@ -0,0 +1,92 @@
+diff --git a/config.def.h b/config.def.h
+index 9efa774..0b8b310 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -59,11 +59,14 @@ static const Layout layouts[] = {
+ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
+ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
+ static const char *termcmd[] = { "st", NULL };
++static const char scratchpadname[] = "scratchpad";
++static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
+
+ static const Key keys[] = {
+ /* modifier key function argument */
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
++ { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } },
+ { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+diff --git a/dwm.c b/dwm.c
+index 253aba7..4abf8d3 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -212,6 +212,7 @@ static void tagmon(const Arg *arg);
+ static void tile(Monitor *m);
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
++static void togglescratch(const Arg *arg);
+ static void toggletag(const Arg *arg);
+ static void toggleview(const Arg *arg);
+ static void unfocus(Client *c, int setfocus);
+@@ -272,6 +273,8 @@ static Window root, wmcheckwin;
+ /* configuration, allows nested code to access above variables */
+ #include "config.h"
+
++static unsigned int scratchtag = 1 << LENGTH(tags);
++
+ /* compile-time check if all tags fit into an unsigned int bit array. */
+ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
+
+@@ -1052,6 +1055,14 @@ manage(Window w, XWindowAttributes *wa)
+ c->y = MAX(c->y, c->mon->wy);
+ c->bw = borderpx;
+
++ selmon->tagset[selmon->seltags] &= ~scratchtag;
++ if (!strcmp(c->name, scratchpadname)) {
++ c->mon->tagset[c->mon->seltags] |= c->tags = scratchtag;
++ c->isfloating = True;
++ c->x = c->mon->wx + (c->mon->ww / 2 - WIDTH(c) / 2);
++ c->y = c->mon->wy + (c->mon->wh / 2 - HEIGHT(c) / 2);
++ }
++
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, w, CWBorderWidth, &wc);
+ XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel);
+@@ -1641,6 +1652,7 @@ spawn(const Arg *arg)
+ {
+ if (arg->v == dmenucmd)
+ dmenumon[0] = '0' + selmon->num;
++ selmon->tagset[selmon->seltags] &= ~scratchtag;
+ if (fork() == 0) {
+ if (dpy)
+ close(ConnectionNumber(dpy));
+@@ -1719,6 +1731,28 @@ togglefloating(const Arg *arg)
+ arrange(selmon);
+ }
+
++void
++togglescratch(const Arg *arg)
++{
++ Client *c;
++ unsigned int found = 0;
++
++ for (c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
++ if (found) {
++ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
++ if (newtagset) {
++ selmon->tagset[selmon->seltags] = newtagset;
++ focus(NULL);
++ arrange(selmon);
++ }
++ if (ISVISIBLE(c)) {
++ focus(c);
++ restack(selmon);
++ }
++ } else
++ spawn(arg);
++}
++
+ void
+ toggletag(const Arg *arg)
+ {
diff --git a/suckless/dwm/patches/dwm-statuscmd-20210405-67d76bd.diff b/suckless/dwm/patches/dwm-statuscmd-20210405-67d76bd.diff
new file mode 100644
index 0000000..4b26420
--- /dev/null
+++ b/suckless/dwm/patches/dwm-statuscmd-20210405-67d76bd.diff
@@ -0,0 +1,208 @@
+From f58c7e4fd05ec13383518ccd51663167d45e92d0 Mon Sep 17 00:00:00 2001
+From: Daniel Bylinka <daniel.bylinka@gmail.com>
+Date: Fri, 2 Apr 2021 19:02:58 +0200
+Subject: [PATCH] [statuscmd] Signal mouse button and click location to status
+ monitor
+
+---
+ config.def.h | 6 +++-
+ dwm.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++---
+ 2 files changed, 100 insertions(+), 6 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 1c0b587..154a59b 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -54,6 +54,8 @@ static const Layout layouts[] = {
+ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
+ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
+
++#define STATUSBAR "dwmblocks"
++
+ /* commands */
+ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
+ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
+@@ -103,7 +105,9 @@ static Button buttons[] = {
+ { ClkLtSymbol, 0, Button1, setlayout, {0} },
+ { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
+ { ClkWinTitle, 0, Button2, zoom, {0} },
+- { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
++ { ClkStatusText, 0, Button1, sigstatusbar, {.i = 1} },
++ { ClkStatusText, 0, Button2, sigstatusbar, {.i = 2} },
++ { ClkStatusText, 0, Button3, sigstatusbar, {.i = 3} },
+ { ClkClientWin, MODKEY, Button1, movemouse, {0} },
+ { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
+ { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
+diff --git a/dwm.c b/dwm.c
+index b0b3466..d871457 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -172,6 +172,7 @@ static void focusstack(const Arg *arg);
+ static Atom getatomprop(Client *c, Atom prop);
+ static int getrootptr(int *x, int *y);
+ static long getstate(Window w);
++static pid_t getstatusbarpid();
+ static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
+ static void grabbuttons(Client *c, int focused);
+ static void grabkeys(void);
+@@ -206,6 +207,7 @@ static void setup(void);
+ static void seturgent(Client *c, int urg);
+ static void showhide(Client *c);
+ static void sigchld(int unused);
++static void sigstatusbar(const Arg *arg);
+ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+@@ -238,6 +240,9 @@ static void zoom(const Arg *arg);
+ /* variables */
+ static const char broken[] = "broken";
+ static char stext[256];
++static int statusw;
++static int statussig;
++static pid_t statuspid = -1;
+ static int screen;
+ static int sw, sh; /* X display screen geometry width, height */
+ static int bh, blw = 0; /* bar geometry */
+@@ -422,6 +427,7 @@ buttonpress(XEvent *e)
+ Client *c;
+ Monitor *m;
+ XButtonPressedEvent *ev = &e->xbutton;
++ char *text, *s, ch;
+
+ click = ClkRootWin;
+ /* focus monitor if necessary */
+@@ -440,9 +446,23 @@ buttonpress(XEvent *e)
+ arg.ui = 1 << i;
+ } else if (ev->x < x + blw)
+ click = ClkLtSymbol;
+- else if (ev->x > selmon->ww - (int)TEXTW(stext))
++ else if (ev->x > selmon->ww - statusw) {
++ x = selmon->ww - statusw;
+ click = ClkStatusText;
+- else
++ statussig = 0;
++ for (text = s = stext; *s && x <= ev->x; s++) {
++ if ((unsigned char)(*s) < ' ') {
++ ch = *s;
++ *s = '\0';
++ x += TEXTW(text) - lrpad;
++ *s = ch;
++ text = s + 1;
++ if (x >= ev->x)
++ break;
++ statussig = ch;
++ }
++ }
++ } else
+ click = ClkWinTitle;
+ } else if ((c = wintoclient(ev->window))) {
+ focus(c);
+@@ -704,9 +724,24 @@ drawbar(Monitor *m)
+
+ /* draw status first so it can be overdrawn by tags later */
+ if (m == selmon) { /* status is only drawn on selected monitor */
++ char *text, *s, ch;
+ drw_setscheme(drw, scheme[SchemeNorm]);
+- tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
+- drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
++
++ x = 0;
++ for (text = s = stext; *s; s++) {
++ if ((unsigned char)(*s) < ' ') {
++ ch = *s;
++ *s = '\0';
++ tw = TEXTW(text) - lrpad;
++ drw_text(drw, m->ww - statusw + x, 0, tw, bh, 0, text, 0);
++ x += tw;
++ *s = ch;
++ text = s + 1;
++ }
++ }
++ tw = TEXTW(text) - lrpad + 2;
++ drw_text(drw, m->ww - statusw + x, 0, tw, bh, 0, text, 0);
++ tw = statusw;
+ }
+
+ for (c = m->clients; c; c = c->next) {
+@@ -872,6 +907,30 @@ getatomprop(Client *c, Atom prop)
+ return atom;
+ }
+
++pid_t
++getstatusbarpid()
++{
++ char buf[32], *str = buf, *c;
++ FILE *fp;
++
++ if (statuspid > 0) {
++ snprintf(buf, sizeof(buf), "/proc/%u/cmdline", statuspid);
++ if ((fp = fopen(buf, "r"))) {
++ fgets(buf, sizeof(buf), fp);
++ while ((c = strchr(str, '/')))
++ str = c + 1;
++ fclose(fp);
++ if (!strcmp(str, STATUSBAR))
++ return statuspid;
++ }
++ }
++ if (!(fp = popen("pidof -s "STATUSBAR, "r")))
++ return -1;
++ fgets(buf, sizeof(buf), fp);
++ pclose(fp);
++ return strtol(buf, NULL, 10);
++}
++
+ int
+ getrootptr(int *x, int *y)
+ {
+@@ -1637,6 +1696,20 @@ sigchld(int unused)
+ while (0 < waitpid(-1, NULL, WNOHANG));
+ }
+
++void
++sigstatusbar(const Arg *arg)
++{
++ union sigval sv;
++
++ if (!statussig)
++ return;
++ sv.sival_int = arg->i;
++ if ((statuspid = getstatusbarpid()) <= 0)
++ return;
++
++ sigqueue(statuspid, SIGRTMIN+statussig, sv);
++}
++
+ void
+ spawn(const Arg *arg)
+ {
+@@ -1990,8 +2063,25 @@ updatesizehints(Client *c)
+ void
+ updatestatus(void)
+ {
+- if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
++ if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) {
+ strcpy(stext, "dwm-"VERSION);
++ statusw = TEXTW(stext) - lrpad + 2;
++ } else {
++ char *text, *s, ch;
++
++ statusw = 0;
++ for (text = s = stext; *s; s++) {
++ if ((unsigned char)(*s) < ' ') {
++ ch = *s;
++ *s = '\0';
++ statusw += TEXTW(text) - lrpad;
++ *s = ch;
++ text = s + 1;
++ }
++ }
++ statusw += TEXTW(text) - lrpad + 2;
++
++ }
+ drawbar(selmon);
+ }
+
+--
+2.31.0
+
diff --git a/suckless/dwm/patches/dwm-uselessgap-20211119-58414bee958f2.diff b/suckless/dwm/patches/dwm-uselessgap-20211119-58414bee958f2.diff
new file mode 100644
index 0000000..f8a3aec
--- /dev/null
+++ b/suckless/dwm/patches/dwm-uselessgap-20211119-58414bee958f2.diff
@@ -0,0 +1,101 @@
+From 58414bee958f2e7ed91d6fe31f503ec4a406981b Mon Sep 17 00:00:00 2001
+From: cirala <thim@cederlund.de>
+Date: Fri, 19 Nov 2021 18:14:07 +0100
+Subject: [PATCH] Fix for dwm-uselessgap
+Previous versions of the patch doubles the
+gap between the master and slave stacks.
+
+---
+ config.def.h | 3 ++-
+ dwm.c | 38 +++++++++++++++++++++++++++++++-------
+ 2 files changed, 33 insertions(+), 8 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index a2ac963..17a205f 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -2,6 +2,7 @@
+
+ /* appearance */
+ static const unsigned int borderpx = 1; /* border pixel of windows */
++static const unsigned int gappx = 6; /* 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 */
+@@ -34,7 +35,7 @@ static const Rule rules[] = {
+ /* layout(s) */
+ static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+ static const int nmaster = 1; /* number of clients in master area */
+-static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
++static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
+ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
+
+ static const Layout layouts[] = {
+diff --git a/dwm.c b/dwm.c
+index 5e4d494..b626e89 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -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_fontset_getwidth(drw, (X)) + lrpad)
+
+@@ -1277,12 +1277,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 client's monitor */
++ for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++);
++
++ /* Do nothing if layout is floating */
++ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) {
++ gapincr = gapoffset = 0;
++ } else {
++ /* Remove border and gap if layout is monocle or only one client */
++ if (c->mon->lt[c->mon->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);
+@@ -1688,7 +1712,7 @@ tile(Monitor *m)
+ for (i = my = ty = 0, 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);
++ resize(c, m->wx, m->wy + my, mw - (2*c->bw) + (n > 1 ? gappx : 0), h - (2*c->bw), 0);
+ if (my + HEIGHT(c) < m->wh)
+ my += HEIGHT(c);
+ } else {
+--
+2.33.1
+