tests: Test the notifications.

This commit is contained in:
Emmanuel Lepage Vallee 2017-07-01 22:39:47 -04:00
parent 441c4ae98c
commit fe10119933
5 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,20 @@
--DOC_HIDE_ALL
local naughty = require("naughty") --DOC_HIDE
for _, pos in ipairs {
"top_left",
"top_middle",
"top_right",
"bottom_left",
"bottom_middle",
"bottom_right",
} do
naughty.notify {
title = pos,
position = pos,
text = "",
}
end
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View file

@ -0,0 +1,19 @@
--DOC_NO_USAGE
--DOC_HIDE_ALL
-- local naughty = require("naughty")
dbus.notify_send(
--[[data]] {
member = "Notify",
},
--[[app_name]] "Notification demo",
--[[replaces_id]] nil,
--[[icon]] "",
--[[title]] "You got a message!",
--[[text]] "This is a message from above.\nAwesomeWM is your faith.",
{"Accept", "Dismiss", "Forward"},
--[[hints]] {},
--[[expire]] 5
)
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View file

@ -0,0 +1,19 @@
local beautiful = require("beautiful") --DOC_HIDE
local text = [[An <b>important</b>
<i>notification</i>
]]
require("naughty").notify {
title = "Hello world!",
text = text,
icon = beautiful.icon,
bg = "#0000ff",
fg = "#ff0000",
font = "verdana 14",
border_width = 1,
border_color = "#ff0000"
}
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View file

@ -0,0 +1,18 @@
--DOC_HIDE_ALL
-- local naughty = require("naughty")
dbus.notify_send(
--[[data]] {
member = "Notify",
},
--[[app_name]] "Notification demo",
--[[replaces_id]] nil,
--[[icon]] "",
--[[title]] "Hello world!",
--[[text]] "The notification content",
--[[actions]] {},
--[[hints]] {},
--[[expire]] 5
)
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View file

@ -0,0 +1,31 @@
local beautiful = require("beautiful") --DOC_HIDE
local gears = {shape=require("gears.shape")} --DOC_HIDE
local naughty = require("naughty") --DOC_HIDE
local text = [[An <b>important</b>
<i>notification</i>
]]
local shapes = {
gears.shape.rounded_rect,
gears.shape.hexagon,
gears.shape.octogon,
function(cr, w, h)
return gears.shape.infobubble(cr, w, h, 20, 10, w/2 - 10)
end
}
for _, s in ipairs(shapes) do
naughty.notify {
title = "Hello world!",
text = text,
icon = beautiful.icon,
shape = s,
border_width = 3,
border_color = beautiful.bg_highlight,
margin = 15,
}
end
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80