From 77efb29d9fff8ed1dbb3bf213910ab4118c32b5b Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 20 Mar 2010 03:09:42 +0100 Subject: [PATCH] ipc: send a workspace event when the urgency flag changes --- docs/ipc | 2 +- src/workspace.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/ipc b/docs/ipc index 5d70d7fe..117050a3 100644 --- a/docs/ipc +++ b/docs/ipc @@ -268,7 +268,7 @@ output:: This event consists of a single serialized map containing a property +change (string)+ which indicates the type of the change ("focus", "init", -"empty"). +"empty", "urgent"). *Example:* --------------------- diff --git a/src/workspace.c b/src/workspace.c index 8d762729..67874f29 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -425,16 +425,21 @@ void workspace_unmap_clients(xcb_connection_t *conn, Workspace *u_ws) { */ void workspace_update_urgent_flag(Workspace *ws) { Client *current; + bool old_flag = ws->urgent; + bool urgent = false; SLIST_FOREACH(current, &(ws->focus_stack), focus_clients) { if (!current->urgent) continue; - ws->urgent = true; - return; + urgent = true; + break; } - ws->urgent = false; + ws->urgent = urgent; + + if (old_flag != urgent) + ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"urgent\"}"); } /* -- 2.39.5