From c9065974a21579061b699e6eedc44239289b58de Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 22 Sep 2020 15:07:01 +0200 Subject: [PATCH] dwm_no_border_for_unselected_clients --- dwm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dwm.c b/dwm.c index 664c527..1c6ddfc 100644 --- a/dwm.c +++ b/dwm.c @@ -803,6 +803,8 @@ focus(Client *c) XDeleteProperty(dpy, root, netatom[NetActiveWindow]); } selmon->sel = c; + if (selmon->sel) + resizeclient(c, c->x, c->y, c->w, c->h); drawbars(); } @@ -1282,7 +1284,13 @@ 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 == selmon->sel) + wc.border_width = c->bw; + else { + wc.border_width = 0; + wc.x += c->bw; + wc.y += c->bw; + } XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); configure(c); XSync(dpy, False); @@ -1618,7 +1626,10 @@ showhide(Client *c) return; if (ISVISIBLE(c)) { /* show clients top down */ - XMoveWindow(dpy, c->win, c->x, c->y); + if (selmon->sel == c) + XMoveWindow(dpy, c->win, c->x, c->y); + else + XMoveWindow(dpy, c->win, c->x + borderpx, c->y + borderpx); if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) resize(c, c->x, c->y, c->w, c->h, 0); showhide(c->snext); @@ -1760,6 +1771,9 @@ unfocus(Client *c, int setfocus) XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XDeleteProperty(dpy, root, netatom[NetActiveWindow]); } + if (c == selmon->sel) + selmon->sel = NULL; + resizeclient(c, c->x, c->y, c->w, c->h); } void -- 2.32.0