From c7ee83fdbf81278e846d0509d765ee8003a9d1ae Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 25 Nov 2008 09:45:28 +0100 Subject: [PATCH] naughty: notify() returns notification object This makes notification mangling outside of naughty.lua much easier: http://awesome.naquadah.org/wiki/index.php?title=Naughty#Popup_calendar Signed-off-by: koniu --- lib/naughty.lua.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 04686dab..db688d52 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -136,8 +136,7 @@ local function arrange(screen) end --- Destroy notification by index --- @param idx Index of the notification --- @param position One of 4 keys in notification dictionary: top_right, top_left, bottom_right, bottom_left +-- @param notification Notification object to be destroyed -- @return True if the popup was successfully destroyed, nil otherwise function destroy(notification) if notification then @@ -164,6 +163,7 @@ end -- @param run Function to run on left click -- @param width The popup width -- @usage naughty.notify({ title = 'Achtung!', text = 'You\'re idling', timeout = 0 }) +-- @return The notification object function notify(args) -- gather variables together local timeout = args.timeout or config.timeout @@ -248,7 +248,9 @@ function notify(args) notification.box.widgets = { iconbox, textbox } -- insert the notification to the table - table.insert(notifications[screen][notification.position],notification) -end + table.insert(notifications[screen][notification.position], notification) + -- return the notification + return notification +end -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80