diff --git a/client.c b/client.c index 299b8e40..8ec58aa2 100644 --- a/client.c +++ b/client.c @@ -1998,6 +1998,22 @@ luaA_client_get_titlebar(lua_State *L, client_t *c) return luaA_object_push(L, c->titlebar); } +static int +luaA_client_get_focusable(lua_State *L, client_t *c) +{ + bool ret; + + /* A client can be focused if it doesnt have the "nofocus" hint...*/ + if (!c->nofocus) + ret = true; + else + /* ...or if it knows the WM_TAKE_FOCUS protocol */ + ret = client_hasproto(c, WM_TAKE_FOCUS); + + lua_pushboolean(L, ret); + return 1; +} + static int luaA_client_get_size_hints(lua_State *L, client_t *c) { @@ -2381,6 +2397,10 @@ client_class_setup(lua_State *L) NULL, (lua_class_propfunc_t) luaA_client_get_size_hints, NULL); + luaA_class_add_property(&client_class, A_TK_FOCUSABLE, + NULL, + (lua_class_propfunc_t) luaA_client_get_focusable, + NULL); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/common/tokenize.gperf b/common/tokenize.gperf index 7f07a4d6..84cc0f34 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -30,6 +30,7 @@ ellipsize end fg focus +focusable font font_height fullscreen diff --git a/luadoc/client.lua b/luadoc/client.lua index 6cabe243..d85e3271 100644 --- a/luadoc/client.lua +++ b/luadoc/client.lua @@ -41,6 +41,7 @@ module("client") -- user_size, program_position, program_size, etc. -- @field sticky Set the client sticky, i.e. available on all tags. -- @field modal Indicate if the client is modal. +-- @field focusable True if the client can receive the input focus. -- @class table -- @name client