awful.placement.no_overlap: Honor original position
awful.placement.no_overlap caused clients on an otherwise empty desktop to stich to the top-left corner of the screen because it always preferred the top-left corner of the available space. This commit doesn't change the way in which the available area is computed, but instead this now tries to keep the client at its original position if that is available. This fixes cases where calling awful.placement.no_overlap as a callback from an awful.rule rule didn't work because the manage signal in the default config later overrode that via calling awful.placement.no_overlap. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
af6915fda2
commit
00273528b0
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue