From ab002204c8bb7c8c36828aeb89ef3cf9b0447ea6 Mon Sep 17 00:00:00 2001
From: Ben Collerson <benc@benc.cc>
Date: Fri, 29 Dec 2023 19:02:11 +1000
Subject: [PATCH] titleurgent

---
 config.def.h | 8 +++++---
 dwl.c        | 8 ++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/config.def.h b/config.def.h
index a784eb4f..a5000901 100644
--- a/config.def.h
+++ b/config.def.h
@@ -21,10 +21,12 @@ static const float fullscreen_bg[]         = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
 static int log_level = WLR_ERROR;
 
 static const Rule rules[] = {
-	/* app_id             title       tags mask     isfloating   monitor */
+	/* app_id             title       tags mask     isfloating   titleurgent   monitor */
 	/* examples: */
-	{ "Gimp_EXAMPLE",     NULL,       0,            1,           -1 }, /* Start on currently visible tags floating, not tiled */
-	{ "firefox_EXAMPLE",  NULL,       1 << 8,       0,           -1 }, /* Start on ONLY tag "9" */
+	{ "Gimp_EXAMPLE",     NULL,       0,            1,           0,            -1 }, /* Start on currently visible tags floating, not tiled */
+	{ "firefox_EXAMPLE",  NULL,       1 << 8,       0,           0,            -1 }, /* Start on ONLY tag "9" */
+	{ "org.qutebrowser.qutebrowser_EXAMPLE",
+	                      NULL,       0,            0,           1,            -1 },
 };
 
 /* layout(s) */
diff --git a/dwl.c b/dwl.c
index 6f041a0d..9486c435 100644
--- a/dwl.c
+++ b/dwl.c
@@ -138,6 +138,7 @@ typedef struct {
 	unsigned int bw;
 	uint32_t tags;
 	int isfloating, isurgent, isfullscreen;
+	int titleurgent;
 	uint32_t resize; /* configure serial of a pending resize */
 } Client;
 
@@ -228,6 +229,7 @@ typedef struct {
 	const char *title;
 	uint32_t tags;
 	int isfloating;
+	int titleurgent;
 	int monitor;
 } Rule;
 
@@ -455,6 +457,7 @@ applyrules(Client *c)
 	Monitor *mon = selmon, *m;
 
 	c->isfloating = client_is_float_type(c);
+	c->titleurgent = 0;
 	if (!(appid = client_get_appid(c)))
 		appid = broken;
 	if (!(title = client_get_title(c)))
@@ -464,6 +467,7 @@ applyrules(Client *c)
 		if ((!r->title || strstr(title, r->title))
 				&& (!r->id || strstr(appid, r->id))) {
 			c->isfloating = r->isfloating;
+			c->titleurgent = r->titleurgent;
 			newtags |= r->tags;
 			i = 0;
 			wl_list_for_each(m, &mons, link) {
@@ -2821,6 +2825,10 @@ updatetitle(struct wl_listener *listener, void *data)
 	Client *c = wl_container_of(listener, c, set_title);
 	if (c == focustop(c->mon))
 		printstatus();
+	else if (c->titleurgent) {
+		c->isurgent = 1;
+		printstatus();
+	}
 }
 
 void
-- 
2.45.1

