naughty: Replace request::icon by request::action_icon.

It wasn't a good idea to use ::icon because sometime the notification
themselves needs to request assistance for their icons.
This commit is contained in:
Emmanuel Lepage Vallee 2020-03-14 20:21:35 -04:00
parent 19b8e176bb
commit 9cf717b994
3 changed files with 15 additions and 7 deletions

View File

@ -561,9 +561,18 @@ naughty.connect_signal("request::screen", naughty.default_screen_handler)
-- If an icon is found, the handler must set the `icon` property on the `action`
-- object to a path or a `gears.surface`.
--
-- @signal request::icon
-- There is no implementation by default. To use the XDG-icon, the common
-- implementation will be:
--
-- naughty.connect_signal("request::action_icon", function(a, context, hints)
-- a.icon = menubar.utils.lookup_icon(hints.id)
-- end)
--
-- @signal request::action_icon
-- @tparam naughty.action action The action.
-- @tparam string icon_name The icon name.
-- @tparam string context The context.
-- @tparam table hints
-- @tparam string args.id The action id. This will often by the (XDG) icon name.
--- Emitted when the screen is not defined or being removed.
-- @signal request::screen

View File

@ -173,7 +173,7 @@ function notif_methods.Notify(sender, object_path, interface, method, parameters
-- and `naughty` doesn't depend on `menubar`, so delegate the
-- icon "somewhere" using a request.
if hints["action-icons"] and action_id ~= "" then
naughty.emit_signal("request::icon", a, action_id)
naughty.emit_signal("request::action_icon", a, "dbus", {id = action_id})
end
a:connect_signal("invoked", function()

View File

@ -892,10 +892,9 @@ local icon_requests = {}
table.insert(steps, function()
assert(#active == 0)
naughty.connect_signal("request::icon", function(a, icon_name)
icon_requests[icon_name] = a
a.icon = icon_name == "list-add" and small_icon or big_icon
naughty.connect_signal("request::action_icon", function(a, context, hints)
icon_requests[hints.id] = a
a.icon = hints.id == "list-add" and small_icon or big_icon
end)
local hints = {