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
1 changed files with 21 additions and 0 deletions

View File

@ -570,6 +570,27 @@ function notification:set_timeout(timeout)
self:emit_signal("property::timeout", timeout) self:emit_signal("property::timeout", timeout)
end 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) function notification:set_text(txt)
gdebug.deprecate( gdebug.deprecate(
"The `text` attribute is deprecated, use `message`", "The `text` attribute is deprecated, use `message`",