client: Add a property::active signal.
This commit is contained in:
parent
ba5385dd40
commit
c10bdc3cfe
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue