Add the ignore_suspend flag to naughty (#1729)

Possible use-case could be a do-not-disturb mode where notifications
should be suspended, but some notifications triggered directly by
a user interaction (e.g. change of keyboard layout, etc.) should
still be shown.

Fixes: https://github.com/awesomeWM/awesome/issues/1728
This commit is contained in:
Tim Roes 2017-04-20 22:31:17 +02:00 committed by Daniel Hahler
parent c6c8f62e2d
commit 993ffef666
1 changed files with 3 additions and 1 deletions

View File

@ -494,6 +494,8 @@ end
-- Note: this function is only relevant to notifications sent via dbus. -- Note: this function is only relevant to notifications sent via dbus.
-- @tparam[opt] table args.actions Mapping that maps a string to a callback when this -- @tparam[opt] table args.actions Mapping that maps a string to a callback when this
-- action is selected. -- action is selected.
-- @bool[opt=false] args.ignore_suspend If set to true this notification
-- will be shown even if notifications are suspended via `naughty.suspend`.
-- @usage naughty.notify({ title = "Achtung!", text = "You're idling", timeout = 0 }) -- @usage naughty.notify({ title = "Achtung!", text = "You're idling", timeout = 0 })
-- @treturn ?table The notification object, or nil in case a notification was -- @treturn ?table The notification object, or nil in case a notification was
-- not displayed. -- not displayed.
@ -755,7 +757,7 @@ function naughty.notify(args)
-- insert the notification to the table -- insert the notification to the table
table.insert(naughty.notifications[s][notification.position], notification) table.insert(naughty.notifications[s][notification.position], notification)
if suspended then if suspended and not args.ignore_suspend then
notification.box.visible = false notification.box.visible = false
table.insert(naughty.notifications.suspended, notification) table.insert(naughty.notifications.suspended, notification)
end end