[lua] Add an hook on arrange

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-23 17:09:34 +02:00
parent c6261b028b
commit 9a0ed4d0d3
3 changed files with 16 additions and 0 deletions

View File

@ -89,6 +89,9 @@ arrange(int screen)
/* reset status */ /* reset status */
globalconf.screens[screen].need_arrange = false; globalconf.screens[screen].need_arrange = false;
/* call hook */
luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 0);
} }
/** Refresh the screen disposition /** Refresh the screen disposition

11
lua.c
View File

@ -257,6 +257,16 @@ luaA_hooks_mouseover(lua_State *L)
return 0; return 0;
} }
static int
luaA_hooks_arrange(lua_State *L)
{
luaA_checkfunction(L, 1);
if(globalconf.hooks.arrange)
luaL_unref(L, LUA_REGISTRYINDEX, globalconf.hooks.arrange);
globalconf.hooks.arrange = luaL_ref(L, LUA_REGISTRYINDEX);
return 0;
}
static void static void
luaA_openlib(lua_State *L, const char *name, luaA_openlib(lua_State *L, const char *name,
const struct luaL_reg methods[], const struct luaL_reg methods[],
@ -309,6 +319,7 @@ luaA_parserc(const char *rcfile)
{ "unfocus", luaA_hooks_unfocus }, { "unfocus", luaA_hooks_unfocus },
{ "newclient", luaA_hooks_newclient }, { "newclient", luaA_hooks_newclient },
{ "mouseover", luaA_hooks_mouseover }, { "mouseover", luaA_hooks_mouseover },
{ "arrange", luaA_hooks_arrange },
{ NULL, NULL } { NULL, NULL }
}; };

View File

@ -412,6 +412,8 @@ struct AwesomeConf
luaA_function unfocus; luaA_function unfocus;
/** Command to run when mouse is over */ /** Command to run when mouse is over */
luaA_function mouseover; luaA_function mouseover;
/** Command to run on arrange */
luaA_function arrange;
} hooks; } hooks;
}; };