mouse.snap: Add some configuration options

This commit is contained in:
Emmanuel Lepage Vallee 2016-04-27 21:16:20 -04:00
parent e31563b056
commit a62e749216
2 changed files with 16 additions and 7 deletions

View File

@ -38,6 +38,15 @@ mouse.wibox = {}
-- @tparam[opt=8] integer default_distance
-- @see awful.mouse.snap
--- Enable screen edges snapping.
-- @tfield[opt=true] boolean awful.mouse.snap.edge_enabled
--- Enable client to client snapping.
-- @tfield[opt=true] boolean awful.mouse.snap.client_enabled
--- Enable changing tag when a client is dragged to the edge of the screen.
-- @tfield[opt=false] integer awful.mouse.snap.drag_to_tag_enabled
--- The snap outline background color.
-- @beautiful beautiful.snap_bg
-- @tparam color|string|gradient|pattern color
@ -46,7 +55,7 @@ mouse.wibox = {}
-- @beautiful beautiful.snap_border_width
-- @param integer
--- The snap outline width.
--- The snap outline shape.
-- @beautiful beautiful.snap_shape
-- @tparam function shape A `gears.shape` compatible function

View File

@ -248,21 +248,21 @@ end
-- Enable edge snapping
resize.add_move_callback(function(c, geo, args)
-- Screen edge snapping (areosnap)
if args and (args.snap == nil or args.snap) then--TODO add a config option
if (module.edge_enabled ~= false)
and args and (args.snap == nil or args.snap) then
detect_areasnap(c, 16)
end
-- Snapping between clients
if args and (args.snap == nil or args.snap) then
local ngeo = module.snap(c, args.snap, geo.x, geo.y)
ngeo.x = ngeo.x + (2 * c.border_width)
ngeo.y = ngeo.y + (2 * c.border_width)
return ngeo
if (module.client_enabled ~= false)
and args and (args.snap == nil or args.snap) then
return module.snap(c, args.snap, geo.x, geo.y)
end
end, "mouse.move")
-- Apply the aerosnap
resize.add_leave_callback(function(c, _, args)
if module.edge_enabled == false then return end
return apply_areasnap(c, args)
end, "mouse.move")