mouse: Add an `awful.mouse.snap.aerosnap_distance` global variable.

The distance to snap clients to each other was already something which
could be configured. The distance to enable screen edge wasn't.

Fixes #3025
This commit is contained in:
Emmanuel Lepage Vallee 2020-03-22 03:32:45 -04:00
parent f982cecd6b
commit d9514820ef
2 changed files with 11 additions and 5 deletions

View File

@ -31,11 +31,16 @@ local mouse = {
mouse.object = {} mouse.object = {}
mouse.wibox = {} mouse.wibox = {}
--- The default snap distance. --- The default distance before snapping clients together.
-- @tfield integer awful.mouse.snap.default_distance -- @tfield integer awful.mouse.snap.default_distance
-- @tparam[opt=8] integer default_distance -- @tparam[opt=8] integer default_distance
-- @see awful.mouse.snap -- @see awful.mouse.snap
--- The default distance before activating screen edge snap.
-- @tfield integer awful.mouse.snap.aerosnap_distance
-- @tparam[opt=16] integer default_distance
-- @see awful.mouse.snap
--- Enable screen edges snapping. --- Enable screen edges snapping.
-- @tfield[opt=true] boolean awful.mouse.snap.edge_enabled -- @tfield[opt=true] boolean awful.mouse.snap.edge_enabled
@ -57,9 +62,9 @@ mouse.wibox = {}
-- @beautiful beautiful.snap_shape -- @beautiful beautiful.snap_shape
-- @tparam function shape A `gears.shape` compatible function -- @tparam function shape A `gears.shape` compatible function
--- The gap between snapped contents. --- The gap between snapped clients.
-- @beautiful beautiful.snapper_gap -- @beautiful beautiful.snapper_gap
-- @tparam number (default: 0) -- @tparam[opt=0] number snapper_gap
--- Get the client object under the pointer. --- Get the client object under the pointer.
-- @deprecated awful.mouse.client_under_pointer -- @deprecated awful.mouse.client_under_pointer

View File

@ -25,7 +25,8 @@ local capi = {
} }
local module = { local module = {
default_distance = 8 default_distance = 8,
aerosnap_distance = 16
} }
local placeholder_w = nil local placeholder_w = nil
@ -258,7 +259,7 @@ resize.add_move_callback(function(c, geo, args)
-- Screen edge snapping (areosnap) -- Screen edge snapping (areosnap)
if (module.edge_enabled ~= false) if (module.edge_enabled ~= false)
and args and (args.snap == nil or args.snap) then and args and (args.snap == nil or args.snap) then
detect_areasnap(c, 16) detect_areasnap(c, module.aerosnap_distance)
end end
-- Snapping between clients -- Snapping between clients