awful.mouse: Add a function to remove a default client button.

This commit is contained in:
Emmanuel Lepage Vallee 2019-10-16 02:47:16 -04:00
parent 7dfd32e4ba
commit 8b6ea8243a
1 changed files with 23 additions and 0 deletions

View File

@ -457,6 +457,29 @@ function mouse.append_client_mousebindings(buttons)
end end
end end
--- Remove a mousebinding from the default client buttons.
--
-- @staticfct awful.mouse.remove_client_mousebinding
-- @tparam awful.button button The button.
-- @treturn boolean True if the button was removed and false if it wasn't found.
-- @see awful.keyboard.append_client_keybinding
function mouse.remove_client_mousebinding(button)
for k, v in ipairs(default_buttons) do
if button == v then
table.remove(default_buttons, k)
for _, c in ipairs(capi.client.get(nil, false)) do
c:remove_mousebinding(button)
end
return true
end
end
return false
end
for _, b in ipairs {"left", "right", "middle"} do for _, b in ipairs {"left", "right", "middle"} do
mouse.object["is_".. b .."_mouse_button_pressed"] = function() mouse.object["is_".. b .."_mouse_button_pressed"] = function()
return capi.mouse.coords().buttons[1] return capi.mouse.coords().buttons[1]