notification: Add a new destroyed reason for "lack of space".

they were previously silently dismissed.
This commit is contained in:
Emmanuel Lepage Vallee 2019-01-03 03:09:42 -05:00
parent c691a0842b
commit 29cef2d615
2 changed files with 5 additions and 1 deletions

View File

@ -59,6 +59,7 @@ ret.config.defaults = {
}
ret.notification_closed_reason = {
too_many_on_screen = -2,
silent = -1,
expired = 1,
dismissedByUser = 2, --TODO v5 remove this undocumented legacy constant

View File

@ -218,6 +218,9 @@ local notification = {}
--- Emitted when the notification is destroyed.
-- @signal destroyed
-- @tparam number reason Why it was destroyed
-- @tparam boolean keep_visible If it was kept visible.
-- @see naughty.notification_closed_reason
-- . --FIXME needs a description
-- @property ignore_suspend If set to true this notification
@ -234,7 +237,7 @@ local notification = {}
-- @tparam[opt=false] boolean keep_visible If true, keep the notification visible
-- @return True if the popup was successfully destroyed, nil otherwise
function notification:destroy(reason, keep_visible)
self:emit_signal("destroyed")
self:emit_signal("destroyed", reason, keep_visible)
return true
end