From 370e754006d051edee6e0052545fa92f35be2ded Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 16 Oct 2019 02:13:45 -0400 Subject: [PATCH] awful.mouse: Add a function to add a new `awful.button`s to clients. --- lib/awful/mouse/init.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/awful/mouse/init.lua b/lib/awful/mouse/init.lua index 5e768fe76..ff737fcda 100644 --- a/lib/awful/mouse/init.lua +++ b/lib/awful/mouse/init.lua @@ -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