hooks: add exit hook
Signed-off-by: koniu <gkusnierz@gmail.com> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
8701792b83
commit
f9311b1e00
|
@ -63,6 +63,9 @@ awesome_atexit(void)
|
|||
{
|
||||
int screen_nbr, nscreens;
|
||||
|
||||
if(globalconf.hooks.exit != LUA_REFNIL)
|
||||
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.exit, 0, 0);
|
||||
|
||||
a_dbus_cleanup();
|
||||
|
||||
/* reparent systray windows, otherwise they may die with their master */
|
||||
|
|
13
hooks.c
13
hooks.c
|
@ -214,6 +214,18 @@ luaA_hooks_timer(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** Set the function called on awesome exit
|
||||
* \param L The Lua VM state.
|
||||
* \return The number of elements pushed on stack.
|
||||
* \luastack
|
||||
* \lparam A function to call on awesome exit.
|
||||
*/
|
||||
static int
|
||||
luaA_hooks_exit(lua_State *L)
|
||||
{
|
||||
HANDLE_HOOK(L, globalconf.hooks.exit);
|
||||
}
|
||||
|
||||
#ifdef WITH_DBUS
|
||||
/** Set the function to be called when a D-Bus event is received.
|
||||
* The first argument passed to this function is the type of the message we
|
||||
|
@ -249,6 +261,7 @@ const struct luaL_reg awesome_hooks_lib[] =
|
|||
{ "tagged", luaA_hooks_tagged },
|
||||
{ "startup_notification", luaA_hooks_startup_notification },
|
||||
{ "timer", luaA_hooks_timer },
|
||||
{ "exit", luaA_hooks_exit },
|
||||
#ifdef WITH_DBUS
|
||||
{ "dbus", luaA_hooks_dbus },
|
||||
#endif
|
||||
|
|
1
luaa.c
1
luaa.c
|
@ -743,6 +743,7 @@ luaA_init(xdgHandle* xdg)
|
|||
globalconf.hooks.property = LUA_REFNIL;
|
||||
globalconf.hooks.startup_notification = LUA_REFNIL;
|
||||
globalconf.hooks.timer = LUA_REFNIL;
|
||||
globalconf.hooks.exit = LUA_REFNIL;
|
||||
#ifdef WITH_DBUS
|
||||
globalconf.hooks.dbus = LUA_REFNIL;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue