Add new request::urgent signal

This fix two things:

(1) Clients asking to be urgent while focussed, this have been reported
a few time for urxvt and I usually link a patch that fix this. This may
not be considered a bug by some, but I think it is.

(2) Add the ability to stop noisy clients from setting the urgent state
themselves.
This commit is contained in:
Emmanuel Lepage Vallee 2014-04-16 00:32:44 -04:00 committed by Emmanuel Lepage Vallee
parent 3ab3bb900a
commit d688ebe6cd
5 changed files with 24 additions and 7 deletions

18
ewmh.c
View File

@ -346,12 +346,18 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
}
else if(state == _NET_WM_STATE_DEMANDS_ATTENTION)
{
if(set == _NET_WM_STATE_REMOVE)
client_set_urgent(L, -1, false);
else if(set == _NET_WM_STATE_ADD)
client_set_urgent(L, -1, true);
else if(set == _NET_WM_STATE_TOGGLE)
client_set_urgent(L, -1, !c->urgent);
if(set == _NET_WM_STATE_REMOVE) {
lua_pushboolean(L, false);
luaA_object_emit_signal(L, -2, "request::urgent", 1);
}
else if(set == _NET_WM_STATE_ADD) {
lua_pushboolean(L, true);
luaA_object_emit_signal(L, -2, "request::urgent", 1);
}
else if(set == _NET_WM_STATE_TOGGLE) {
lua_pushboolean(L, !c->urgent);
luaA_object_emit_signal(L, -2, "request::urgent", 1);
}
}
lua_pop(L, 1);

View File

@ -10,6 +10,7 @@ local screen = screen
local ipairs = ipairs
local math = math
local atag = require("awful.tag")
local aclient = require("awful.client")
--- Implements EWMH requests handling.
-- awful.ewmh
@ -158,8 +159,15 @@ function ewmh.tag(c, t)
end
end
function ewmh.urgent(c, urgent)
if c ~= client.focus and not aclient.property.get(c,"ignore_urgent") then
c.urgent = urgent
end
end
client.connect_signal("request::activate", ewmh.activate)
client.connect_signal("request::tag", ewmh.tag)
client.connect_signal("request::urgent", ewmh.urgent)
client.connect_signal("request::maximized_horizontal", maximized_horizontal)
client.connect_signal("request::maximized_vertical", maximized_vertical)
client.connect_signal("request::fullscreen", fullscreen)

1
objects/client.c Normal file → Executable file
View File

@ -2524,6 +2524,7 @@ client_class_setup(lua_State *L)
signal_add(&client_class.signals, "request::maximized_horizontal");
signal_add(&client_class.signals, "request::maximized_vertical");
signal_add(&client_class.signals, "request::tag");
signal_add(&client_class.signals, "request::urgent");
signal_add(&client_class.signals, "tagged");
signal_add(&client_class.signals, "unfocus");
signal_add(&client_class.signals, "unmanage");

View File

@ -198,7 +198,9 @@ property_update_wm_hints(client_t *c, xcb_get_property_cookie_t cookie)
return;
luaA_object_push(L, c);
client_set_urgent(L, -1, xcb_icccm_wm_hints_get_urgency(&wmh));
lua_pushboolean(L, xcb_icccm_wm_hints_get_urgency(&wmh));
luaA_object_emit_signal(L, -2, "request::urgent", 1);
if(wmh.flags & XCB_ICCCM_WM_HINT_INPUT)
c->nofocus = !wmh.input;

0
property.h Normal file → Executable file
View File