dbus: fix nil notifications (#2180)
When mangling notifications via naughty.config.notify_callback it is advised (1) to return nil to reject a notification. The underlaying dbus library tries to access a field of that notification table and fails. (1) https://awesomewm.org/doc/api/libraries/naughty.html
This commit is contained in:
parent
75fc93d9c1
commit
7519c6966a
|
@ -420,6 +420,12 @@ function naughty.getById(id)
|
|||
end
|
||||
end
|
||||
|
||||
--- Increase notification ID by one
|
||||
function naughty.get_next_notification_id()
|
||||
counter = counter + 1
|
||||
return counter
|
||||
end
|
||||
|
||||
--- Install expiration timer for notification object.
|
||||
-- @tparam notification notification Notification object.
|
||||
-- @tparam number timeout Time in seconds to be set as expiration timeout.
|
||||
|
|
|
@ -191,9 +191,11 @@ capi.dbus.connect_signal("org.freedesktop.Notifications",
|
|||
end
|
||||
args.freedesktop_hints = hints
|
||||
notification = naughty.notify(args)
|
||||
return "u", notification.id
|
||||
if notification ~= nil then
|
||||
return "u", notification.id
|
||||
end
|
||||
end
|
||||
return "u", "0"
|
||||
return "u", naughty.get_next_notification_id()
|
||||
elseif data.member == "CloseNotification" then
|
||||
local obj = naughty.getById(appname)
|
||||
if obj then
|
||||
|
|
Loading…
Reference in New Issue