diff --git a/dwm.c b/dwm.c index 96317ad..c125d02 100644 --- a/dwm.c +++ b/dwm.c @@ -166,6 +166,7 @@ static void configure(Client *c); static void configurenotify(XEvent *e); static void configurerequest(XEvent *e); static Monitor *createmon(void); +static int desiredbw(Client *c); static void destroynotify(XEvent *e); static void detach(Client *c); static void detachstack(Client *c); @@ -444,7 +445,17 @@ arrange(Monitor *m) void arrangemon(Monitor *m) { + Client *c; + strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol); + /* border width depends on the layout (0 in monocle, borderpx otherwise), + * so apply it here on every layout change instead of on focus change */ + for (c = m->clients; c; c = c->next) { + if (!ISVISIBLE(c) || c->isfullscreen || c->bw == desiredbw(c)) + continue; + c->bw = desiredbw(c); + resizeclient(c, c->x, c->y, c->w, c->h); + } if (m->lt[m->sellt]->arrange) m->lt[m->sellt]->arrange(m); } @@ -733,6 +744,15 @@ createmon(void) return m; } +int +desiredbw(Client *c) +{ + /* no border when the layout hides everything else anyway */ + if (!c->isfloating && c->mon->lt[c->mon->sellt]->arrange == monocle) + return 0; + return borderpx; +} + void destroynotify(XEvent *e) {