2022-07-19 19:45:11 +02:00
|
|
|
local naughty = require("naughty")
|
|
|
|
local beautiful = require("beautiful")
|
|
|
|
local gears = require("gears")
|
|
|
|
local awful = require("awful")
|
|
|
|
local dpi = beautiful.xresources.apply_dpi
|
|
|
|
|
|
|
|
|
|
|
|
-- ===================================================================
|
|
|
|
-- Theme Definitions
|
|
|
|
-- ===================================================================
|
|
|
|
|
|
|
|
|
|
|
|
naughty.config.defaults.ontop = true
|
|
|
|
naughty.config.defaults.icon_size = dpi(32)
|
|
|
|
naughty.config.defaults.screen = awful.screen.focused()
|
|
|
|
naughty.config.defaults.timeout = 3
|
|
|
|
naughty.config.defaults.title = "System Notification"
|
|
|
|
naughty.config.defaults.margin = dpi(16)
|
|
|
|
naughty.config.defaults.border_width = 0
|
|
|
|
naughty.config.defaults.position = "top_right"
|
|
|
|
naughty.config.defaults.shape = function(cr, w, h)
|
2022-07-23 19:31:38 +02:00
|
|
|
gears.shape.rounded_rect(cr, w, h, dpi(6))
|
2022-07-19 19:45:11 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
naughty.config.padding = dpi(7)
|
|
|
|
naughty.config.spacing = dpi(7)
|
|
|
|
naughty.config.icon_dirs = {
|
2022-07-23 19:31:38 +02:00
|
|
|
"/usr/share/icons/Tela-dark",
|
|
|
|
"/usr/share/pixmaps/"
|
2022-07-19 19:45:11 +02:00
|
|
|
}
|
|
|
|
naughty.config.icon_formats = {"png", "svg"}
|
|
|
|
|
|
|
|
-- Timeouts
|
|
|
|
naughty.config.presets.low.timeout = 3
|
|
|
|
naughty.config.presets.critical.timeout = 0
|
|
|
|
|
|
|
|
naughty.config.presets.normal = {
|
2022-07-23 19:31:38 +02:00
|
|
|
font = beautiful.title_font,
|
|
|
|
fg = beautiful.fg_normal,
|
|
|
|
bg = beautiful.bg_normal,
|
|
|
|
position = "top_right"
|
2022-07-19 19:45:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
naughty.config.presets.low = {
|
2022-07-23 19:31:38 +02:00
|
|
|
font = beautiful.title_font,
|
|
|
|
fg = beautiful.fg_normal,
|
|
|
|
bg = beautiful.bg_normal,
|
|
|
|
position = "top_right"
|
2022-07-19 19:45:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
naughty.config.presets.critical = {
|
2022-07-23 19:31:38 +02:00
|
|
|
font = "SF Display Bold 10",
|
|
|
|
fg = "#ffffff",
|
|
|
|
bg = "#ff0000",
|
|
|
|
position = "top_right",
|
|
|
|
timeout = 0
|
2022-07-19 19:45:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
naughty.config.presets.ok = naughty.config.presets.normal
|
|
|
|
naughty.config.presets.info = naughty.config.presets.normal
|
|
|
|
naughty.config.presets.warn = naughty.config.presets.critical
|
|
|
|
|
|
|
|
|
|
|
|
-- ===================================================================
|
|
|
|
-- Error Handling
|
|
|
|
-- ===================================================================
|
|
|
|
|
|
|
|
|
|
|
|
if awesome.startup_errors then
|
2022-07-23 19:31:38 +02:00
|
|
|
naughty.notify({
|
|
|
|
preset = naughty.config.presets.critical,
|
|
|
|
title = "Oops, there were errors during startup!",
|
|
|
|
text = awesome.startup_errors
|
|
|
|
})
|
2022-07-19 19:45:11 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
do
|
2022-07-23 19:31:38 +02:00
|
|
|
local in_error = false
|
|
|
|
awesome.connect_signal(
|
|
|
|
"debug::error",
|
|
|
|
function(err)
|
|
|
|
if in_error then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
in_error = true
|
|
|
|
|
|
|
|
naughty.notify({
|
|
|
|
preset = naughty.config.presets.critical,
|
|
|
|
title = "Oops, an error happened!",
|
|
|
|
text = tostring(err)
|
|
|
|
})
|
|
|
|
in_error = false
|
|
|
|
end
|
|
|
|
)
|
2022-07-19 19:45:11 +02:00
|
|
|
end
|