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