diff --git a/lib/awful/placement.lua.in b/lib/awful/placement.lua.in index 38f39e06c..c30327fb5 100644 --- a/lib/awful/placement.lua.in +++ b/lib/awful/placement.lua.in @@ -145,10 +145,19 @@ function no_overlap(c) and r.width * r.height > new.width * new.height then found = true new = r + -- Check if the client's current position is available + -- and prefer that one (why move it around pointlessly?) + if geometry.x >= r.x + and geometry.y >= r.y + and geometry.x + geometry.width <= r.x + r.width + and geometry.y + geometry.height <= r.y + r.height then + new.x = geometry.x + new.y = geometry.y + end end end - -- We did not foudn an area with enough space for our size: + -- We did not find an area with enough space for our size: -- just take the biggest available one and go in if not found then for i, r in ipairs(areas) do