awful.rules: Use the awful.client/mouse default buttons and keys.

This commit is contained in:
Emmanuel Lepage Vallee 2019-10-16 02:54:15 -04:00
parent 1921d54528
commit 44a665d381
3 changed files with 29 additions and 0 deletions

View file

@ -197,4 +197,13 @@ function module.remove_client_keybinding(key)
return false return false
end end
capi.client.connect_signal("scanning", function()
capi.client.emit_signal("request::default_keybindings", "context")
end)
-- Private function to be used by `ruled.client`.
function module._get_client_keybindings()
return default_keys
end
return module return module

View file

@ -121,6 +121,8 @@ local protected_call = require("gears.protected_call")
local aspawn = require("awful.spawn") local aspawn = require("awful.spawn")
local gdebug = require("gears.debug") local gdebug = require("gears.debug")
local gmatcher = require("gears.matcher") local gmatcher = require("gears.matcher")
local amouse = require("awful.mouse")
local akeyboard = require("awful.keyboard")
local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1) local unpack = unpack or table.unpack -- luacheck: globals unpack (compatibility with Lua 5.1)
local rules = {} local rules = {}
@ -529,6 +531,13 @@ end
-- @staticfct awful.rules.execute -- @staticfct awful.rules.execute
crules._execute = function(_, c, props, callbacks) crules._execute = function(_, c, props, callbacks)
-- Set the default buttons and keys
local btns = amouse._get_client_mousebindings()
local keys = akeyboard._get_client_keybindings()
props.keys = props.keys or keys
props.buttons = props.buttons or btns
-- This has to be done first, as it will impact geometry related props. -- This has to be done first, as it will impact geometry related props.
if props.titlebars_enabled and (type(props.titlebars_enabled) ~= "function" if props.titlebars_enabled and (type(props.titlebars_enabled) ~= "function"
or props.titlebars_enabled(c,props)) then or props.titlebars_enabled(c,props)) then

View file

@ -255,6 +255,17 @@
* `startup`). * `startup`).
*/ */
/** Emitted during startup to gather the default client keybindings.
*
* This signals gives a chance to all module to register new client keybindings.
* Assuming the client rules does not overwrite them with the `keys` property,
* they will be added to all clients.
*
* @signal request::default_keybindings
* @tparam string context The reason why the signal was sent (currently always
* `startup`).
*/
/** When a client gets tagged. /** When a client gets tagged.
* @signal tagged * @signal tagged
* @tag t The tag object. * @tag t The tag object.