Implement the window::urgent event

The window::urgent event is emitted when a container becomes urgent or
loses its urgent status.
This commit is contained in:
Tony Crisci
2014-06-20 08:33:02 -04:00
committed by Michael Stapelberg
parent a9c094b731
commit 682fb0a291
4 changed files with 84 additions and 8 deletions

View File

@ -231,6 +231,7 @@ void con_focus(Con *con) {
con->urgent = false;
con_update_parents_urgency(con);
workspace_update_urgent_flag(con_get_workspace(con));
ipc_send_window_event("urgent", con);
}
}
@ -1599,14 +1600,16 @@ void con_set_urgency(Con *con, bool urgent) {
con_update_parents_urgency(con);
if (con->urgent == urgent)
LOG("Urgency flag changed to %d\n", con->urgent);
Con *ws;
/* Set the urgency flag on the workspace, if a workspace could be found
* (for dock clients, that is not the case). */
if ((ws = con_get_workspace(con)) != NULL)
workspace_update_urgent_flag(ws);
if (con->urgent == urgent) {
LOG("Urgency flag changed to %d\n", con->urgent);
ipc_send_window_event("urgent", con);
}
}
/*

View File

@ -320,11 +320,14 @@ static void workspace_reassign_sticky(Con *con) {
static void workspace_defer_update_urgent_hint_cb(EV_P_ ev_timer *w, int revents) {
Con *con = w->data;
DLOG("Resetting urgency flag of con %p by timer\n", con);
con->urgent = false;
con_update_parents_urgency(con);
workspace_update_urgent_flag(con_get_workspace(con));
tree_render();
if (con->urgent) {
DLOG("Resetting urgency flag of con %p by timer\n", con);
con->urgent = false;
con_update_parents_urgency(con);
workspace_update_urgent_flag(con_get_workspace(con));
ipc_send_window_event("urgent", con);
tree_render();
}
ev_timer_stop(main_loop, con->urgency_timer);
FREE(con->urgency_timer);
@ -380,6 +383,7 @@ static void _workspace_show(Con *workspace) {
* focus and thereby immediately destroy it */
if (next->urgent && (int)(config.workspace_urgency_timer * 1000) > 0) {
/* focus for now… */
next->urgent = false;
con_focus(next);
/* … but immediately reset urgency flags; they will be set to false by