sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-focusedbordernoresize-6.8.diff (1442B)


      1 From 913756bfedac67db497656d5bb740b2cc75bc5c9 Mon Sep 17 00:00:00 2001
      2 From: venus brock <venus@brock-v.dev>
      3 Date: Sun, 15 Feb 2026 16:05:11 -0600
      4 Subject: [PATCH] only display border on focused window, with no resizing
      5 
      6 This patch removes the borders on all unfocused windows, leaving the
      7 space which would be taken by the border empty.
      8 ---
      9  dwm.c | 11 +++++++++++
     10  1 file changed, 11 insertions(+)
     11 
     12 diff --git a/dwm.c b/dwm.c
     13 index 53b393e..cf04e21 100644
     14 --- a/dwm.c
     15 +++ b/dwm.c
     16 @@ -788,6 +788,7 @@ expose(XEvent *e)
     17  void
     18  focus(Client *c)
     19  {
     20 +	Client *prev;
     21  	if (!c || !ISVISIBLE(c))
     22  		for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
     23  	if (selmon->sel && selmon->sel != c)
     24 @@ -806,7 +807,12 @@ focus(Client *c)
     25  		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
     26  		XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
     27  	}
     28 +	prev = selmon->sel;
     29  	selmon->sel = c;
     30 +	if (prev)
     31 +		resizeclient(prev, prev->x, prev->y, prev->w, prev->h);
     32 +	if (c)
     33 +		resizeclient(c, c->x, c->y, c->w, c->h);
     34  	drawbars();
     35  }
     36  
     37 @@ -1292,6 +1298,11 @@ resizeclient(Client *c, int x, int y, int w, int h)
     38  	c->oldw = c->w; c->w = wc.width = w;
     39  	c->oldh = c->h; c->h = wc.height = h;
     40  	wc.border_width = c->bw;
     41 +	if (c != selmon->sel) {
     42 +		wc.border_width = 0;
     43 +		wc.x += borderpx;
     44 +		wc.y += borderpx;
     45 +	}
     46  	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
     47  	configure(c);
     48  	XSync(dpy, False);
     49 -- 
     50 2.53.0
     51