awful.mouse: Add a function to add a new `awful.button`s to clients.
This commit is contained in:
parent
a8e8c46b56
commit
370e754006
|
@ -421,6 +421,22 @@ function mouse.remove_global_mousebinding(button)
|
||||||
capi.root._remove_button(button)
|
capi.root._remove_button(button)
|
||||||
end
|
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
|
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]
|
||||||
|
@ -470,7 +486,6 @@ end)
|
||||||
-- when button 1 is pressed.
|
-- when button 1 is pressed.
|
||||||
-- @staticfct mouse.coords
|
-- @staticfct mouse.coords
|
||||||
|
|
||||||
|
|
||||||
return mouse
|
return mouse
|
||||||
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||||
|
|
Loading…
Reference in New Issue