Hi,
i just played around with naughty.notify and i was only able to get the
parameter screen in function notify working after some patches. If this
is not by intention i've included a small patch - mainly get_offset
needs to respect the screen.
I am new to lua, so maybe there are better solutions.
Keep up the great work - i'm really happy with awesome awesome3 on my desk!
Regards
Matthias
--- naughty.lua.git 2008-11-19 11:52:32.000000000 +0000
+++ naughty.lua 2008-11-19 11:53:21.000000000 +0000
@@ -87,8 +87,8 @@ notifications = {
-- @param height Popup height
-- @return Absolute position in {x, y} dictionary
-local function get_offset(idx, position, height)
- local ws = capi.screen[config.screen].workarea
+local function get_offset(screen, idx, position, height)
+ local ws = capi.screen[screen].workarea
local v = {}
-- calculate x
@@ -101,7 +101,9 @@ local function get_offset(idx, position,
-- calculate existing popups' height
local existing = 0
for i = 1, idx-1, 1 do
- existing = existing + notifications[position][i].height + config.spacing + config.border_width*2
+ if notifications[position][i].box.screen == screen then
+ existing = existing + notifications[position][i].height + config.spacing + config.border_width*2
+ end
end
-- calculate y
@@ -114,8 +116,16 @@ local function get_offset(idx, position,
-- if positioned outside workarea, destroy oldest popup and recalculate
if v.y + height > ws.y + ws.height or v.y < ws.y then
idx = idx - 1
- destroy(notifications[position][1])
- v = get_offset(idx, position, height)
+ -- Check only for popups on my screen
+ local found=0;
+ for i=1,idx-1,1 do
+ if notifications[position][i].box.screen==screen then
+ found=i;
+ break
+ end
+ end
+ if found>0 then destroy(notifications[position][found]) end
+ v = get_offset(screen, idx, position, height)
end
return v
@@ -126,7 +136,7 @@ end
local function arrange()
for p,pos in pairs(notifications) do
for i,notification in pairs(notifications[p]) do
- local offset = get_offset(i, p, notification.height)
+ local offset = get_offset(notification.box.screen, i, p, notification.height)
notification.box:geometry({ x = offset.x, y = offset.y, width = config.width, height = notification.height })
notification.idx = i
end
@@ -225,7 +235,7 @@ function notify(args)
notification.height = iconbox.image.height
else
notification.height = lines * config.height end
- local offset = get_offset(notification.idx, notification.position, notification.height)
+ local offset = get_offset(screen, notification.idx, notification.position, notification.height)
notification.box:geometry({ width = config.width,
height = notification.height,
x = offset.x,