awful.mouse: Add a `append_mousebindings` function.
To preserve the symetry between the `button` and `key` API.
This commit is contained in:
parent
370e754006
commit
80c65c5175
|
@ -148,6 +148,7 @@ local default_keys = {}
|
|||
-- @emits client_keybinding::added
|
||||
-- @emitstparam client_keybinding::added awful.key key The key.
|
||||
-- @see awful.key
|
||||
-- @see awful.keyboard.append_client_keybindings
|
||||
|
||||
function module.append_client_keybinding(key)
|
||||
table.insert(default_keys, key)
|
||||
|
@ -167,7 +168,6 @@ end
|
|||
-- @emitstparam client_keybinding::added awful.key key The key.
|
||||
-- @see awful.key
|
||||
-- @see awful.keyboard.append_client_keybinding
|
||||
|
||||
function module.append_client_keybindings(keys)
|
||||
for _, key in ipairs(keys) do
|
||||
module.append_client_keybinding(key)
|
||||
|
|
|
@ -434,9 +434,29 @@ local default_buttons = {}
|
|||
|
||||
function mouse.append_client_mousebinding(button)
|
||||
table.insert(default_buttons, button)
|
||||
|
||||
for _, c in ipairs(capi.client.get(nil, false)) do
|
||||
c:append_mousebinding(button)
|
||||
end
|
||||
|
||||
capi.client.emit_signal("client_mousebinding::added", button)
|
||||
end
|
||||
|
||||
--- Add a `awful.button`s to the default client buttons.
|
||||
--
|
||||
-- @staticfct awful.mouse.append_client_mousebindings
|
||||
-- @tparam table buttons A table containing `awful.button` objects.
|
||||
-- @see awful.button
|
||||
-- @see awful.keyboard.append_client_keybinding
|
||||
-- @see awful.mouse.append_client_mousebinding
|
||||
-- @see awful.keyboard.append_client_keybindings
|
||||
|
||||
function mouse.append_client_mousebindings(buttons)
|
||||
for _, button in ipairs(buttons) do
|
||||
mouse.append_client_mousebinding(button)
|
||||
end
|
||||
end
|
||||
|
||||
for _, b in ipairs {"left", "right", "middle"} do
|
||||
mouse.object["is_".. b .."_mouse_button_pressed"] = function()
|
||||
return capi.mouse.coords().buttons[1]
|
||||
|
|
Loading…
Reference in New Issue