From 21a111d154c3595c8d7e9d74b43fd6321aaa0cd9 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 22 Sep 2021 19:15:33 -0700 Subject: [PATCH] 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. --- lib/naughty/notification.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/naughty/notification.lua b/lib/naughty/notification.lua index 4e602a52..860eec08 100644 --- a/lib/naughty/notification.lua +++ b/lib/naughty/notification.lua @@ -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`",