diff --git a/hooks.c b/hooks.c index 1c288ca0..0da2c475 100644 --- a/hooks.c +++ b/hooks.c @@ -116,7 +116,8 @@ luaA_hooks_clients(lua_State *L) } /** Set the function called on each screen tag list change. - * This function is called with a screen number as argument. + * This function is called with a screen number as first argument, + * the tag object as second and the action (add or remove) as third. * \param L The Lua VM state. * \return The number of elements pushed on stack. * \luastack diff --git a/tag.c b/tag.c index 0399a78a..1d03e8ad 100644 --- a/tag.c +++ b/tag.c @@ -103,7 +103,9 @@ tag_append_to_screen(tag_t *tag, screen_t *s) if(globalconf.hooks.tags != LUA_REFNIL) { lua_pushnumber(globalconf.L, s->index + 1); - luaA_dofunction(globalconf.L, globalconf.hooks.tags, 1, 0); + luaA_tag_userdata_new(globalconf.L, tag); + lua_pushliteral(globalconf.L, "add"); + luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0); } } @@ -127,7 +129,6 @@ tag_remove_from_screen(tag_t *tag) ewmh_update_net_desktop_names(phys_screen); ewmh_update_workarea(phys_screen); tag->screen = SCREEN_UNDEF; - tag_unref(&tag); /* resave tag prop of all clients so the number of tag will be the * same */ @@ -138,8 +139,12 @@ tag_remove_from_screen(tag_t *tag) if(globalconf.hooks.tags != LUA_REFNIL) { lua_pushnumber(globalconf.L, screen + 1); - luaA_dofunction(globalconf.L, globalconf.hooks.tags, 1, 0); + luaA_tag_userdata_new(globalconf.L, tag); + lua_pushliteral(globalconf.L, "remove"); + luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0); } + + tag_unref(&tag); } /** Tag a client with specified tag.