Get keygrabber running state

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

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 17:25:45 +02:00 committed by Julien Danjou
parent 0cbb3b4770
commit af1dcc431c
1 changed files with 14 additions and 0 deletions

View File

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