diff --git a/lib/awful/client.lua b/lib/awful/client.lua index 9da7b44c6..d713d2ee1 100644 --- a/lib/awful/client.lua +++ b/lib/awful/client.lua @@ -1485,6 +1485,26 @@ end -- switch_to_tag = true, -- } -- +-- -- Get notified when a client gets or loses the focus: +-- c:connect_signal("property::active", function(c, is_active) +-- -- do something +-- end) +-- +-- -- Get notified when any client gets or loses the focus: +-- client.connect_signal("property::active", function(c, is_active) +-- -- do something +-- end) +-- +-- -- Get notified when any client gets the focus: +-- client.connect_signal("focus", function(c) +-- -- do something +-- end) +-- +-- -- Get notified when any client loses the focus: +-- client.connect_signal("unfocus", function(c) +-- -- do something +-- end) +-- -- @property active -- @tparam boolean active -- @see activate diff --git a/objects/client.c b/objects/client.c index 84d1d6740..893abf212 100644 --- a/objects/client.c +++ b/objects/client.c @@ -1252,6 +1252,9 @@ client_unfocus_internal(client_t *c) globalconf.focus.client = NULL; luaA_object_push(L, c); + + lua_pushboolean(L, false); + luaA_object_emit_signal(L, -2, "property::active", 1); luaA_object_emit_signal(L, -1, "unfocus", 0); lua_pop(L, 1); } @@ -1369,8 +1372,11 @@ client_focus_update(client_t *c) luaA_object_push(L, c); client_set_urgent(L, -1, false); - if(focused_new) + if(focused_new) { + lua_pushboolean(L, true); + luaA_object_emit_signal(L, -2, "property::active", 1); luaA_object_emit_signal(L, -1, "focus", 0); + } lua_pop(L, 1);