mouse.snap: Add some configuration options
This commit is contained in:
parent
e31563b056
commit
a62e749216
|
@ -38,6 +38,15 @@ mouse.wibox = {}
|
||||||
-- @tparam[opt=8] integer default_distance
|
-- @tparam[opt=8] integer default_distance
|
||||||
-- @see awful.mouse.snap
|
-- @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.
|
--- The snap outline background color.
|
||||||
-- @beautiful beautiful.snap_bg
|
-- @beautiful beautiful.snap_bg
|
||||||
-- @tparam color|string|gradient|pattern color
|
-- @tparam color|string|gradient|pattern color
|
||||||
|
@ -46,7 +55,7 @@ mouse.wibox = {}
|
||||||
-- @beautiful beautiful.snap_border_width
|
-- @beautiful beautiful.snap_border_width
|
||||||
-- @param integer
|
-- @param integer
|
||||||
|
|
||||||
--- The snap outline width.
|
--- The snap outline shape.
|
||||||
-- @beautiful beautiful.snap_shape
|
-- @beautiful beautiful.snap_shape
|
||||||
-- @tparam function shape A `gears.shape` compatible function
|
-- @tparam function shape A `gears.shape` compatible function
|
||||||
|
|
||||||
|
|
|
@ -248,21 +248,21 @@ end
|
||||||
-- Enable edge snapping
|
-- Enable edge snapping
|
||||||
resize.add_move_callback(function(c, geo, args)
|
resize.add_move_callback(function(c, geo, args)
|
||||||
-- Screen edge snapping (areosnap)
|
-- 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)
|
detect_areasnap(c, 16)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Snapping between clients
|
-- Snapping between clients
|
||||||
if args and (args.snap == nil or args.snap) then
|
if (module.client_enabled ~= false)
|
||||||
local ngeo = module.snap(c, args.snap, geo.x, geo.y)
|
and args and (args.snap == nil or args.snap) then
|
||||||
ngeo.x = ngeo.x + (2 * c.border_width)
|
return module.snap(c, args.snap, geo.x, geo.y)
|
||||||
ngeo.y = ngeo.y + (2 * c.border_width)
|
|
||||||
return ngeo
|
|
||||||
end
|
end
|
||||||
end, "mouse.move")
|
end, "mouse.move")
|
||||||
|
|
||||||
-- Apply the aerosnap
|
-- Apply the aerosnap
|
||||||
resize.add_leave_callback(function(c, _, args)
|
resize.add_leave_callback(function(c, _, args)
|
||||||
|
if module.edge_enabled == false then return end
|
||||||
return apply_areasnap(c, args)
|
return apply_areasnap(c, args)
|
||||||
end, "mouse.move")
|
end, "mouse.move")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue