From fc035005ba5dca3584f4c85acc08f8b22f46082f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 11 Jul 2009 09:02:25 +0200 Subject: [PATCH] client: emit signal on list changes Signed-off-by: Julien Danjou --- client.c | 6 ++++++ lib/awful/layout/init.lua.in | 10 +++++----- lib/awful/widget/tasklist.lua.in | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client.c b/client.c index 5724d7e0a..8799fb1ba 100644 --- a/client.c +++ b/client.c @@ -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) luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.clients, 0, 0); + luaA_class_emit_signal(globalconf.L, &client_class, "list", 0); + /* call hook */ if(globalconf.hooks.manage != LUA_REFNIL) { @@ -1099,6 +1101,8 @@ client_unmanage(client_t *c) if(globalconf.hooks.clients != LUA_REFNIL) 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); titlebar_client_detach(c); @@ -1270,6 +1274,8 @@ luaA_client_swap(lua_State *L) /* Call hook to notify list change */ if(globalconf.hooks.clients != LUA_REFNIL) luaA_dofunction_from_registry(L, globalconf.hooks.clients, 0, 0); + + luaA_class_emit_signal(globalconf.L, &client_class, "list", 0); } return 0; diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index 3074ce564..2a80891da 100644 --- a/lib/awful/layout/init.lua.in +++ b/lib/awful/layout/init.lua.in @@ -133,11 +133,11 @@ end) hooks.padding.register(function(screen) on_arrange(screen) end) capi.client.add_signal("focus", function(c) on_arrange(c.screen) end) -hooks.clients.register(function() - for screen = 1, capi.screen.count() do - on_arrange(screen) - end - end) +capi.client.add_signal("list", function() + for screen = 1, capi.screen.count() do + on_arrange(screen) + end + end) hooks.tags.register(function(screen, tag, action) on_arrange(screen) end) hooks.tagged.register(function(c, tag) if not tag.screen then return end diff --git a/lib/awful/widget/tasklist.lua.in b/lib/awful/widget/tasklist.lua.in index f78ae3fc2..e018d6348 100644 --- a/lib/awful/widget/tasklist.lua.in +++ b/lib/awful/widget/tasklist.lua.in @@ -56,7 +56,7 @@ function new(label, buttons) local data = setmetatable({}, { __mode = 'k' }) local u = function () tasklist_update(w, buttons, label, data, widgets) end hooks.tags.register(u) - hooks.clients.register(u) + capi.client.add_signal("list", u) hooks.tagged.register(u) capi.client.add_signal("focus", u) capi.client.add_signal("unfocus", u)