signals for controls

This commit is contained in:
BZ 2020-10-25 22:57:53 +01:00
parent b771ae1e53
commit bb4b8d3daa
2 changed files with 32 additions and 17 deletions

View File

@ -34,16 +34,16 @@ If you end up using this module, consider removing default titlebar initializati
Controls:
------------
| button | default action | handler |
|---|---|---|
| <kbd>left click</kbd> | move client | `button_left_click`
| <kbd>right click</kbd> | open client menu | `button_right_click`
| <kbd>double left click</kbd> | toggle maximize | `button_double_click`
| <kbd>middle click</kbd> | resize client | `button_middle_click`
| <kbd>mousewheel up</kbd> | increase client height | `button_wheel_up`
| <kbd>mousewheel down</kbd> | decrease client height | `button_wheel_down`
| <kbd>mouse forward</kbd> | swap client with next client by index | `button_forward`
| <kbd>mouse back</kbd> | swap client with previous client by index | `button_back`
| button | default action | handler | signal |
|---|---|---|---|
| <kbd>left click</kbd> | move client | `button_left_click` | `smart_borders::left_click`
| <kbd>right click</kbd> | open client menu | `button_right_click`| `smart_borders::right_click`
| <kbd>double left click</kbd> | toggle maximize | `button_double_click` | `smart_borders::left_click`
| <kbd>middle click</kbd> | resize client | `button_middle_click` | `smart_borders::middle_click`
| <kbd>mousewheel up</kbd> | increase client height | `button_wheel_up` | `smart_borders::wheel_up`
| <kbd>mousewheel down</kbd> | decrease client height | `button_wheel_down` | `smart_borders::wheel_down`
| <kbd>mouse forward</kbd> | swap client with next client by index | `button_forward` | `smart_borders::forward_click`
| <kbd>mouse back</kbd> | swap client with previous client by index | `button_back` | `smart_borders::back_click`
Customization:
------------
@ -245,6 +245,11 @@ require("smart_borders"){
-- set client as master
c:swap(awful.client.getmaster())
end
-- add rightclick menu to your tasklist
-- awful.button({}, 3, function(c)
-- c:emit_signal("smart_borders::right_click")
-- end)
}
```

View File

@ -326,25 +326,35 @@ local function new(config)
end
end
button_funcs[1] = left_click_function
client.connect_signal("smart_borders::left_click", left_click_function)
client.connect_signal("smart_borders::middle_click", button_middle_click)
client.connect_signal("smart_borders::right_click", button_right_click)
client.connect_signal("smart_borders::wheel_up", button_wheel_up)
client.connect_signal("smart_borders::wheel_down", button_wheel_down)
client.connect_signal("smart_borders::back_click", button_back)
client.connect_signal("smart_borders::forward_click", button_forward)
button_funcs[1] = function(c)
c:emit_signal("smart_borders::left_click")
end
button_funcs[2] = function(c)
button_middle_click(c)
c:emit_signal("smart_borders::middle_click")
end
button_funcs[3] = function(c)
button_right_click(c)
c:emit_signal("smart_borders::right_click")
end
button_funcs[4] = function(c)
button_wheel_up(c)
c:emit_signal("smart_borders::wheel_up")
end
button_funcs[5] = function(c)
button_wheel_down(c)
c:emit_signal("smart_borders::wheel_down")
end
button_funcs[8] = function(c)
button_back(c)
c:emit_signal("smart_borders::back_click")
end
button_funcs[9] = function(c)
button_forward(c)
c:emit_signal("smart_borders::forward_click")
end
local function handle_button_press(c, button)
local func = button_funcs[button]