Get mousegrabber running state

Add a function mousegrabber.isrunning() which return a boolean state of
mousegrabber

Signed-off-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Sébastien Luttringer 2012-06-06 00:35:11 +02:00 committed by Julien Danjou
parent d0f3e399d7
commit f9e3bc8a7a
1 changed files with 14 additions and 0 deletions

View File

@ -110,10 +110,24 @@ luaA_mousegrabber_stop(lua_State *L)
return 0; return 0;
} }
/** Check if mousegrabber is running.
* \param L The Lua VM state.
* \return The number of elements pushed on stack.
* \luastack
* \lreturn A boolean value, true if mousegrabber is running, false otherwise.
*/
static int
luaA_mousegrabber_isrunning(lua_State *L)
{
lua_pushboolean(L, globalconf.mousegrabber != LUA_REFNIL);
return 1;
}
const struct luaL_reg awesome_mousegrabber_lib[] = const struct luaL_reg awesome_mousegrabber_lib[] =
{ {
{ "run", luaA_mousegrabber_run }, { "run", luaA_mousegrabber_run },
{ "stop", luaA_mousegrabber_stop }, { "stop", luaA_mousegrabber_stop },
{ "isrunning", luaA_mousegrabber_isrunning },
{ NULL, NULL } { NULL, NULL }
}; };