naughty: Stop request::icon as soon as there is an icon.

This commit is contained in:
Emmanuel Lepage Vallee 2020-03-15 04:10:08 -04:00
parent 625b9c8901
commit c3cdac368d
2 changed files with 9 additions and 2 deletions

View File

@ -274,7 +274,9 @@ function naughty.suspend()
properties.suspended = true
end
local conns = gobject._setup_class_signals(naughty)
local conns = gobject._setup_class_signals(
naughty, {allow_chain_of_responsibility=true}
)
local function resume()
properties.suspended = false

View File

@ -647,6 +647,11 @@ for _, prop in ipairs { "category", "resident" } do
end
end
-- Stop the request::icon when one is found.
local function request_filter(self, _, _)
if self._private.icon then return true end
end
function notification.get_icon(self)
-- Honor all overrides.
if self._private.icon then
@ -689,7 +694,7 @@ function notification.get_icon(self)
-- understand.
if err then
local ctx = self._private.app_icon and "app_icon" or "image"
naughty.emit_signal("request::icon", self, ctx, {
naughty._emit_signal_if("request::icon", request_filter, self, ctx, {
app_icon = self._private.app_icon,
image = self.image
})