awful.mouse: Add a function to add a new awful.buttons to clients.

This commit is contained in:
Emmanuel Lepage Vallee 2019-10-16 02:13:45 -04:00
parent a8e8c46b56
commit 370e754006

View file

@ -421,6 +421,22 @@ function mouse.remove_global_mousebinding(button)
capi.root._remove_button(button)
end
local default_buttons = {}
--- Add an `awful.button` to the default client buttons.
--
-- @staticfct awful.mouse.append_client_mousebinding
-- @tparam awful.button button The button.
-- @emits client_mousebinding::added
-- @emitstparam client_mousebinding::added awful.button button The button.
-- @see awful.button
-- @see awful.keyboard.append_client_keybinding
function mouse.append_client_mousebinding(button)
table.insert(default_buttons, button)
capi.client.emit_signal("client_mousebinding::added", button)
end
for _, b in ipairs {"left", "right", "middle"} do
mouse.object["is_".. b .."_mouse_button_pressed"] = function()
return capi.mouse.coords().buttons[1]
@ -470,7 +486,6 @@ end)
-- when button 1 is pressed.
-- @staticfct mouse.coords
return mouse
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80