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;
|
int screen_nbr, nscreens;
|
||||||
|
|
||||||
|
if(globalconf.hooks.exit != LUA_REFNIL)
|
||||||
|
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.exit, 0, 0);
|
||||||
|
|
||||||
a_dbus_cleanup();
|
a_dbus_cleanup();
|
||||||
|
|
||||||
/* reparent systray windows, otherwise they may die with their master */
|
/* 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;
|
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
|
#ifdef WITH_DBUS
|
||||||
/** Set the function to be called when a D-Bus event is received.
|
/** 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
|
* 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 },
|
{ "tagged", luaA_hooks_tagged },
|
||||||
{ "startup_notification", luaA_hooks_startup_notification },
|
{ "startup_notification", luaA_hooks_startup_notification },
|
||||||
{ "timer", luaA_hooks_timer },
|
{ "timer", luaA_hooks_timer },
|
||||||
|
{ "exit", luaA_hooks_exit },
|
||||||
#ifdef WITH_DBUS
|
#ifdef WITH_DBUS
|
||||||
{ "dbus", luaA_hooks_dbus },
|
{ "dbus", luaA_hooks_dbus },
|
||||||
#endif
|
#endif
|
||||||
|
|
1
luaa.c
1
luaa.c
|
@ -743,6 +743,7 @@ luaA_init(xdgHandle* xdg)
|
||||||
globalconf.hooks.property = LUA_REFNIL;
|
globalconf.hooks.property = LUA_REFNIL;
|
||||||
globalconf.hooks.startup_notification = LUA_REFNIL;
|
globalconf.hooks.startup_notification = LUA_REFNIL;
|
||||||
globalconf.hooks.timer = LUA_REFNIL;
|
globalconf.hooks.timer = LUA_REFNIL;
|
||||||
|
globalconf.hooks.exit = LUA_REFNIL;
|
||||||
#ifdef WITH_DBUS
|
#ifdef WITH_DBUS
|
||||||
globalconf.hooks.dbus = LUA_REFNIL;
|
globalconf.hooks.dbus = LUA_REFNIL;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -122,6 +122,8 @@ struct awesome_t
|
||||||
luaA_ref property;
|
luaA_ref property;
|
||||||
/** Command to run on time */
|
/** Command to run on time */
|
||||||
luaA_ref timer;
|
luaA_ref timer;
|
||||||
|
/** Command to run on awesome exit */
|
||||||
|
luaA_ref exit;
|
||||||
/** Startup notification hooks */
|
/** Startup notification hooks */
|
||||||
luaA_ref startup_notification;
|
luaA_ref startup_notification;
|
||||||
#ifdef WITH_DBUS
|
#ifdef WITH_DBUS
|
||||||
|
|
Loading…
Reference in New Issue