parent
ecec00f425
commit
347d87418b
|
@ -73,9 +73,6 @@ local function sendNotificationClosed(notificationId, reason)
|
|||
end
|
||||
end
|
||||
|
||||
-- This allow notification to be upadated later.
|
||||
local counter = 1
|
||||
|
||||
local function convert_icon(w, h, rowstride, channels, data)
|
||||
-- Do the arguments look sane? (e.g. we have enough data)
|
||||
local expected_length = rowstride * (h - 1) + w * channels
|
||||
|
@ -213,15 +210,13 @@ capi.dbus.connect_signal("org.freedesktop.Notifications",
|
|||
notification[k] = v
|
||||
end
|
||||
else
|
||||
counter = counter+1
|
||||
args.id = counter
|
||||
notification = nnotif(args)
|
||||
end
|
||||
|
||||
return "u", notification.id
|
||||
end
|
||||
counter = counter+1
|
||||
return "u", counter
|
||||
|
||||
return "u", nnotif._gen_next_id()
|
||||
elseif data.member == "CloseNotification" then
|
||||
local obj = naughty.get_by_id(appname)
|
||||
if obj then
|
||||
|
|
|
@ -453,6 +453,8 @@ local function create(args)
|
|||
if not args then return end
|
||||
end
|
||||
|
||||
assert(not args.id, "Identifiers cannot be specified externally")
|
||||
|
||||
args = args or {}
|
||||
|
||||
-- Old actions usually have callbacks and names. But this isn't non
|
||||
|
@ -524,7 +526,18 @@ local function create(args)
|
|||
n:set_timeout(n._private.timeout or n.preset.timeout)
|
||||
end
|
||||
|
||||
n.id = notification._gen_next_id()
|
||||
|
||||
return n
|
||||
end
|
||||
|
||||
-- This allows notification to be updated later.
|
||||
local counter = 1
|
||||
|
||||
-- Identifier support.
|
||||
function notification._gen_next_id()
|
||||
counter = counter+1
|
||||
return counter
|
||||
end
|
||||
|
||||
return setmetatable(notification, {__call = function(_, ...) return create(...) end})
|
||||
|
|
Loading…
Reference in New Issue