From 93b90026e94dab9277cec0b8b6c736d379226bce Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 31 Dec 2018 17:14:56 -0500 Subject: [PATCH] root: Add a `has_key` and `has_button` functions. --- lib/awful/root.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/awful/root.lua b/lib/awful/root.lua index 373665eb..6f28f5da 100644 --- a/lib/awful/root.lua +++ b/lib/awful/root.lua @@ -106,6 +106,14 @@ for _, type_name in ipairs { "button", "key" } do table.insert(removed, value) end + capi.root["has_"..type_name] = function(item) + if not item["_is_capi_"..type_name] then + item = item[1] + end + + return gtable.hasitem(capi.root["_"..prop_name](), item) ~= nil + end + assert(root[prop_name]) end