naughty: Use a request handler to clear the notification icon.
This commit is contained in:
parent
64fb498422
commit
4492a37885
|
@ -594,6 +594,7 @@ naughty.connect_signal("request::screen", naughty.default_screen_handler)
|
||||||
-- * path
|
-- * path
|
||||||
-- * image
|
-- * image
|
||||||
-- * images
|
-- * images
|
||||||
|
-- * dbus_clear
|
||||||
--
|
--
|
||||||
-- For example, an implementation which uses the `app_icon` to perform an XDG
|
-- For example, an implementation which uses the `app_icon` to perform an XDG
|
||||||
-- icon lookup will look like:
|
-- icon lookup will look like:
|
||||||
|
@ -798,11 +799,21 @@ function naughty.icon_path_handler(self, context, hints)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Request handler for clearing the icon when asked by ie, DBus.
|
||||||
|
-- @signalhandler naughty.icon_clear_handler
|
||||||
|
function naughty.icon_clear_handler(self, context, hints) --luacheck: no unused args
|
||||||
|
if context ~= "dbus_clear" then return end
|
||||||
|
|
||||||
|
self._private.icon = nil
|
||||||
|
self:emit_signal("property::icon")
|
||||||
|
end
|
||||||
|
|
||||||
naughty.connect_signal("property::screen" , update_index)
|
naughty.connect_signal("property::screen" , update_index)
|
||||||
naughty.connect_signal("property::position", update_index)
|
naughty.connect_signal("property::position", update_index)
|
||||||
|
|
||||||
naughty.connect_signal("request::icon", naughty.client_icon_handler)
|
naughty.connect_signal("request::icon", naughty.client_icon_handler)
|
||||||
naughty.connect_signal("request::icon", naughty.icon_path_handler )
|
naughty.connect_signal("request::icon", naughty.icon_path_handler )
|
||||||
|
naughty.connect_signal("request::icon", naughty.icon_clear_handler )
|
||||||
|
|
||||||
--@DOC_signals_COMMON@
|
--@DOC_signals_COMMON@
|
||||||
|
|
||||||
|
|
|
@ -326,8 +326,12 @@ function notif_methods.Notify(sender, object_path, interface, method, parameters
|
||||||
-- Update the icon if necessary.
|
-- Update the icon if necessary.
|
||||||
if app_icon ~= notification._private.app_icon then
|
if app_icon ~= notification._private.app_icon then
|
||||||
notification._private.app_icon = app_icon
|
notification._private.app_icon = app_icon
|
||||||
notification._private.icon = nil
|
|
||||||
notification:emit_signal("property::icon")
|
naughty._emit_signal_if(
|
||||||
|
"request::icon", function()
|
||||||
|
if notification._private.icon then return true end
|
||||||
|
end, notification, "dbus_clear", {}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Even if no property changed, restart the timeout.
|
-- Even if no property changed, restart the timeout.
|
||||||
|
|
Loading…
Reference in New Issue