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
|
||||||
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.
|
--- Install expiration timer for notification object.
|
||||||
-- @tparam notification notification Notification object.
|
-- @tparam notification notification Notification object.
|
||||||
-- @tparam number timeout Time in seconds to be set as expiration timeout.
|
-- @tparam number timeout Time in seconds to be set as expiration timeout.
|
||||||
|
|
|
@ -191,9 +191,11 @@ capi.dbus.connect_signal("org.freedesktop.Notifications",
|
||||||
end
|
end
|
||||||
args.freedesktop_hints = hints
|
args.freedesktop_hints = hints
|
||||||
notification = naughty.notify(args)
|
notification = naughty.notify(args)
|
||||||
|
if notification ~= nil then
|
||||||
return "u", notification.id
|
return "u", notification.id
|
||||||
end
|
end
|
||||||
return "u", "0"
|
end
|
||||||
|
return "u", naughty.get_next_notification_id()
|
||||||
elseif data.member == "CloseNotification" then
|
elseif data.member == "CloseNotification" then
|
||||||
local obj = naughty.getById(appname)
|
local obj = naughty.getById(appname)
|
||||||
if obj then
|
if obj then
|
||||||
|
|
Loading…
Reference in New Issue