client: emit signal on list changes

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-07-11 09:02:25 +02:00
parent b58d0f848a
commit fc035005ba
3 changed files with 12 additions and 6 deletions

View File

@ -609,6 +609,8 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
if(globalconf.hooks.clients != LUA_REFNIL) if(globalconf.hooks.clients != LUA_REFNIL)
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.clients, 0, 0); luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.clients, 0, 0);
luaA_class_emit_signal(globalconf.L, &client_class, "list", 0);
/* call hook */ /* call hook */
if(globalconf.hooks.manage != LUA_REFNIL) if(globalconf.hooks.manage != LUA_REFNIL)
{ {
@ -1099,6 +1101,8 @@ client_unmanage(client_t *c)
if(globalconf.hooks.clients != LUA_REFNIL) if(globalconf.hooks.clients != LUA_REFNIL)
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.clients, 0, 0); luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.clients, 0, 0);
luaA_class_emit_signal(globalconf.L, &client_class, "list", 0);
window_state_set(c->win, XCB_WM_STATE_WITHDRAWN); window_state_set(c->win, XCB_WM_STATE_WITHDRAWN);
titlebar_client_detach(c); titlebar_client_detach(c);
@ -1270,6 +1274,8 @@ luaA_client_swap(lua_State *L)
/* Call hook to notify list change */ /* Call hook to notify list change */
if(globalconf.hooks.clients != LUA_REFNIL) if(globalconf.hooks.clients != LUA_REFNIL)
luaA_dofunction_from_registry(L, globalconf.hooks.clients, 0, 0); luaA_dofunction_from_registry(L, globalconf.hooks.clients, 0, 0);
luaA_class_emit_signal(globalconf.L, &client_class, "list", 0);
} }
return 0; return 0;

View File

@ -133,11 +133,11 @@ end)
hooks.padding.register(function(screen) on_arrange(screen) end) hooks.padding.register(function(screen) on_arrange(screen) end)
capi.client.add_signal("focus", function(c) on_arrange(c.screen) end) capi.client.add_signal("focus", function(c) on_arrange(c.screen) end)
hooks.clients.register(function() capi.client.add_signal("list", function()
for screen = 1, capi.screen.count() do for screen = 1, capi.screen.count() do
on_arrange(screen) on_arrange(screen)
end end
end) end)
hooks.tags.register(function(screen, tag, action) on_arrange(screen) end) hooks.tags.register(function(screen, tag, action) on_arrange(screen) end)
hooks.tagged.register(function(c, tag) hooks.tagged.register(function(c, tag)
if not tag.screen then return end if not tag.screen then return end

View File

@ -56,7 +56,7 @@ function new(label, buttons)
local data = setmetatable({}, { __mode = 'k' }) local data = setmetatable({}, { __mode = 'k' })
local u = function () tasklist_update(w, buttons, label, data, widgets) end local u = function () tasklist_update(w, buttons, label, data, widgets) end
hooks.tags.register(u) hooks.tags.register(u)
hooks.clients.register(u) capi.client.add_signal("list", u)
hooks.tagged.register(u) hooks.tagged.register(u)
capi.client.add_signal("focus", u) capi.client.add_signal("focus", u)
capi.client.add_signal("unfocus", u) capi.client.add_signal("unfocus", u)