After long struggle here it is - applicable to master. I tested it extensively with next branch and it loads/seems to behave once backported to master. Please test briefly if you can. I'm going to sleep.
Thanks! koniu
From 0b626dabc3fe032983b9ac4620e93931fd459c6a Mon Sep 17 00:00:00 2001 From: koniu <[email protected]> Date: Fri, 8 May 2009 12:08:09 +0100 Subject: [PATCH] naughty: fix bug in re-indexing popups if removing older to make space Signed-off-by: koniu <[email protected]> --- lib/naughty.lua.in | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 45ec3b5..5299253 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -153,11 +153,12 @@ end -- @param position top_right | top_left | bottom_right | bottom_left -- @param height Popup height -- @param width Popup width (optional) --- @return Absolute position in {x, y} dictionary +-- @return Absolute position and index in { x = X, y = Y, idx = I } table local function get_offset(screen, position, idx, width, height) local ws = capi.screen[screen].workarea local v = {} width = width or notifications[screen][position][idx].width or config.width + local idx = idx or #notifications[screen][position] + 1 -- calculate x if position:match("left") then @@ -185,6 +186,7 @@ local function get_offset(screen, position, idx, width, height) destroy(notifications[screen][position][1]) v = get_offset(screen, position, idx, width, height) end + if not v.idx then v.idx = idx end return v end @@ -196,7 +198,7 @@ local function arrange(screen) for i,notification in pairs(notifications[screen][p]) do local offset = get_offset(screen, p, i, notification.width, notification.height) notification.box:geometry({ x = offset.x, y = offset.y, width = notification.width, height = notification.height }) - notification.idx = i + notification.idx = offset.idx end end end @@ -303,7 +305,6 @@ function notify(args) end notification.position = args.position or (args.preset and args.preset.position) or config.presets.normal.position - notification.idx = #notifications[screen][notification.position] + 1 local title = "" if args.title then title = tostring(args.title) .. "\n" end @@ -376,7 +377,7 @@ function notify(args) else notification.height = lines * height end notification.width = width - local offset = get_offset(screen, notification.position, notification.idx, notification.width, notification.height) + local offset = get_offset(screen, notification.position, nil, notification.width, notification.height) notification.box:geometry({ width = notification.width, height = notification.height, x = offset.x, @@ -384,6 +385,7 @@ function notify(args) notification.box.ontop = ontop notification.box.opacity = opacity notification.box.screen = screen + notification.idx = offset.idx -- populate widgets notification.box.widgets = { iconbox, textbox } -- 1.6.2.4
