ipc: send a workspace event when the urgency flag changes

This commit is contained in:
Michael Stapelberg 2010-03-20 03:09:42 +01:00
parent 35a791f7e6
commit 77efb29d9f
2 changed files with 9 additions and 4 deletions

View File

@ -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:*
---------------------

View File

@ -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\"}");
}
/*