naughty: Allow to set the message from the presets again.

This was never really supported and is really not what the presets
were event meant to be used for. But it worked and `lain` used it.
This commit is contained in:
Emmanuel Lepage Vallee 2021-09-22 19:15:33 -07:00
parent 89c84caee4
commit 21a111d154

View file

@ -570,6 +570,27 @@ function notification:set_timeout(timeout)
self:emit_signal("property::timeout", timeout)
end
function notification:get_message()
-- This property was called "text" in older versions.
-- Some modules like `lain` abused of the presets (they
-- had little choice at the time) to set the message on
-- an existing popup.
local p = rawget(self, "preset") or {}
local message = self._private.message or p.message or ""
if message == "" and p.text and p.text ~= "" then
gdebug.deprecate(
"Using the preset configuration to set the notification "..
"message is not supported. Please use `n.message = 'text'`.",
{deprecated_in=5}
)
return p.text
end
return message
end
function notification:set_text(txt)
gdebug.deprecate(
"The `text` attribute is deprecated, use `message`",