commit f53eb24e58e0bdcb2afc3adf6afeec2333073bfe
parent 682c36baeeebdb4888a6170b202bd68a1a967d76
Author: venus brock <venus@brock-v.dev>
Date: Sun, 15 Feb 2026 16:46:32 -0600
[dwm][patches][focusedborder] Added focusedborder patch
This is my first patch for dwm, let me know how I did :)
Diffstat:
3 files changed, 115 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/focusedborder/dwm-focusedborder-6.8.diff b/dwm.suckless.org/patches/focusedborder/dwm-focusedborder-6.8.diff
@@ -0,0 +1,45 @@
+From c8db7977d3d9332ca71987d2e0833a81e4fb2b99 Mon Sep 17 00:00:00 2001
+From: venus brock <venus@brock-v.dev>
+Date: Sun, 15 Feb 2026 16:11:13 -0600
+Subject: [PATCH] only display border on focused window
+
+This patch removes the borders on all unfocused windows, and resizes
+windows to use the space left behind.
+---
+ dwm.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/dwm.c b/dwm.c
+index 53b393e..0ea2e9a 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -800,6 +800,12 @@ focus(Client *c)
+ detachstack(c);
+ attachstack(c);
+ grabbuttons(c, 1);
++ if (!c->bw) {
++ c->bw = borderpx;
++ c->w -= borderpx * 2;
++ c->h -= borderpx * 2;
++ resizeclient(c, c->x, c->y, c->w, c->h);
++ }
+ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
+ setfocus(c);
+ } else {
+@@ -1768,7 +1774,12 @@ unfocus(Client *c, int setfocus)
+ if (!c)
+ return;
+ grabbuttons(c, 0);
+- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
++ if (c->bw) {
++ c->bw = 0;
++ c->w += borderpx * 2;
++ c->h += borderpx * 2;
++ resizeclient(c, c->x, c->y, c->w, c->h);
++ }
+ if (setfocus) {
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+ XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
+--
+2.53.0
+
diff --git a/dwm.suckless.org/patches/focusedborder/dwm-focusedbordernoresize-6.8.diff b/dwm.suckless.org/patches/focusedborder/dwm-focusedbordernoresize-6.8.diff
@@ -0,0 +1,51 @@
+From 913756bfedac67db497656d5bb740b2cc75bc5c9 Mon Sep 17 00:00:00 2001
+From: venus brock <venus@brock-v.dev>
+Date: Sun, 15 Feb 2026 16:05:11 -0600
+Subject: [PATCH] only display border on focused window, with no resizing
+
+This patch removes the borders on all unfocused windows, leaving the
+space which would be taken by the border empty.
+---
+ dwm.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/dwm.c b/dwm.c
+index 53b393e..cf04e21 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -788,6 +788,7 @@ expose(XEvent *e)
+ void
+ focus(Client *c)
+ {
++ Client *prev;
+ if (!c || !ISVISIBLE(c))
+ for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
+ if (selmon->sel && selmon->sel != c)
+@@ -806,7 +807,12 @@ focus(Client *c)
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+ XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
+ }
++ prev = selmon->sel;
+ selmon->sel = c;
++ if (prev)
++ resizeclient(prev, prev->x, prev->y, prev->w, prev->h);
++ if (c)
++ resizeclient(c, c->x, c->y, c->w, c->h);
+ drawbars();
+ }
+
+@@ -1292,6 +1298,11 @@ resizeclient(Client *c, int x, int y, int w, int h)
+ 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 != selmon->sel) {
++ wc.border_width = 0;
++ wc.x += borderpx;
++ wc.y += borderpx;
++ }
+ XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+ configure(c);
+ XSync(dpy, False);
+--
+2.53.0
+
diff --git a/dwm.suckless.org/patches/focusedborder/index.md b/dwm.suckless.org/patches/focusedborder/index.md
@@ -0,0 +1,19 @@
+focusedborder
+=============
+
+Description
+-----------
+This patch removes the window borders from all unfocused clients. This is more
+or less a fixed version of [unfocusednoborders](../unfocusednoborders) which
+does not seem to work as intended based on my testing. The "noresize" version
+does more or less the same thing but does not resize windows when borders are
+added/removed, leaving the space which would be taken by the border wasted.
+
+Download
+--------
+* [dwm-focusedborder-6.8.diff](dwm-focusedborder-6.8.diff) (2026-02-15)
+* [dwm-focusedbordernoresize-6.8.diff](dwm-focusedbordernoresize.diff) (2026-02-15)
+
+Authors
+-------
+* Venus Brock - <venus@brock-v.dev>