naughty: Only enable the legacy mode when there is no other handlers.
It was called legacy for a reason, it is meant to be used only when the rc.lua doesn't have the newer notification section.
This commit is contained in:
parent
d956b5411b
commit
4aaf6ea730
|
@ -122,6 +122,10 @@ gtable.crush(naughty, require("naughty.constants"))
|
||||||
-- @property active
|
-- @property active
|
||||||
-- @param table
|
-- @param table
|
||||||
|
|
||||||
|
--- True when there is a handler connected to `request::display`.
|
||||||
|
-- @property has_display_handler
|
||||||
|
-- @param boolean
|
||||||
|
|
||||||
local properties = {
|
local properties = {
|
||||||
suspended = false,
|
suspended = false,
|
||||||
expiration_paused = false
|
expiration_paused = false
|
||||||
|
@ -346,6 +350,10 @@ function naughty.get_active()
|
||||||
return naughty._active
|
return naughty._active
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function naughty.get_has_display_handler()
|
||||||
|
return conns["request::display"] and #conns["request::display"] > 0 or false
|
||||||
|
end
|
||||||
|
|
||||||
--- Set new notification timeout.
|
--- Set new notification timeout.
|
||||||
--
|
--
|
||||||
-- This function is deprecated, use `notification:reset_timeout(new_timeout)`.
|
-- This function is deprecated, use `notification:reset_timeout(new_timeout)`.
|
||||||
|
@ -454,7 +462,7 @@ end
|
||||||
|
|
||||||
--- Emitted when a notification has to be displayed.
|
--- Emitted when a notification has to be displayed.
|
||||||
--
|
--
|
||||||
-- To add an handler, use:
|
-- To add a handler, use:
|
||||||
--
|
--
|
||||||
-- naughty.connect_signal("request::display", function(notification, args)
|
-- naughty.connect_signal("request::display", function(notification, args)
|
||||||
-- -- do something
|
-- -- do something
|
||||||
|
|
|
@ -279,23 +279,10 @@ end
|
||||||
|
|
||||||
naughty.connect_signal("destroyed", cleanup)
|
naughty.connect_signal("destroyed", cleanup)
|
||||||
|
|
||||||
--- The default notification GUI handler.
|
|
||||||
--
|
|
||||||
-- To disable this handler, use:
|
|
||||||
--
|
|
||||||
-- naughty.disconnect_signal(
|
|
||||||
-- "request::display", naughty.default_notification_handler
|
|
||||||
-- )
|
|
||||||
--
|
|
||||||
-- It looks like:
|
|
||||||
--
|
|
||||||
--@DOC_naughty_actions_EXAMPLE@
|
|
||||||
--
|
|
||||||
-- @tparam table notification The `naughty.notification` object.
|
|
||||||
-- @tparam table args Any arguments passed to the `naughty.notify` function,
|
|
||||||
-- including, but not limited to all `naughty.notification` properties.
|
|
||||||
-- @signalhandler naughty.default_notification_handler
|
|
||||||
function naughty.default_notification_handler(notification, args)
|
function naughty.default_notification_handler(notification, args)
|
||||||
|
-- This is a fallback for users whose config doesn't have the newer
|
||||||
|
-- `request::display` section.
|
||||||
|
if naughty.has_display_handler then return end
|
||||||
|
|
||||||
-- If request::display is called more than once, simply make sure the wibox
|
-- If request::display is called more than once, simply make sure the wibox
|
||||||
-- is visible.
|
-- is visible.
|
||||||
|
@ -561,4 +548,4 @@ function naughty.default_notification_handler(notification, args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
naughty.connect_signal("request::display", naughty.default_notification_handler)
|
naughty.connect_signal("request::fallback", naughty.default_notification_handler)
|
||||||
|
|
|
@ -551,7 +551,8 @@ local function create(args)
|
||||||
|
|
||||||
-- Let all listeners handle the actual visual aspects
|
-- Let all listeners handle the actual visual aspects
|
||||||
if (not n.ignore) and (not n.preset.ignore) then
|
if (not n.ignore) and (not n.preset.ignore) then
|
||||||
naughty.emit_signal("request::display", n, args)
|
naughty.emit_signal("request::display" , n, args)
|
||||||
|
naughty.emit_signal("request::fallback", n, args)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Because otherwise the setter logic would not be executed
|
-- Because otherwise the setter logic would not be executed
|
||||||
|
|
Loading…
Reference in New Issue