notification: Rename text to message
There is many "text" and the default text is the title, not the body.
This commit is contained in:
parent
faa553e47c
commit
1b567cc06a
|
@ -27,7 +27,7 @@ if awesome.startup_errors then
|
|||
naughty.notification {
|
||||
preset = naughty.config.presets.critical,
|
||||
title = "Oops, there were errors during startup!",
|
||||
text = awesome.startup_errors
|
||||
message = awesome.startup_errors
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -42,7 +42,7 @@ do
|
|||
naughty.notification {
|
||||
preset = naughty.config.presets.critical,
|
||||
title = "Oops, an error happened!",
|
||||
text = tostring(err)
|
||||
message = tostring(err)
|
||||
}
|
||||
|
||||
in_error = false
|
||||
|
|
|
@ -132,17 +132,17 @@
|
|||
--
|
||||
-- awful.spawn.with_line_callback(noisy, {
|
||||
-- stdout = function(line)
|
||||
-- naughty.notification { text = "LINE:"..line }
|
||||
-- naughty.notification { message = "LINE:"..line }
|
||||
-- end,
|
||||
-- stderr = function(line)
|
||||
-- naughty.notification { text = "ERR:"..line}
|
||||
-- naughty.notification { message = "ERR:"..line}
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- If only the full output is needed, then `easy_async` is the right choice:
|
||||
--
|
||||
-- awful.spawn.easy_async(noisy, function(stdout, stderr, reason, exit_code)
|
||||
-- naughty.notification { text = stdout }
|
||||
-- naughty.notification { message = stdout }
|
||||
-- end)
|
||||
--
|
||||
-- **Default applications**:
|
||||
|
|
|
@ -334,7 +334,7 @@ end
|
|||
|
||||
--- Replace title and text of an existing notification.
|
||||
--
|
||||
-- This function is deprecated, use `notification.text = new_text` and
|
||||
-- This function is deprecated, use `notification.message = new_text` and
|
||||
-- `notification.title = new_title`
|
||||
--
|
||||
-- @tparam notification notification Notification object, which contents are to be replaced.
|
||||
|
@ -533,7 +533,7 @@ end
|
|||
-- @tparam[opt] table args.actions A list of `naughty.action`s.
|
||||
-- @bool[opt=false] args.ignore_suspend If set to true this notification
|
||||
-- will be shown even if notifications are suspended via `naughty.suspend`.
|
||||
-- @usage naughty.notify({ title = "Achtung!", text = "You're idling", timeout = 0 })
|
||||
-- @usage naughty.notify({ title = "Achtung!", message = "You're idling", timeout = 0 })
|
||||
-- @treturn ?table The notification object, or nil in case a notification was
|
||||
-- not displayed.
|
||||
-- @deprecated naughty.notify
|
||||
|
|
|
@ -122,13 +122,13 @@ capi.dbus.connect_signal("org.freedesktop.Notifications",
|
|||
local args = { }
|
||||
if data.member == "Notify" then
|
||||
if text ~= "" then
|
||||
args.text = text
|
||||
args.message = text
|
||||
if title ~= "" then
|
||||
args.title = title
|
||||
end
|
||||
else
|
||||
if title ~= "" then
|
||||
args.text = title
|
||||
args.message = title
|
||||
else
|
||||
return
|
||||
end
|
||||
|
|
|
@ -135,7 +135,7 @@ local escape_subs = { ['<'] = "<", ['>'] = ">", ['&'] = "&" }
|
|||
|
||||
-- Cache the markup
|
||||
local function set_escaped_text(self)
|
||||
local text, title = self.text or "", self.title or ""
|
||||
local text, title = self.message or "", self.title or ""
|
||||
|
||||
if title then title = title .. "\n" else title = "" end
|
||||
|
||||
|
@ -291,7 +291,7 @@ function naughty.default_notification_handler(notification, args)
|
|||
end
|
||||
|
||||
local preset = notification.preset
|
||||
local text = args.text or preset.text
|
||||
local text = args.message or args.text or preset.message or preset.text
|
||||
local title = args.title or preset.title
|
||||
local s = get_screen(args.screen or preset.screen or screen.focused())
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ local gtable = require("gears.table")
|
|||
local timer = require("gears.timer")
|
||||
local cst = require("naughty.constants")
|
||||
local naughty = require("naughty.core")
|
||||
local gdebug = require("gears.debug")
|
||||
|
||||
local notification = {}
|
||||
|
||||
|
@ -309,8 +310,24 @@ function notification:set_timeout(timeout)
|
|||
self._private.timeout = timeout
|
||||
end
|
||||
|
||||
function notification:set_text(txt)
|
||||
gdebug.deprecate(
|
||||
"The `text` attribute is deprecated, use `message`",
|
||||
{deprecated_in=5}
|
||||
)
|
||||
self:set_message(txt)
|
||||
end
|
||||
|
||||
function notification:get_text()
|
||||
gdebug.deprecate(
|
||||
"The `text` attribute is deprecated, use `message`",
|
||||
{deprecated_in=5}
|
||||
)
|
||||
return self:get_message()
|
||||
end
|
||||
|
||||
local properties = {
|
||||
"text" , "title" , "timeout" , "hover_timeout" ,
|
||||
"message" , "title" , "timeout" , "hover_timeout" ,
|
||||
"screen" , "position", "ontop" , "border_width" ,
|
||||
"width" , "font" , "icon" , "icon_size" ,
|
||||
"fg" , "bg" , "height" , "border_color" ,
|
||||
|
@ -417,7 +434,7 @@ end
|
|||
-- @tparam[opt] table args.actions A list of `naughty.action`s.
|
||||
-- @bool[opt=false] args.ignore_suspend If set to true this notification
|
||||
-- will be shown even if notifications are suspended via `naughty.suspend`.
|
||||
-- @usage naughty.notify({ title = "Achtung!", text = "You're idling", timeout = 0 })
|
||||
-- @usage naughty.notify({ title = "Achtung!", message = "You're idling", timeout = 0 })
|
||||
-- @treturn ?table The notification object, or nil in case a notification was
|
||||
-- not displayed.
|
||||
-- @function naughty.notification
|
||||
|
@ -441,6 +458,14 @@ local function create(args)
|
|||
enable_properties = true,
|
||||
}
|
||||
|
||||
if args.text then
|
||||
gdebug.deprecate(
|
||||
"The `text` attribute is deprecated, use `message`",
|
||||
{deprecated_in=5}
|
||||
)
|
||||
args.message = args.text
|
||||
end
|
||||
|
||||
assert(naughty.emit_signal)
|
||||
-- Make sure all signals bubble up
|
||||
n:_connect_everything(naughty.emit_signal)
|
||||
|
|
|
@ -11,7 +11,7 @@ awful.keygrabber {
|
|||
stop_callback = function(_, _, _, sequence)
|
||||
autostart_works = true --DOC_HIDE
|
||||
assert(sequence == "abc") --DOC_HIDE
|
||||
naughty.notification {text="The keys were:"..sequence}
|
||||
naughty.notification {message="The keys were:"..sequence}
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ local naughty = {} --DOC_HIDE
|
|||
prompt = "<b>Run: </b>",
|
||||
keypressed_callback = function(mod, key, cmd) --luacheck: no unused args
|
||||
if key == "Shift_L" then
|
||||
notif = naughty.notification { text = "Shift pressed" }
|
||||
notif = naughty.notification { message = "Shift pressed" }
|
||||
end
|
||||
end,
|
||||
keyreleased_callback = function(mod, key, cmd) --luacheck: no unused args
|
||||
|
|
|
@ -18,7 +18,7 @@ local naughty = {} --DOC_HIDE
|
|||
textbox = atextbox,
|
||||
exe_callback = function(input)
|
||||
if not input or #input == 0 then return end
|
||||
naughty.notification { text = "The input was: "..input }
|
||||
naughty.notification { message = "The input was: "..input }
|
||||
end
|
||||
}
|
||||
end
|
||||
|
|
|
@ -31,8 +31,7 @@ local steps = {
|
|||
fake_screen.selected_tag.layout = max
|
||||
|
||||
-- Display a notification on the screen-to-be-removed
|
||||
naughty.notification { text = "test", screen = fake_screen }
|
||||
|
||||
naughty.notification { message = "test", screen = fake_screen }
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue