From 887fde65a3010905aa10f373cfcfe540cfc1781e Mon Sep 17 00:00:00 2001
From: Leonardo Hernández Hernández <leohdz172@proton.me>
Date: Mon, 9 Oct 2023 22:16:52 -0600
Subject: only set border color for urgent *and* mapped X11 clients

this fixes a segfault when the client emits .set_hints but it's not mapped

Fixes: 72a7d78a1a7926a207539eb50f44b2e1eb089d49
---
 dwl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'dwl.c')

diff --git a/dwl.c b/dwl.c
index e07560e..edc7337 100644
--- a/dwl.c
+++ b/dwl.c
@@ -2756,8 +2756,11 @@ sethints(struct wl_listener *listener, void *data)
 	if (c == focustop(selmon))
 		return;
 
-	client_set_border_color(c, urgentcolor);
 	c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
+
+	if (c->isurgent && client_is_mapped(c))
+		client_set_border_color(c, urgentcolor);
+
 	printstatus();
 }
 
-- 
cgit v1.2.3