From c27ce1e83356b636e711b3db56071e31f3f1250d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Wed, 6 Jun 2012 17:25:45 +0200 Subject: [PATCH] Get keygrabber running state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a function keygrabber.isrunning() which return a boolean state of keygrabber Signed-off-by: Sébastien Luttringer Signed-off-by: Julien Danjou --- keygrabber.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/keygrabber.c b/keygrabber.c index 6f683a5d..97beef6c 100644 --- a/keygrabber.c +++ b/keygrabber.c @@ -129,10 +129,24 @@ luaA_keygrabber_stop(lua_State *L) 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[] = { { "run", luaA_keygrabber_run }, { "stop", luaA_keygrabber_stop }, + { "isrunning", luaA_keygrabber_isrunning }, { NULL, NULL } };