From 7d67b77a96260aa07d47a6d7ef414be1daa414b4 Mon Sep 17 00:00:00 2001
From: Stivvo <stivvo01@gmail.com>
Date: Fri, 30 Oct 2020 16:21:00 +0100
Subject: Cleaner if statement

---
 dwl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'dwl.c')

diff --git a/dwl.c b/dwl.c
index 9e8c527..8035cc0 100644
--- a/dwl.c
+++ b/dwl.c
@@ -709,10 +709,9 @@ closemon(Monitor *m)
 
 	wl_list_for_each(newmon, &mons, link) {
 		wl_list_for_each(c, &clients, link) {
-			if (c->isfloating && c->geom.x > m->m.width) {
+			if (c->isfloating && c->geom.x > m->m.width)
 				resize(c, c->geom.x - m->w.width, c->geom.y,
-						c->geom.width, c->geom.height, 0);
-			}
+					c->geom.width, c->geom.height, 0);
 			if (c->mon == m)
 				setmon(c, newmon, c->tags);
 		}
-- 
cgit v1.2.3


From 618972696de9499fa38b613a47799cf46b2b0135 Mon Sep 17 00:00:00 2001
From: Stivvo <stivvo01@gmail.com>
Date: Fri, 30 Oct 2020 19:52:20 +0100
Subject: Fix crash when unplugging a focused monitor

Just focus a "safe" monitor before trying to to anything risky
---
 dwl.c | 1 +
 1 file changed, 1 insertion(+)

(limited to 'dwl.c')

diff --git a/dwl.c b/dwl.c
index 8035cc0..461dd7b 100644
--- a/dwl.c
+++ b/dwl.c
@@ -707,6 +707,7 @@ closemon(Monitor *m)
 	Monitor *newmon;
 	Client *c;
 
+	focusclient(selclient(), focustop(dirtomon(-1)), 1);
 	wl_list_for_each(newmon, &mons, link) {
 		wl_list_for_each(c, &clients, link) {
 			if (c->isfloating && c->geom.x > m->m.width)
-- 
cgit v1.2.3