diff --git a/lib/awful/client.lua b/lib/awful/client.lua index 03389851..ccf28325 100644 --- a/lib/awful/client.lua +++ b/lib/awful/client.lua @@ -1350,6 +1350,12 @@ object.properties._legacy_accessors(client, "buttons", "_buttons", true, functio ) or false end, true) +object.properties._legacy_accessors(client, "keys", "_keys", true, function(new_btns) + return new_btns[1] and ( + type(new_btns[1]) == "key" or new_btns[1]._is_capi_key + ) or false +end, true) + --- Set the client shape. -- @property shape -- @tparam gears.shape A gears.shape compatible function. diff --git a/objects/client.c b/objects/client.c index 6a881a62..e9b47a15 100644 --- a/objects/client.c +++ b/objects/client.c @@ -3677,9 +3677,9 @@ luaA_client_set_shape_input(lua_State *L, client_t *c) /** Get or set keys bindings for a client. * - * @param keys_table An array of key bindings objects, or nothing. - * @return A table with all keys. - * @method keys + * @property keys + * @param table + * @see awful.key */ static int luaA_client_keys(lua_State *L) @@ -3813,7 +3813,7 @@ client_class_setup(lua_State *L) { LUA_OBJECT_META(client) LUA_CLASS_META - { "keys", luaA_client_keys }, + { "_keys", luaA_client_keys }, { "isvisible", luaA_client_isvisible }, { "geometry", luaA_client_geometry }, { "apply_size_hints", luaA_client_apply_size_hints }, diff --git a/tests/examples/shims/key.lua b/tests/examples/shims/key.lua index 2936189d..ff2866aa 100644 --- a/tests/examples/shims/key.lua +++ b/tests/examples/shims/key.lua @@ -1,6 +1,6 @@ local gobject = require("gears.object") local gtable = require("gears.table") -return setmetatable({}, {__call = function(_, args) +return setmetatable({_is_capi_key = true}, {__call = function(_, args) return gtable.crush(gobject(), args) end})