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 5d99804f9e
commit 0cbb3b4770
1 changed files with 14 additions and 0 deletions

View File

@ -134,10 +134,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 }
}; };