From 71b93f44dda3d4c0b52a068e87a532277aa66c88 Mon Sep 17 00:00:00 2001 From: koniu Date: Thu, 23 Oct 2008 17:47:43 +0100 Subject: [PATCH] naughty: destroy oldest if no room for new popup Signed-off-by: koniu --- lib/naughty.lua.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index df00af91..d44acf67 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -120,6 +120,13 @@ local function get_offset(idx, position, lines) v.y = ws.y + ws.height - (config.margin + config.border_width + config.height*lines + existing) end + -- if positioned outside workarea, destroy oldest popup and recalculate + if v.y + config.height*lines > ws.y + ws.height or v.y < ws.y then + idx = idx - 1 + destroy(notifications[position][1]) + v = get_offset(idx, position, lines) + end + return v end -- 2.11.4.GIT