dots/.config/awesome/components/signals/naughty.lua
2023-01-29 10:02:22 +01:00

65 lines
1.9 KiB
Lua

local awful = require "awful"
local vars = require "themes.prismite.vars"
local wibox = require "wibox"
local naughty = require "naughty"
local xresources = require "beautiful.xresources"
local dpi = xresources.apply_dpi
function build_notification(n)
local popup = awful.popup {
widget = {
{
{
widget = naughty.widget.icon,
image = n.image,
forced_height = 64,
forced_width = 64,
clip_shape = vars.shape
},
{
{
widget = wibox.widget.textbox,
text = n.title
},
{
widget = wibox.widget.textbox,
text = n.message
},
layout = wibox.layout.fixed.vertical
},
layout = wibox.layout.fixed.horizontal
},
widget = wibox.container.margin,
margins = dpi(4)
},
border_color = vars.colors.bright.black,
border_width = vars.border_width,
ontop = true,
placement = function(d)
return awful.placement.bottom_right(d, {
honor_padding = true
})
end,
bg = vars.colors.bg,
shape = vars.shape,
}
-- popup.y = screen[1].tiling_area.height - - dpi(4)
end
-- naughty.connect_signal("request::display", build_notification)
naughty.connect_signal("request::display", function(n)
naughty.layout.box { notification = n }
end)
naughty.connect_signal("request::display_error", function(message, startup)
naughty.notification {
urgency = "critical",
title = "Oops, an error happened"..(startup and " during startup!" or "!"),
message = message
}
end)