From cbfe8274be63a7b5e8a0b1a60da6a333b1d8eac1 Mon Sep 17 00:00:00 2001 From: Anatolii Aniskovych Date: Fri, 18 May 2018 23:55:39 +0300 Subject: [PATCH] awful.placement: Keep client position when no space available in no_overlap() (#2139) --- lib/awful/placement.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/awful/placement.lua b/lib/awful/placement.lua index d0da647c..273bbbf7 100644 --- a/lib/awful/placement.lua +++ b/lib/awful/placement.lua @@ -908,13 +908,18 @@ function placement.no_overlap(c, args) -- This makes sure to have the whole screen's area in case it has been -- removed. if not found then - if #areas == 0 then - areas = { screen.workarea } - end - for _, r in ipairs(areas) do - if r.width * r.height > new.width * new.height then - new = r + if #areas > 0 then + for _, r in ipairs(areas) do + if r.width * r.height > new.width * new.height then + new = r + end end + elseif grect.area_intersect_area(geometry, screen.workarea) then + new.x = geometry.x + new.y = geometry.y + else + new.x = screen.workarea.x + new.y = screen.workarea.y end end