diff --git a/lib/awful/_compat.lua b/lib/awful/_compat.lua index 135e32b17..b7af2bb2d 100644 --- a/lib/awful/_compat.lua +++ b/lib/awful/_compat.lua @@ -70,3 +70,11 @@ gprop._legacy_accessors(capi.root, "buttons", "_buttons", false, function(new_bt type(new_btns[1]) == "button" or new_btns[1]._is_capi_button ) or false end, true) + +gprop._legacy_accessors(capi.root, "keys", "_keys", false, function(new_btns) + return new_btns[1] and ( + type(new_btns[1]) == "key" or new_btns[1]._is_capi_button + ) or false +end, true) + +assert(root.keys) diff --git a/root.c b/root.c index 778838d9d..9c1b14655 100644 --- a/root.c +++ b/root.c @@ -335,11 +335,12 @@ luaA_root_fake_input(lua_State *L) } /** Get or set global key bindings. - * These bindings will be available when you press keys on the root window. + * These bindings will be available when you press keys on the root window + * (the wallpaper). * - * @tparam table|nil keys_array An array of key binding objects, or nothing. - * @return The array of key bindings objects of this client. - * @staticfct keys + * @property keys + * @param table + * @see awful.key */ static int luaA_root_keys(lua_State *L) @@ -597,7 +598,7 @@ luaA_root_newindex(lua_State *L) const struct luaL_Reg awesome_root_methods[] = { { "_buttons", luaA_root_buttons }, - { "keys", luaA_root_keys }, + { "_keys", luaA_root_keys }, { "cursor", luaA_root_cursor }, { "fake_input", luaA_root_fake_input }, { "drawins", luaA_root_drawins }, diff --git a/tests/examples/shims/root.lua b/tests/examples/shims/root.lua index ef7031567..47ee71b32 100644 --- a/tests/examples/shims/root.lua +++ b/tests/examples/shims/root.lua @@ -32,7 +32,7 @@ function root.cursor() end local keys = {} -function root.keys(k) +function root._keys(k) keys = k or keys return keys end