diff --git a/lib/naughty/core.lua b/lib/naughty/core.lua index cbe596c0..5363a73a 100644 --- a/lib/naughty/core.lua +++ b/lib/naughty/core.lua @@ -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. diff --git a/lib/naughty/dbus.lua b/lib/naughty/dbus.lua index bb9fcfc5..ad930394 100644 --- a/lib/naughty/dbus.lua +++ b/lib/naughty/dbus.lua @@ -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