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