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 <gkusnierz@gmail.com>
This commit is contained in:
Julien Danjou 2008-11-25 09:45:28 +01:00
parent a8a055af07
commit c7ee83fdbf
1 changed files with 6 additions and 4 deletions

View File

@ -136,8 +136,7 @@ local function arrange(screen)
end end
--- Destroy notification by index --- Destroy notification by index
-- @param idx Index of the notification -- @param notification Notification object to be destroyed
-- @param position One of 4 keys in notification dictionary: top_right, top_left, bottom_right, bottom_left
-- @return True if the popup was successfully destroyed, nil otherwise -- @return True if the popup was successfully destroyed, nil otherwise
function destroy(notification) function destroy(notification)
if notification then if notification then
@ -164,6 +163,7 @@ end
-- @param run Function to run on left click -- @param run Function to run on left click
-- @param width The popup width -- @param width The popup width
-- @usage naughty.notify({ title = 'Achtung!', text = 'You\'re idling', timeout = 0 }) -- @usage naughty.notify({ title = 'Achtung!', text = 'You\'re idling', timeout = 0 })
-- @return The notification object
function notify(args) function notify(args)
-- gather variables together -- gather variables together
local timeout = args.timeout or config.timeout local timeout = args.timeout or config.timeout
@ -249,6 +249,8 @@ function notify(args)
-- insert the notification to the table -- insert the notification to the table
table.insert(notifications[screen][notification.position], notification) table.insert(notifications[screen][notification.position], notification)
end
-- return the notification
return notification
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80