From 7dfd32e4ba8a4d80cdae152eaf667eacd2b822b3 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 16 Oct 2019 02:33:15 -0400 Subject: [PATCH] awful.keyboard: Add a function to remove a key from the default set. --- lib/awful/keyboard.lua | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/awful/keyboard.lua b/lib/awful/keyboard.lua index 491cf974e..f415ca43d 100644 --- a/lib/awful/keyboard.lua +++ b/lib/awful/keyboard.lua @@ -173,4 +173,28 @@ function module.append_client_keybindings(keys) module.append_client_keybinding(key) end end + +--- Remove a key from the default client keys. +-- +-- @staticfct awful.keyboard.remove_client_keybinding +-- @tparam awful.key key The key. +-- @treturn boolean True if the key was removed and false if it wasn't found. +-- @see awful.keyboard.append_client_keybinding + +function module.remove_client_keybinding(key) + for k, v in ipairs(default_keys) do + if key == v then + table.remove(default_keys, k) + + for _, c in ipairs(capi.client.get(nil, false)) do + c:remove_keybinding(key) + end + + return true + end + end + + return false +end + return module